PDA

View Full Version : colordepth with liongfx :)



Lionheart008
10-07-2009, 16:31
hi all :)

perhaps somebody can test this script, if this colorDepth Demo works at your machine :)


'-- colordepth example with liongfx, 09.july.2009 by lionheart :)

uses "liongfx", "console"

Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" _
(ByVal hDC As Long, ByVal nIndex As Long) As Long
Declare Function GetDC Lib "user32" Alias "GetDC" _
(ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC"_
(ByVal hwnd As Long, ByVal hDC As Long) As Long
Declare Function colordepth() As String

dim x, y, z, i,k, p,trans,b,v as long

b += 1
v = rnd(0,255)

liongfx_screen 16,32,2

liongfx_WindowTitle "liongfx color_Depth Demo :) "
liongfx_Screen 18, 16
randomize timer
liongfx_screensync
liongfx_color rnd(10), rnd(10,200)
for i = 1 to 2
for x = 1 to 640
For y = 1 to 480
liongfx_PSet rnd*x, rnd*y, rnd*x *rnd*y
next
next
next
sleep 1000

liongfx_locate 17,19
liongfx_color b+4,v
liongfx_Print colordepth()
msgbox 0, "colordepth is: " + colordepth()
liongfx_Sleep

Function colordepth() As String

Dim hDC As Long
Dim cPixels As Long
Dim lResult As Long
Dim text1 As String
dim bitspixel as long
dim planes as long

bitspixel = 12
planes = 14

hDC = GetDC(0)
cPixels = GetDeviceCaps(hDC, BITSPIXEL) * _
GetDeviceCaps(hDC, PLANES)
lResult = ReleaseDC(0, hDC)

Select Case cPixels
Case 1: text1 = "Monchrom"
Case 4: text1 = "16 Colors"
Case 8: text1 = "256 Colors"
Case 16: text1 = "16 Bit colordepth"
Case 24: text1 = "24 Bit colordepth"
Case 32: text1 = "32 Bit colordepth"
End Select

colordepth = text1
End Function

liongfx_error,2

my result: 32 bit colordepth ;)

I have zipped all you need below... I am curious if this works fine... ?
thanks in advance,

lionheart

ps: don't know where to place this topic, so I try it here... :)

peter
10-07-2009, 16:36
yes, is running
Peter

Petr Schreiber
10-07-2009, 22:45
Worked ok!