#include once "fltk-c.bi"

'test of:
' Fl_Tiled_ImageNew
' Fl_WidgetSetImage http://www.fltk.org/doc-1.3/classFl__Widget.html#aff29d81e64b617158472f38d2cac186e

const IMG_SIZE=101
ScreenRes IMG_SIZE,IMG_SIZE,32,,-1
dim as ubyte ptr fb_img=ImageCreate(IMG_SIZE,IMG_SIZE)
dim as ubyte ptr fb_pixels
dim as integer w,h,bpp,pitch
ImageInfo fb_img,w,h,bpp,pitch,fb_pixels
Line fb_img,(0,0)-(100,100),rgba(255,0,255,0),BF 'transp. rectangle
Circle fb_img,(50,50),50,rgba(255,255,  0,255),,,,F
Circle fb_img,(25,30),12,rgba(255,255,255,255),,,,F
Circle fb_img,(75,30),12,rgba(255,255,255,255),,,,F
Circle fb_img,(25,30), 7,rgba(  0,  0,  0,255),,,,F
Circle fb_img,(75,30), 7,rgba(  0,  0,  0,255),,,,F
Circle fb_img,(50,50),28,rgba(  0,  0,  0,255),1.57*2,1.57*4

' BGR 2 RGB
dim as ubyte ptr p = fb_pixels
for y as integer=0 to h-1
  for x as integer=0 to w-1
    swap p[x*bpp],p[x*bpp+2]
  next
  p+=pitch
next

dim as Fl_Window      ptr win    = Fl_WindowNew(w,h,"resize me ...")
dim as Fl_Box         ptr box    = Fl_BoxNew(0,0,w,h)
Fl_WidgetSetImage box,Fl_Tiled_ImageNew(Fl_RGB_ImageNew(fb_pixels,w,h,bpp,pitch))
Fl_WidgetResize(win,100,100,w*2.5,h*.5)
Fl_GroupSetResizable(win,win)

Fl_WindowShow win

Fl_Run
