pixmap window

BlitzMax Forums/BlitzMax Programming/pixmap window

Robert Cummings(Posted 2006) [#1]
Hi,

I was under the impression pixmap window cut a chunk out and made a new pixmap. I am creating images. The original pixmap is then destroyed.

However weird errors occur:

http://www.blitzmax.com/Community/posts.php?topic=60220


skidracer(Posted 2006) [#2]
No the docs state a virtual pixmap is created, use

mypixmap.Window(x,y,w,h).Copy()

if you want to copy a region of the orginal.


ImaginaryHuman(Posted 2006) [#3]
A window is a pixmap `header` that points to an existing block of memory in another pixmap object. One pixmap of data is then shared between both pixmaps. It's like defining a viewport in a pixmap.


marksibly(Posted 2006) [#4]
Hi,

PixmapWindow just returns a 'virtual' window into a pixmap - it doesn't do anything clever beyond that, ie: if the main pixmap is released and you try to use the window you're hosed.


Robert Cummings(Posted 2006) [#5]
Thanks guys!

If I create an image using LoadImage(pixmap) and destroy the original pixmap, is this safe?


Dreamora(Posted 2006) [#6]
Yes as the Image will maintain an own pixmap if needed.


skidracer(Posted 2006) [#7]
What do you mean by destroy???

In it's current state, I don't think pixmap windows can safely be used with LoadImage.


Dreamora(Posted 2006) [#8]
Doesn't LoadImage create a copy of the Pixmap??? (I thought it does as my entity system does not break and it uses loadPixmap on a local pixmap instance everywhere it loads anything ... and the images created from that don't break ... I would consider it a serious bug if the TImage fails just because of the object that was used to LoadImage does not exist anymore)