saving and loading bitmap files
- Posted by Shawn Pringle <shawn.pringle at ?mail.c?m> Jan 20, 2008
- 536 views
Hello. I have written a graphical program that created pixmaps on the using simple drawing operations. CleanFace is an image that never changes ClockFace is an image that we add elements like the Sun, a second hand, and a minute hand. Every second I copyBlt CleanFace to ClockFace and use a transblt to copy the sun and drawline for the two hands. When the program closes it uses copyToTrueColorBitmapFile() to save CleanFace to disk. When the program starts up it tries to open this file so it doesn't have to make CleanFace from scratch. The function loadBitmapFromFile returns a postive result. Therefore it no error. I use copyBlt() to copy contents of this newly added pixmap to CleanFace. Yet, the face doesn't appear. Commenting out copyBlt has no affect. Is there something I need to do to the pixmaps before I call copyBlt on them? What could be wrong? Shawn
procedure TheWindow_onResize (integer self, integer event, sequence params)--params is ( int style, int cx, int cy ) sequence old_image_size . . window_size = getCtlSize(TheWindow) old_image_size = getCtlSize( CleanFace ) inner_size = params[2..3] if hash:exists( faces, inner_size ) and CACHE_IMAGE_DEBUG then if CACHE_IMAGE_DEBUG then printf(1,"Sizes are the same as saved... using saved file.\n",{}) end if -- copyBlt doesn't work here copyBlt( CleanFace, 0, 0, hash:fetch( faces, inner_size ) ) else setPenColor( CleanFace, Blue ) display( CleanFace ) end if . . . end procedure