Griz:
Here's an example of converting RGB Int's or Shorts to Red, Green and Blue Components.
The Above code will need adjustment to suit your needs, but the conversions are correct.
Here's an example of converting RGB Int's or Shorts to Red, Green and Blue Components.
; RGB to Red, Greed, Blue ; By Paul Snart (Snarty) LockBuffer LBank=LockedPixels() LPitch=LockedPitch() LFormat=LockedFormat() Select LFormat Case 1 For y=0 To Height-1 YPos=y*LPitch For x=0 To Width-1 RGB=PeekShort(LBank,YPos+(x*2)) Red=((RGB And $F800) Shr 11) Shl 3 Green=((RGB And $7E0) Shr 5) Shl 2 Blue=(RGB And $1F) Shl 3 Next Next Case 2 ; 1555 For y=0 To Height-1 YPos=y*LPitch For x=0 To Width-1 RGB=PeekShort(LBank,YPos+(x*2)) Red=((RGB And $7C00) Shr 10) Shl 3 Green=((RGB And $3E0) Shr 5) Shl 3 Blue=(RGB And $1F) Shl 3 Next Next Case 3,4 For y=0 To Height-1 YPos=Y*LPitch For x=0 To Width-1 RGB=PeekInt(LBank,YPos+(x*LFormat)) Red=(RGB And $FF0000) Shr 16 Green=(RGB And $FF00) Shr 8 Blue=RGB And $FF Next Next End Select UnlockBuffer
The Above code will need adjustment to suit your needs, but the conversions are correct.