Hi,

My two cents about this great library...

I've rewrote the DrawImage function to make use of the matrix stuff easier.

Gdip_DrawImage(pGraphics, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh, alpha=1, s="0,1,0,0")
{
VarSetCapacity(ColourMatrix, 100, 0)
Loop, 25
NumPut(Mod(A_Index-1, 6) ? 0 : 1, ColourMatrix, (A_Index-1)*4, "float")
NumPut(alpha, ColourMatrix, 72, "float")
if (s!="0,1,0,0")
{
StringSplit, s, s, `,
s1 := s2*sin(s1)
sc := 1-s2
r := 0.3086*sc-s1
g := 0.6094*sc-s1
b := 0.0820*sc-s1
NumPut(r+s2+3*s1, ColourMatrix, 0, "float")
NumPut(r, ColourMatrix, 4, "float")
NumPut(r, ColourMatrix, 8, "float")
NumPut(g, ColourMatrix, 20, "float")
NumPut(g+s2+3*s1, ColourMatrix, 24, "float")
NumPut(g, ColourMatrix, 28, "float")
NumPut(b, ColourMatrix, 40, "float")
NumPut(b, ColourMatrix, 44, "float")
NumPut(b+s2+3*s1, ColourMatrix, 48, "float")
NumPut(s3, ColourMatrix, 80, "float")
NumPut(s3, ColourMatrix, 84, "float")
NumPut(s3, ColourMatrix, 88, "float")
if s4
{
NumPut(s4, ColourMatrix, 12, "float")
NumPut(s4, ColourMatrix, 16, "float")
NumPut(s4, ColourMatrix, 32, "float")
NumPut(s4, ColourMatrix, 36, "float")
NumPut(s4, ColourMatrix, 52, "float")
NumPut(s4, ColourMatrix, 56, "float")
NumPut(s4, ColourMatrix, 60, "float")
NumPut(s4, ColourMatrix, 64, "float")
NumPut(s4, ColourMatrix, 68, "float")
NumPut(alpha*(1-s4),ColourMatrix, 72, "float")
}
}
DllCall("gdiplus\GdipCreateImageAttributes", "UInt*", ImageAttr)
DllCall("gdiplus\GdipSetImageAttributesColorMatrix", "UInt", ImageAttr, "Int", 1, "Int", 1, "UInt", &ColourMatrix, "Int", 0, "Int", 0)
DllCall("gdiplus\GdipDrawImageRectRect", "UInt", pGraphics, "UInt", pBitmap
, "Float", dx, "Float", dy, "Float", dw, "Float", dh
, "Float", sx, "Float", sy, "Float", sw, "Float", sh
, "Int", 2, "UInt", ImageAttr, "UInt", 0, "UInt", 0)
DllCall("gdiplus\GdipDisposeImageAttributes", "UInt", ImageAttr)
}

So, what changes ?

Instead of passing a complex matrix as argument, you can pass 2 parameters:

- Alpha transparency

- Hue, Saturation, Brightness, Alpha

The first Alpha is the global alpha of the image; the second one let you remove the dark parts of the image ( if <0 ) or the bright parts of the image ( if >0 ).

The Hue value goes from -PI/2 to PI/2 (0=no hue)

The Saturation goes from 0 (greyscale) to 1 (normal) and beyond (over-saturation)

The Brightness can be 0 (normal) , >0 (bright) or <0 (dark)

Hope you will like it...