QB64 Phoenix Edition
Saving an Inform picturebox. - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Saving an Inform picturebox. (/showthread.php?tid=3670)



Saving an Inform picturebox. - James D Jarvis - 05-07-2025

This involves using Inform.
I've figured out how to load images generated within the program into picture boxes and edit them but I haven't figured out how to save a picturebox as an image file.

It is possible to have all graphics commands write to a buffer image that is loaded into a picturebox when needed throughout execution of the program, and save that to a file when desired.  But that defeats some of the purpose of using Inform.

Any ideas?


RE: Saving an Inform picturebox. - bplus - 05-07-2025

Doesn't inForm have an Image property for the Picture Box Control which is a handle you can use with the newish _SaveImage routine?


RE: Saving an Inform picturebox. - James D Jarvis - 05-07-2025

(05-07-2025, 06:46 PM)bplus Wrote: Doesn't inForm have an Image property for the Picture Box Control which is a handle you can use with the newish _SaveImage routine?

you can load an image file into a picturebox with a filename as per doumentation
Code: (Select All)
LoadImage Control(PictureBox), ImageFile$

or you can also do this with BeginDraw and EndDraw
Code: (Select All)

                limage& = _LoadImage(Imagefile$)
                BeginDraw PictureBox1
                _PutImage (0, 0), limage&
                EndDraw PictureBox1

but I haven't figure out how to save out a picturebox itself. 

my problem is while  this would add a circle to the picturebox
Code: (Select All)

                
                BeginDraw PictureBox1
                circle(30,30),12,_rgb32(100,100,200)
                EndDraw PictureBox1

I have no clue how to save that out as an image file from the picturebox. If I could find an image handle in the inform code I could do it but I just haven't figured it out. (or if it has any for the picturebox itself).


RE: Saving an Inform picturebox. - bplus - 05-07-2025

I would think the piture box keeps an image handle property for the current image being displayed after mods to original. How else would refresh work?

https://github.com/FellippeHeitor/InForm/wiki/Picture-box

nope! see Fellippe Heitor Smile


RE: Saving an Inform picturebox. - a740g - 05-08-2025

Using "BeginDraw foo" sets foo as the current destination image. You could then simply use "_SAVEIMAGE fileName$" to write out the current destination image to disk.