
Originally Posted by
LaVolpe
Jonney, nope. Notice that clrMatrix(4, 4) is set to non-null when grayscale matrix was created. The lightness matrix section is only filling in those matrix items if clrMatrix(4, 4) is null. That should be the case for all the matrix sections. Only fill in the required items if they haven't already been filled in.
My alpha image control rewrote that logic, but fundamentally, it uses the same checks & balances.
I miss the check. 
I am troubleshooting why the alpha doesn't work: hGraphics bind to hImage.
Code:
GdipGetImageGraphicsContext hImage, hGraphics
imgAttributesHandle = pvModifyAttributes(Alpha,Lightness, TransColor,GrayScale)
GdipDrawImageRectRectI hGraphics, hImage, 0, 0, imgWidth, imgHeight, 0, 0, imgWidth, imgHeight, UnitPixel, imgAttributesHandle
If imgAttributesHandle Then GdipDisposeImageAttributes imgAttributesHandle
GdipDeleteGraphics hGraphics
Edited:
But this one is OK: hGraphics created by hdc.
Code:
Public Sub gdipStretchPicture(ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long, hImage As Long, ByVal srcX As Long, ByVal srcY As Long, ByVal srcWidth As Long, ByVal srcHeight As Long, Optional ByVal srcUnit As GpUnit = UnitPixel)
If hImage <> 0 Then
Dim hGraphics As Long
GdipCreateFromHDC hdc, hGraphics
Dim Attributes As Long 'Testing Code
Attributes = pvModifyAttributes(70, 0, 0, 1) 'Testing Code
GdipDrawImageRectRectI hGraphics, hImage, x, y, Width, Height, srcX, srcY, srcWidth, srcHeight, srcUnit, Attributes
If Attributes <> 0 Then GdipDisposeImageAttributes Attributes
GdipReleaseDC hGraphics, hdc
GdipDeleteGraphics hGraphics
End If
End Sub