Sign in to follow this  
Followers 0
bleh

GDI+ draw transparency/opacity?

4 posts in this topic

Hello

I want to draw a circle on a background picture but i want transparency in it. Is there an easy way to do it?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

$Form1 = GUICreate("Form1", 735, 121, 192, 124)
GUISetState(@SW_SHOW)

_GDIPlus_Startup()
$hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\shit.bmp")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)

$ellipse = _GDIPlus_GraphicsCreateFromHWND($Form1)
$hBrush = _GDIPlus_BrushCreateSolid(0xFFE0A0FF)
_GDIPlus_GraphicsSetSmoothingMode($ellipse, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
_GDIPlus_GraphicsFillEllipse($ellipse, 10, 10, 40, 40, $hBrush)

Share this post


Link to post
Share on other sites



I could also use a colored rectangle picture instead of _GDIPlus_GraphicsFillEllipse if that would be easier. 

Share this post


Link to post
Share on other sites

Use $hBrush = _GDIPlus_BrushCreateSolid(0x80E0A0FF) to enable alpha channel transparency.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Oh god.... I didnt even realize there was an alpha channel in it. That's what happens when you copy from the examples without looking for every detail. Shame on me.
Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0