View Full Version : UI/ImageCTX "IMAGECTX_SaveImage" ?
largo_winch
27-10-2011, 17:24
I've tested ImageCTX module (Uses "UIAdv") for loading images. there is a command like
IMAGECTX_LoadImage
but I cannot find in help manual
IMAGECTX_SaveImage ?
this command doesn't exist? How I can save a bitmap/jpg/png/tga image with ImageCTX ?
"Canvas_BitmapSave(APP_ScriptPath & "mandelbrot_canvas.bmp")" doesn't work because I am thinking it's just another library. my example failed because there isn't a command for saving ImageCtx_SaveImage. See picture.
does anybody started with translation of gdiplus headers to thinbasic as include file ? If not I can do that with a little help from some thinbasic profis here ;)
bye, largo
largo_winch
27-10-2011, 20:19
ok, my result is negative after googling:
I found "GdipImageCTX" from jose roca's website and that's a fact: "...but this interface doesn't have any method to save images."
bye, largo
Petr Schreiber
27-10-2011, 20:36
Hi Largo,
yes, you are correct. The control is meant only for displaying images, not their manipulation.
Petr
largo_winch
27-10-2011, 21:07
hi petr, what's your tipp for saving bmp files? (canvas, tbgl modus) As I saw in formerly month there was an exercise you have tried to save a tga file with tbgl, but the example wasn't ready so far I can remember. what's your idea for saving image files with ui/canvas modus?
bye, largo
ErosOlmi
27-10-2011, 21:26
largo,
I do not understand when you say that Canvas_BitmapSave is not working.
Here it is working fine bud, of course, it is meant to save image in BMP file format.
Is this working or not?
Thanks
Eros
ErosOlmi
27-10-2011, 22:25
thinBasic has a lot of power with very few lines of code :D
For converting image types see the example I posted for you at http://www.thinbasic.com/community/showthread.php?11425-canvas_setpixel-(mandelbrot)&p=85063#post85063
I explained the usage of a function present into an undocumented module called GDIP
Let me know.
Ciao
Eros
PS: Canvas_BitmapSave function is working just fine and is working as it is supposed to work: it saves current canvas into a bitmap file image.
Petr Schreiber
27-10-2011, 23:04
Hi Largo,
as Eros wrote, Canvas_BitmapSave works as documented, in TBGL I use TBGL_SaveScreenshot to do the same for TBGL window/control.
I think the tip Eros has in the referenced thread is very usable.
Petr
largo_winch
28-10-2011, 09:58
I will check GDIP this evening, if there is time to save for it. thank you eros and petr. @eros: no, I've said saving modus don't work only for GdipImageCTX (that was my problem, but there isn't any chance to do it because there's no function for it), now I will try GDIP and that's all I want to do. no problem I wait for next big issue of thinbasic.
I am at work and that's a horrible day where nobody knows what's going on here because half of stuff is ill, but I like such moments, because I am fit :) bye, largo
Petr Schreiber
28-10-2011, 11:03
I am at work and that's a horrible day where nobody knows what's going on here because half of stuff is ill, but I like such moments, because I am fit :) bye, largo
Do not forget that in The Thing (http://www.imdb.com/title/tt0084787/), they were all fit on the beginning... (huuuu).
Petr
largo_winch
28-10-2011, 13:10
@petr:
1) how I can convert this line to thinbasic?
' Retrieve the handle of the device context
GRAPHIC GET DC TO hdc
to something like
Canvas_Get DC to hdc ?
I will proof gdiplus power for thinbasic just for fun what's possible. I've collected gdiplus code snippets for translation.
2) thanks petr for movie about "THE THING", don't know if somebody has survived at that ancient monster time but here at work there are special forces with enourmous powers (my prof and his adjudant) they can manage nearly everything with my it knowledge (I am practise guy, they have only ideas!) One hour ago I cut into my finger in office kitchen where's a lot of mess and there were broken vine glasses on coffee table. profs! are stupid for real life! ;)
bye largo
Petr Schreiber
28-10-2011, 13:35
Hi Largo,
I am not sure how ThinBASIC canvas works internally, I would recommend to post new feature request in Support section (http://www.thinbasic.com/community/project.php?projectid=1).
Petr
largo_winch
28-10-2011, 13:58
"new feature request" I have done it, thanks for reply. bye, largo
ErosOlmi
28-10-2011, 14:48
"new feature request" I have done it, thanks for reply. bye, largo
Not necessary. Feature already present.
Please use thinBasic help that is quite completed.
Check under Canvas control: http://www.thinbasic.com/public/products/thinBasic/help/html/canvas_control.htm
You will find all suppoerted CANVAS_* commands.
In particular CANVAS_GetDC at: http://www.thinbasic.com/public/products/thinBasic/help/html/canvas_getdc.htm
Ciao
Eros
José Roca
28-10-2011, 20:19
ok, my result is negative after googling:
I found "GdipImageCTX" from jose roca's website and that's a fact: "...but this interface doesn't have any method to save images."
bye, largo
It has not one because it isn't needed. You can get a pointer to the Image object with GdipImageCtx_GetImagePtr and then save the image using this pointer with the GdiPlusSaveImageToBmp, GdiPlusSaveImageToJpeg, GdiPlusSaveImageToGif, GdiPlusSaveImageToTiff or GdiPlusSaveImageToPng functions.