Re: Loading A Graphic Using CxImage From User Input
- Posted by Andy Jun 23, 2009
- 1297 views
mic_ said...
ghaberek said...
Mic, the CXI_LoadImage() routine works two ways
Ahem:
-- CxImage wrapper for Euphoria -- /Mic, 2003
so.. yeah :P
ghaberek said...
You can either feed it a filename or a buffer of a file in memory (in which case the third parameter should be the buffer size). The latter is useful for loading images from a database and such. But it seems Andy only needs to use the filename version, as his user is selecting a file via getOpenFileName(). -Greg
Yeah the reason I asked was because he never used the data he read from the file, at least not in the posted code. But a bigger problem is probably that the wrong variable seems to be passed as the filename to CXI_LoadImage.
I made some changes to the code, but it is still crashing. Here's the code
procedure Add_Hero_WalkGfx(integer self, integer event, sequence parm) fName = getOpenFileName(EDWin,file,GraphicType) if length(fName) = 0 then return end if HeroWalk_Gfx = CXI_LoadImage(fName,GraphicType,0) HeroWalk_Gfx = createDIBFromCXImage(HeroWalk_Gfx) copyBlt(EDWin,710,220,HeroWalk_Gfx) end procedure setHandler(Hero_WalkGfx_Add,w32HClick,routine_id("Add_Hero_WalkGfx"))
What am I doing wrong?