Re: [Seed7-users] Transparency - GDI+
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
|
From: Thomas M. <tho...@gm...> - 2024-02-06 15:02:07
|
Hi Zachary, Sorry for the delay. Great that you are interested in writing a GDI+ graphics driver for Seed7. I started writing a GDI+ driver (drw_gdip.c) myself in 2023 but stopped soon. The problem is: It seems that X11 cannot support transparency with an alpha channel. There is support to draw windows with an arbitrary shape (not rectangular). But I did not find documentation about a general alpha channel. It could be that there is an extension to X11 that I am not aware of. So I cannot rule out that X11 can support an alpha channel. There are also OpenGL and Wayland and I guess that they could support an alpha channel. Unfortunate I have not Wayland driver at the moment and the OpenGL driver is not finished. It would be great if you would write a GDI+ driver (drw_gdip.c) for Seed7. And I would gladly add it as alternative driver to drw_win.c. But the alpha channel functionality can only be exposed to the user if there is a solution for all platforms. I will only support an alpha channel in Seed7 if it works on all platforms. In the moment I am working on a graphics library for the browser (see drw_emc.c, gkb_emc.c, emc_utl.c) which uses JavaScript. The JavaScript interface to graphics supports an alpha channel. If you convert an RGB value to a pixel value you get an ARGB pixel with ff at the highest 8 bits (meaning not transparent). Up to now the alpha channel functionality is not available from the Seed7 graphics API (this is on purpose to avoid unportable programs). As soon as all graphics drivers can handle an alpha channel I can add an official API for them. E.g.: A function that creates an ARGB pixel value from ALPHA, RED, GREEN and BLUE values. Regarding your question about using drw_gdip.c: If you want that the Seed7 compiler/interpreter uses the drw_gdip.c driver instead of drw_win.c you need to edit your makefile. Depending on the compiler you use (I assume under windows) this might be mk_mingw.mak (gcc), mk_mingc.mak (gcc from the seed7/gcc directory) mk_msvc.mak (cl from Visual Studio). If you copied some makefile to the name makefile (like I suggest in the documentation) you have to edit src/makefile. You can just replace all occurrences of drw_win.c in this makefile by drw_gdip.c. you need to do a make clean (respectively make -f your_makefile.mak clean) before you start compiling. The access to the graphic keyboard in gkb_win.c uses GDI (without +). This might work with a drw_gdip.c, but I am not sure. I plan to release my version of drw_gdip.c on GitHub as soon as I have time to make it compile. But you don't need to wait for that. If you already have an drw_gdip.c file that compiles you can send a pull request with your drw_gdip.c file to GitHub. In this case I will merge my drw_gdip.c stuff to your file. Best regards Thomas |