[Gambas-user] Picture.ToString() ?

BB adamnt42 at gmail.com
Mon Jan 1 06:44:54 CET 2024


On 30/12/23 11:15 am, Bruce Steers wrote:
> If there any simpler (non-file) way to get the opposite of 
> Picture.FromString()
> I wanted a way to transmit image data using Print in Task.class.
>
> This works for me but wondered if there was a faster way than a 
> physical file?
>
> Public Sub PictureToString(Pic As Picture) As String
>
>   Dim sTmp As String = File.SetExt(Temp("tmp-pic"), "png")
>   Pic.Save(sTmp)
>   Return File.Load(sTmp)
>
> End
>
> Respects
> BruceS
>
Ohohoo and a happy new year.

For something to do I have waded through the QT4 and GTK Picture 
classes. It appears to me that adding a ToString() method for QT would 
be a simple ("hahaha" said the so-called C expert) matter as the 
underlying buffer into which the file is loaded does not appear to be 
destroyed while the Picture exists and it is essentially a byte array. 
Now for GTK, guess what?! The initial buffer is released after it is 
loaded and converted to a picture! So it is not going to be so simple to 
create a way to develop a simple ToString().

I accept that this does not advance towards a solution but it may 
relieve some of your angst about the implied "Why isn't?

cheers

b

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240101/39ea0e7e/attachment.htm>


More information about the User mailing list