GetColor bug ?
BlitzPlus Forums/BlitzPlus Programming/GetColor bug ?
| ||
w1=bla() WaitKey() End Function bla() window=CreateWindow("blah",32,32,512,256) image=CreateImage(64,64) SetBuffer ImageBuffer(image) GetColor 0,0 End Function I get -in debugmode- 'Attempt to release <unknown> object'. After that, when I run it again -or ANY blitz app for that matter- I get the usual 'This program has performed an illegal operation and will be shut down' message. Only a reboot gives me a clean situation again. Getcolor seems to be mr. bad guy here .. why, and how else do I read out a color of that imagebuffer ? :) And again I vote for a cold kickstart function for Blitz. And yes, developing with 98se might not be the best way, but I've no alternatives right now, besides, I think blitz+ should work perfectly with 98se, period. |
| ||
You can't use graphics commands such as CreateImage without using a canvas, or the Graphics command.w1=bla() WaitKey() End Function bla() window=CreateWindow("blah",32,32,512,256) cv = CreateCanvas(0,0,63,63,window) image=CreateImage(64,64) SetBuffer CanvasBuffer(cv) Color 100, 120, 140 Plot 0,0 GetColor 0,0 msg$ = " RGB = " + ColorRed() + " " + ColorGreen() + " " + ColorBlue() SetStatusText window, msg End Function |
| ||
hm.. that's crappy .. suppose I don't want to create a canvas? Suppose I want to set a panelcolor based on a certain rgb value from a certain image (not a canvas!)? Then I'm forced to create some dummy-canvas. I want to read from a buffer directly, so when this buffer is an imagebuffer, so be it. I think this should be fixed :) |
| ||
You can actualy, just put this at the very start of your program. Setbuffer desktopbuffer() And all your problems will be solved :) |
| ||
Inside a function from B+ ? Notice that I don't want to draw inside that function (also not to a canvas), I only want to read out a color from an imagebuffer and apply it to the panelcolor. Therefore I wish to read any value from an imagebuffer w/o any other requirements! Technically I find it strange that -in this context- you can't get info from an imagebuffer (which is just memory). |
| ||
blah() SetBuffer DesktopBuffer() Function blah() image=CreateImage(64,64) SetBuffer ImageBuffer(image) Color 100, 120, 140 Plot 0,0 GetColor 0,0 Notify " RGB = " + ColorRed() + " " + ColorGreen() + " " + ColorBlue() FreeImage(image) End Function You can get info. Just make sure you set to a none image buffer before exiting. ("SetBuffer DesktopBuffer()") |