win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 07, 2008
- 1249 views
I'm getting that error and I don't know why. I will include the trace below and the program below that, but the error happens after a certain number of copyBlt or bitBlt calls, and is delayed depending on how much of the window is hidden behind another window, which makes me believe that it has something to do with actual rendering to the screen. I've tried tracing and freeing the bitmap memory and a number of different raster ops in my bitBlt call, and checking the state or value of mset in win32lib.ew where the error happens, but nothing helped. The initial image is 500x500, and the mask image (not being used in this code yet) is also 500x500 (pixels).
trace:
C:\EUPHORIA\include\Win32lib.ew:14741 in function getRect() variable mset has not been assigned a value
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
... called from C:\EUPHORIA\include\Win32lib.ew:3935 in function invokeHandler()
... called from C:\EUPHORIA\include\Win32lib.ew:22847 in function fDoTimer()
... called from C:\EUPHORIA\include\Win32lib.ew:24292 in function MessageProcess or()
... called from C:\EUPHORIA\include\Win32lib.ew:24343 in function WndProc()
^ call-back from Windows
... called from C:\EUPHORIA\include\msgbox.e:92 in function message_box()
... called from C:\EUPHORIA\include\w32msgs.e:100 in procedure fShowError()
... called from C:\EUPHORIA\include\w32msgs.e:175 in procedure warnErr()
... called from C:\EUPHORIA\include\Win32lib.ew:14611 in function getRect()
... called from C:\EUPHORIA\include\Win32lib.ew:5555 in function getCtlSize()
... called from C:\EUPHORIA\include\w32resources.ew:4285 in procedure copyBlt()
... called from snow.exw:50 in function put_next_flake()
... called from snow.exw:70 in procedure timer_stuff()
^ call-back from Windows
^ call-back from Windows ... (more of the same) ... 450 levels not shown
code:
without warning with trace include Win32lib.ew include get.e
required. constant NUM_FLAKES = 40 constant WIN = createEx(Window, "", 0, Default, Default, 500, 550, 0, 0) integer theTimer atom bmp_saved atom bmp_snowflake atom tpc_handle sequence temp_pixel_color sequence BMsize sequence flakes sequence snowflake_image sequence bmp_image sequence bmp_mask sequence bmp_width sequence bmp_height sequence bmp_mask_data
tpc_handle = 0 snowflake_image = "snowflake.bmp" bmp_image = "cottage.bmp" bmp_mask = "cottage_mask.bmp" theTimer = 1
bmp_saved = create(Pixmap, "", WIN, 0, 0, 500, 500, 0) bmp_snowflake = create(Pixmap, "", WIN, 0, 0, 1, 1, 0) temp_pixel_color = repeat(-1, NUM_FLAKES) flakes = repeat({0,0}, NUM_FLAKES)
for j = 1 to NUM_FLAKES do flakes[j] = {rand(500),1} end for
function mod(atom a, atom b) return remainder(a, b) end function
function load_bitmap(sequence bmp_fname) return read_bitmap(bmp_fname) load the bitmap and display it end function
function put_next_flake(sequence w) sequence next_flake_pos next_flake_pos = {mod(w[1]+((rand(3)-2)),500), w[2]+1} copyBlt(bmp_saved, next_flake_pos[1], next_flake_pos[2], bmp_snowflake) return next_flake_pos end function
function create_pixmap_pixel(integer color) sequence xpm sequence rgb_seq printf(1, "%d\n", color) rgb_seq = split_rgb(color) xpm = {"1 1 1 1", sprintf("t c #%02x%02x%02x", {rgb_seq[1], rgb_seq[2], rgb_seq[3]}), "t"} return xpmToPixmap(xpm) end function
procedure timer_stuff(integer self, integer event, sequence params) sequence next_flake atom x next_flake = {0,0} for i = 1 to NUM_FLAKES do next_flake = put_next_flake(flakes[i]) put snow if temp_pixel_color[i] != -1 then
procedure paint_bitmap(integer self, integer event, sequence params) copyBlt(WIN, 0, 0, bmp_saved) end procedure
INIT bmp_saved = loadBitmapFromFile(bmp_image) bmp_snowflake = loadBitmapFromFile(snowflake_image) setBitmap(WIN, bmp_saved) for i = 1 to NUM_FLAKES do temp_pixel_color[i] = getPixel(WIN, flakes[i][1], flakes[i][2]) end for
Handlers setHandler(WIN, w32HPaint, routine_id("paint_bitmap")) setHandler(theTimer, w32HTimer, routine_id("timer_stuff")) setTimer(WIN, theTimer, 50)
Main loop WinMain(WIN, Normal) *oOo