Image memory contents
Image memory contents
Is there a way to access the memory contents of an image? I want to zoom the image on a canvas.
Re: Image memory contents
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: Image memory contents
Thanks but I need to access the memory of an image, not the drawing buffer. Is there any way to do that?
Re: Image memory contents
@coco2
Mean you this ?
Mean you this ?
Code: Select all
Procedure CopyContent_Image_Canvas(source_ID, destination_ID, output_x, output_y, new_size_x, new_size_y)
If Not StartDrawing(CanvasOutput(destination_ID)) : ProcedureReturn 0 : EndIf
DrawImage(ImageID(source_ID), output_x, output_y, new_size_x, new_size_y)
StopDrawing()
ProcedureReturn 1
EndProcedure
Re: Image memory contents
That works but it has two problems for what I am trying to do. DrawImage() can increase the size of the image which is good, but I need to use DrawAlphaImage() which can't enlarge. Also another problem is that when it zooms the image it is antialiased where there's transparency but I am making an image editor so I don't want this. I think I might have to draw the image using Box() but I don't know how to access the memory of the image.
Re: Image memory contents
this perhaps, then?
Code: Select all
Procedure CopyContent_Image_Canvas(source_ID, destination_ID, output_x, output_y, new_size_x, new_size_y)
temporary_ID=CopyImage(source_ID,#PB_Any)
If IsImage(temporary_ID)
ResizeImage(temporary_ID,new_size_x,new_size_y)
If StartDrawing(CanvasOutput(destination_ID))
DrawAlphaImage(ImageID(temporary_ID), output_x, output_y)
StopDrawing()
return_value=1
EndIf
FreeImage(temporary_ID)
EndIf
ProcedureReturn 1
EndProcedure
there is no sig, only zuul (and the following disclaimer)
WARNING: may be talking out of his hat
WARNING: may be talking out of his hat
Re: Image memory contents
Thanks I will try that, but I also just realised that nco2k is correct, I can access the image drawing buffer with DrawingBuffer()
Edit: thanks city state I think that might be what I need. I tried to access the buffer directly but it's not quite what I want to do. I want to read from the image buffer and at the same time draw to the canvas, but PureBasic can only draw to one output at a time.
Edit: thanks city state I think that might be what I need. I tried to access the buffer directly but it's not quite what I want to do. I want to read from the image buffer and at the same time draw to the canvas, but PureBasic can only draw to one output at a time.
Re: Image memory contents
You must create an array for the image data
From this array you can read and write at the same time to your image
From this array you can read and write at the same time to your image
Code: Select all
For i=0 To texture_height
For ii=0 To texture_width
texture(ii, i)=Point(ii, i)
Next ii
Next i
Re: Image memory contents
On Windows you could try GetDIBits to get the pixel data.coco2 wrote:I want to read from the image buffer and at the same time draw to the canvas, but PureBasic can only draw to one output at a time.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)