Pixmaps

Started by cpsmith0191, November 09, 2023, 20:30:24

Previous topic - Next topic

cpsmith0191

Just getting back into Blitz and am thinking of using pixmap for images too large for display on a canvas, then scrolling to view the rest. The question is: Can you alter the parts of a pixmap beyond the canvas boundary or should I think of another method? I'm creating hex based boards that are too large for display on a canvas, hence scrolling. Many thanks Carl.

Derron

TPixmap: 
Pure pixel data stored in RAM. It is kind of an "integer array" with the integers having RGBA (or ARGB or ...) data encoded into it.
The limit of a TPixmap is then ... your RAM.

TImage:
a texture on the GPU containing "COPIED" data of your pixmap. So when changing pixel data in your TImage's pixmap, it has to be uploaded to the GPU again (the whole texture).

DrawPixmap: Creates a new texture (for the gpu), fills in the data from the pixmap (aka copies it from RAM to GPU VRAM), renders the new texture - and discards it again
DrawImage: renders the texture it _once_ uploaded.


You can always fetch "sub pixmaps" (Window) from a TPixmap and create a TImage for it. So you could "tile" your big pixmap into chunks and only load new ones if you approach a tile's boundary. Thus allows a "big pixmap" (eg "worms game-like levels") and avoid loading image textures bigger than the (old) GPU can handle (2k x 2k on very old ones).


bye
Ron

cpsmith0191

Many thanks, everything I tried so far only works on the bit of the image(a tpixmap object loaded from a pixmap) in the canvas. It looks like I can directly alter the pixmap in memory and then reload it into a tpixmap object. I'm off for a fiddle, have fun cps