you only really need one canvas. I hope this helps you understand it better:
having more than one canvas is a waste of resources. Or maybe it's cause I don't know how to do it that way :-).
' GUI application to adjust RGB levels of a photograph Strict Global start_x:Float = 320 Global start_y:Float = 240 ' a simple spline type Function spline_f:Float(p:Float, p1:Float, p2:Float, t:Float) Local a:Float = (1 - t) Return (a ^ 2.0 * p) + (2.0 * t * a * p1) + (t ^ 2 * p2) End Function Function draw_spline(x:Float, y:Float, x2:Float, y2:Float, x3:Float, y3:Float, divisions:Float) End Function ' create the window and tabbers Local MyWindow:TGadget = CreateWindow("Color Curves", 320, 320, 312, 324, Null, 1) Local Tabber:TGadget = CreateTabber(0, 0, 312, 300, MyWindow) ' make some canvases (canvi?) to house the Red,Green, and Blue curve drawings respectivly Local canvas:TGadget = CreateCanvas(12, 12, 255, 255, tabber) ' create tabs AddGadgetItem(Tabber, "Red Curve", 0, 0, "Adjust red levels.") AddGadgetItem (Tabber, "Green Curve", 0, 0, "Adjust green levels.") AddGadgetItem (Tabber, "Blue Curve", 0, 0, "Adjust blue levels.") SelectGadgetItem tabber,0 Global grfx:tgraphics = CanvasGraphics(canvas) SetGraphics grfx Global text$ = "Red Canvas" Global r% = 255,g%=0,b%=0 CreateTimer 60 Global index% = 0 Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_TIMERTICK RedrawGadget canvas Case EVENT_GADGETPAINT Cls SetColor r,g,b DrawText text,0,0 Flip() Case EVENT_GADGETACTION Select EventData() Case 0 r = 255 g = 0 b = 0 text = "Red Canvas" Case 1 r = 0 g = 255 b = 0 text = "Green Canvas" Case 2 r = 0 g = 0 b = 255 text = "Blue Canvas" End Select End Select Forever
having more than one canvas is a waste of resources. Or maybe it's cause I don't know how to do it that way :-).