Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16044

VB6 - DIB's: how get and change alpha color element?

$
0
0
these tutorial is for learn using DIB's: https://tannerhelland.com/2008/06/18...ramming-3.html
heres the others sequencial links for the Graphics:
https://tannerhelland.com/2008/06/18...ramming-1.html : Pure VB
https://tannerhelland.com/2008/06/18...ramming-2.html : Beginning API
https://tannerhelland.com/2008/06/18...ramming-3.html (again the same): Advanced API
https://tannerhelland.com/2008/06/18...ramming-4.html : Optimizations Checklist

the link for DIB's(Advanced API) use RGB pixels:
Code:

Dim bm As Bitmap

GetObject PictureBox.Image, Len(bm), bm

Dim ImageData() as Byte
ReDim ImageData(0 To (bm.bmBitsPixel \ 8) - 1, 0 To bm.bmWidth - 1, 0 To bm.bmHeight - 1)

GetBitmapBits PictureBox.Image, bm.bmWidthBytes * bm.bmHeight, ImageData(0, 0, 0)

use it:
Code:

'First, get the image data using the above code section

Dim X as long, Y as long

For X = 0 to PictureBox.ScaleWidth - 1
For Y = 0 to PictureBox.ScaleHeight - 1

  'Invert the R value
  ImageData(2, X, Y) = 255 - ImageData(2, X, Y)
 
  'Invert the G value
  ImageData(1, X, Y) = 255 - ImageData(1, X, Y)
 
  'Invert the B value
  ImageData(0, X, Y) = 255 - ImageData(0, X, Y)
 
Next Y
Next X

my question is: how can i get and change the alpha value?

Viewing all articles
Browse latest Browse all 16044

Trending Articles