Results 1 to 3 of 3

Thread: colordepth with liongfx :)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    colordepth with liongfx :)

    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...
    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

Similar Threads

  1. liongfx: circle and box anima
    By Lionheart008 in forum Experimental modules or library interface
    Replies: 1
    Last Post: 23-07-2009, 17:09

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •