How I can make a picture (*.bmp, *jpg) transparent in canvas mode? It's possible with current thinbasic version to store two pictures over one place (with magenta trick?) ? bye, largo
How I can make a picture (*.bmp, *jpg) transparent in canvas mode? It's possible with current thinbasic version to store two pictures over one place (with magenta trick?) ? bye, largo
Hi Largo,
no I'm sorry but at the moment there is no a native command able to do that job.
I will see what I can do in next thinBasic version.
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
I think this is a job for GDIplus. Will you support a GDIp canvas in thinBasic 2.0, Eros?
GdiPlus module sure. A pseudo basic version has always been there in thinbasic distribution.
A GdiPlus Canvas native control ... maybe
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
If you don't need ultrafast solution, you can have a look at:
/SampleScripts/UI/Canvas/Image_Background/Image_Background.tBasic
...which shows approach with magenta masked images on canvas.
If you need solid speed for thousands of transparent, I would recommend to jump over GDI Plus straight to the realm of GPUs and try alpha masking / alpha blending.
In ThinBASIC, you can use pure OpenGL for this, or for better comfort TBGL. When you look at TBGL_LoadTexture command, you will see you can specify optional transparent color.
Other approach would be using Mike's sprite functions, have a look at examples under:
/SampleScripts/TBGL/Sprites/
Petr
Last edited by Petr Schreiber; 29-05-2012 at 08:16.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Petr,
thanks and sorry: I forgot about the "Quick and dirty approach" example you developed
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks