Code: Select all
#include once "fltk-c.bi"
#Include Once "fbgfx.bi"
Declare Sub myrgbcol(pc As UByte)
ScreenRes 580,580,,4,fb.GFX_NULL
Circle(290,290),290,2,,,,f
Type myclr
r As UByte
g As UByte
b As UByte
End Type
Dim Shared myrgb As myclr
Dim As Fl_Window Ptr win
Dim As Fl_Box Ptr box
Dim As Fl_Image Ptr img
Dim as ubyte ptr myfbgfx = ScreenPtr
Dim As UByte pixcolor
Dim As UByte Ptr pixels
Dim As Integer i
win = Fl_WindowNew(580,580)
box = Fl_BoxNew(0,0,580,580)
pixels=Allocate(580*580*3)
For i = 0 To 580*580-1
pixcolor=*(myfbgfx+i)
myrgbcol(pixcolor)
*(pixels+i*3)=myrgb.r
*(pixels+i*3+1)=myrgb.g
*(pixels+i*3+2)=myrgb.b
Next
img = Fl_RGB_ImageNew(pixels,580,580,3,0)
Fl_WidgetSetImage box,img
Fl_WidgetRedraw box
Fl_WindowShow(win)
Fl_Run
End
Sub myrgbcol(pc As UByte)
Dim As UByte r,g,b
Select Case pc
Case 0 'black
r=0
g=0
b=0
Case 1 'blue
r=0
g=0
b=255
Case 2 'green
r=0
g=255
b=0
Case 3 'cyan
r=0
g=255
b=255
Case 4 'red
r=255
g=0
b=0
Case 5 'pink
r=255
g=192
b=203
Case 6 'yellow
r=255
g=255
b=0
Case 7 'grey
r=128
g=128
b=128
Case 8 'dark grey
r=105
g=105
b=105
Case 9 'bright blue
r=132
g=112
b=255
Case 10 'bright green
r=127
g=255
b=0
Case 11 'bright cyan
r=105
g=255
b=255
Case 12 'bright red
r=255
g=105
b=105
Case 13 'bright pink
r=255
g=222
b=233
Case 14 'bright yellow
r=255
g=255
b=128
Case 15 'white
r=255
g=255
b=255
End Select
myrgb.r=r
myrgb.g=g
myrgb.b=b
End Sub