1. win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 07, 2008
- 1251 views
- Last edited Sep 08, 2008
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
2. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by DerekParnell (admin) Sep 08, 2008
- 1167 views
What version of the win32lib are you using?
3. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 08, 2008
- 1204 views
What version of the win32lib are you using?
"Win32lib 0.70.4 17-June-2008"
4. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 08, 2008
- 1363 views
Also, I noticed that my code post is messed up, so here's snow.exw: http://www.aglitchinthematrix.net/snow.exw
5. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by ryanj Sep 08, 2008
- 1287 views
Also, I noticed that my code post is messed up, so here's snow.exw: http://www.aglitchinthematrix.net/snow.exw
You can put source inside <eucode></eucode> to format it correctly.
without warning with trace include Win32lib.ew include get.e 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 -- problem here? printf(1, "%d, ", flakes[i][2]) -- if flakes[i][2] = 252 then -- trace(1) -- end if if flakes[i][1] >= 0 and flakes[i][1] < 500 then tpc_handle = create_pixmap_pixel(temp_pixel_color[i]) bitBlt(bmp_saved, flakes[i][1], flakes[i][2], tpc_handle, 0, 0, 1, 1, SRCCOPY) -- replace pixel end if end if flakes[i] = next_flake -- set flakes[i] to next_flake temp_pixel_color[i] = getPixel(WIN, flakes[i][1], flakes[i][2]) -- get pixels to be replaced end for -- Render to screen -- Repaint window (some logic, some paint) repaintFG(WIN) end procedure 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
6. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by CChris Sep 08, 2008
- 1216 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
One thing you didn't mention is which version of the lib you are using. It could make a difference though.
CChris
7. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by CChris Sep 08, 2008
- 1208 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
One thing you didn't mention is which version of the lib you are using. It could make a difference though.
CChris
Ok, so it is tgemost reent release. I'll check this out 5-6 hours fro now - I don' have the code at hand atm.
CChris
8. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by euphoric (admin) Sep 08, 2008
- 1232 views
I'm getting that error and I don't know why.
One thing you didn't mention is which version of the lib you are using. It could make a difference though.
Ok, so it is tgemost reent release. I'll check this out 5-6 hours fro now - I don' have the code at hand atm.
Twice you quote the entire message, adding only one line of text of your own. Why?! It wastes bandwidth and storage space. Not that we're hurting for it. But there's no point in doing that.
Let's all trim posts when possible.
9. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by CChris Sep 08, 2008
- 1202 views
Something is weird about the bmp_snowflake variable.
C:\EUPHORIA\snow.exw (9): atom bmp_snowflake C:\EUPHORIA\snow.exw (28): bmp_snowflake = create(Pixmap, "", WIN, 0, 0, 1, 1, 0) C:\EUPHORIA\snow.exw (93): bmp_snowflake = loadBitmapFromFile(snowflake_image)
So, at some point, bmp_snowflake is a win32lib id of a Pixmap control
Later, it becomes a bitmap handle asyou load a bitmap file from disk.
This would explain why getRect() is processing an unknown id (the bitmap handle), but for some reason that handle is not seeen as a bitmap handle by Windows. That's how you got an error 436.
Try using a different variable for the Pixmap control id. This should eliminate the error.
CChris
10. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by Mike777 Sep 08, 2008
- 1243 views
For those of us who read the messages from the subject list, rather than the thread list, it is very helpful and saves a lot of time if the original messages are quoted.
If you want to trim extra stuff, please feel free.
But please try to continue the readability of the thread if people are going through the messages as received!
11. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by Mike777 Sep 08, 2008
- 1174 views
For those of us who read the messages from the subject list, rather than the thread list, it is very helpful and saves a lot of time if the original messages are quoted.
If you want to trim extra stuff, please feel free.
But please try to continue the readability of the thread if people are going through the messages as received!
And in case it isn't obvious, I intentionally did not quote anything in my original message so you could see what it looks like when reading in subject view rather than thread view.
12. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by mattlewis (admin) Sep 08, 2008
- 1166 views
For those of us who read the messages from the subject list, rather than the thread list, it is very helpful and saves a lot of time if the original messages are quoted.
If you want to trim extra stuff, please feel free.
But please try to continue the readability of the thread if people are going through the messages as received!
As another "subject list" reader, I'd further ask that we trim down to the relevant part of the previous message. One line posts that quote 100 lines are ridiculous (just as are email replies that do the same thing). They're difficult to read, and have a higher likelihood of being ignored.
It's not a big deal IMHO to quote the entire post if it's just a few lines (like this one). But gargantuan posts (esp. ones that posted sample code) should be edited for replies. Please.
Matt
13. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 08, 2008
- 1208 views
Something is weird about the bmp_snowflake variable.
...
CChris
Thanks for your reply, CChris. I tried that, even eliminating all pixmaps except for the one from the xpmToPixmap call (because it's the only 'bitBlt'able xpmTo function) and I even commented out the copyBlt call that draws bmp_snowflake to the offscreen buffer, and I still got the error. It seems to be happening in this part of the code, specifically during the bitBlt call:
tpc_handle = create_pixmap_pixel(temp_pixel_color[i]) bitBlt(bmp_saved, flakes[i][1], flakes[i][2], tpc_handle, 0, 0, 1, 1, SRCCOPY) -- replace pixel
which makes me think that it is something similar to what you proposed the problem might be. Could it be that I shouldn't be 'bitBlt'ing a pixmap onto an offscreen bitmap? It seems like these should be compatible because the Euphoria manual says that a pixmap is an "offscreen color bitmap". It could possibly have something to do with the return value from this function, although when I screened the output everything looked legit:
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
Another thing that may be of note is that whenever the problematic bitBlt line is executed, the program memory used jumps about 40k, which is weird because writing to the offscreen bitmap of a fixed size and dimensions shouldn't consistently be raising memory like that, right? Anyway, if you have any other ideas, please let me know :)
14. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by dasium Sep 10, 2008
- 1221 views
Okay, I think I fixed the problem. I didn't realize that Euphoria doesn't destroy an object when it's no longer referenced, or at least a Pixmap object, I don't know about others. After reading something about Pixmaps and DIBs being an exception in some way to the way objects are handled, I decided to try this:
destroy(tpc_handle)
It seems to have solved my problem! :)
15. Re: win32lib help: Error code 436: getrect:getObject for bitmap failed.
- Posted by mattlewis (admin) Sep 10, 2008
- 1244 views
Okay, I think I fixed the problem. I didn't realize that Euphoria doesn't destroy an object when it's no longer referenced, or at least a Pixmap object, I don't know about others.
Euphoria doesn't know about any sort of Win32Lib (or any other library) objects. It only knows about the native euphoria objects that your program uses. But the id that you have for a Pixmap actually represents data that was created by Windows. In order to destroy it, you need to tell windows (like you did with destroy).
Matt