How do I get color values from the long number returned by the point command? Like you use in a picture box.
Printable View
How do I get color values from the long number returned by the point command? Like you use in a picture box.
Using CopyMemory() or LSet is the easiest way:
Z.Code:Type RGBN
R as Byte
G as Byte
B as Byte
N as Byte
End Type
...
Dim c as Long
Dim c2 as RGBN
...
LSet c2 = c
'// or CopyMemory(c2, c, 4)
Whats N for? alpha?
Yeah. In normal Win32GDI, that byte is ignored. If you use that method with an alpha color, N will hold the correct value.
Z.
Thanks for the help so far, but I get a type mismatch error when I try to use LSet.
Code:Private Type GroundVertex
'position cords
X As Single
Y As Single
Z As Single
'normal vector
nX As Single
nY As Single
nZ As Single
'Color stuff
Diffuse As Long
Specular As Long
'TextureStuff
TextureUV(2) As D3DVECTOR2 'planning to have 3 layers of textures
End Type
Private Type RGBA
R As Byte
G As Byte
B As Byte
A As Byte
End Type
Private Hmap(255, 255) As Single
Private GroundTiles(16, 16) As Direct3DVertexBuffer8
Private Const FVF_Ground = D3DFVF_XYZ Or D3DFVF_NORMAL Or D3DFVF_DIFFUSE Or D3DFVF_SPECULAR _
Or D3DFVF_TEX2
Public Sub Load()
Dim X, Y
Dim c As RGBA
For X = 0 To 255
For Y = 0 To 255
LSet c = PictureForm.Picture1.Point(X, Y) <----------
Hmap(X, Y) = c2.R / 255
Next
Next
Set PictureForm = Nothing
End Sub
Then use the CopyMemory API(in my first post).
Z.
Oops, don't need my help!
OK I'm an idiot, but VB says that function doesn't exist. Do I have to do a Declare Function thing?