LongToRGB
Converts Long values (used by getpixel and other low level color functions) into RGB values that you can use. Useful if you want to manually remap an image or make some kind of color effect.
AI
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Zdrojový kód
Private Type zRGB R As Long G As Long B As Long End Type Private Sub Form_Load() 'this is just an example 'if you don't tweak the code, you will have to 'dim a variable as "zRGB" that stores the returns Dim cRGB As zRGB cRGB = LongToRGB(RGB(255, 250, 255)) MsgBox cRGB.R & ", " & cRGB.G & ", " & cRGB.B End End Sub Private Function LongToRGB(ColorValue As Long) As zRGB Dim rCol As Long, gCol As Long, bCol As Long rCol = ColorValue And &H10000FF 'this uses binary comparason gCol = (ColorValue And &H100FF00) / (2 ^ 8) bCol = (ColorValue And &H1FF0000) / (2 ^ 16) LongToRGB.R = rCol LongToRGB.G = gCol LongToRGB.B = bCol End Function
Původní komentáře (3)
Obnoveno z Wayback Machine