[Gambas-user] How do I replace Image transparent background with a white background?

Benoît Minisini gambas at ...1...
Sun Sep 16 22:13:35 CEST 2012

Le 16/09/2012 17:55, RICHARD WALKER a écrit :
> I have hacked the OnScreenDisplay example project to allow me to
> display user-entered text instead of the time, and to permit
> interactive tweaking of colours and depth of 3D effect and font size.
> I also added a way to save the result to a png file and now I am
> trying to copy it to the clipboard as well.
> The trouble is that when I paste the result into, for example, a
> Libreoffice Writer page, the alpha channel displays as black.
> If, instead, I insert the saved png then the background is transparent.
> What I want to do is temporarily convert the image so that instead of
> being transparent it has a white background when copied to the
> clipboard.
> Any ideas?
> Richard

Dim MyImageWithWhite As Image

MyImageWithWhite = New Image(MyImage.W, MyImage.H, Color.White)
MyImageWithWhite.PaintImage(MyImage, 0, 0)

That's it, 3 lines of code. :-)

Benoît Minisini

More information about the User mailing list