Page 1 of 1

ClearCanvasGadget(gadget, colour)

Posted: Thu Sep 19, 2019 10:00 am
by marcoagpinto
@Fred

Someday will you have the chance to add the command:
ClearCanvasGadget(gadget, colour)
?

Thanks!

Re: ClearCanvasGadget(gadget, colour)

Posted: Thu Sep 19, 2019 10:09 pm
by Bisonte
What is wrong with

Code: Select all

Box(0, 0, OutputWidth(), OutputHeight(), Color)
???

Re: ClearCanvasGadget(gadget, colour)

Posted: Thu Sep 19, 2019 10:10 pm
by BarryG
He tried Box() and said it's too slow: viewtopic.php?f=13&t=72106

Re: ClearCanvasGadget(gadget, colour)

Posted: Fri Sep 20, 2019 10:35 am
by User_Russian

Code: Select all

  If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
    LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)

    If StartVectorDrawing(CanvasVectorOutput(0))
      VectorFont(FontID(0), 150)
      
      MovePathCursor(50, 25)
      AddPathText("Text")
      
      VectorSourceColor(RGBA(255, 0, 0, 255))
      DashPath(3, 6)
    
      StopVectorDrawing()
    EndIf
    
    SetGadgetColor(0, #PB_Gadget_BackColor, RGB(0, 250, 0)) ; <-- Clear CanvasGadget.
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

Re: ClearCanvasGadget(gadget, colour)

Posted: Fri Sep 20, 2019 7:20 pm
by Josh
I have posted something to this in the main thread:
viewtopic.php?p=542107#p542107

Re: ClearCanvasGadget(gadget, colour)

Posted: Fri Sep 20, 2019 7:47 pm
by kenmo
Josh, your snippet looks like a bug to report... EXCEPT that SetGadgetColor() doesn't officially support the CanvasGadget so it's not supposed to work.

That's what this feature request should be (no offense). Not a new, very specific command, but just add CanvasGadget support to either SetGadgetColor() or add a new #PB_Canvas_Color attribute to SetGadgetAttribute().


In the meantime, I just use the Box() method. For me it's fast enough for canvas GUIs even back to Windows XP. If you need high canvas framerates, you should use an accelerated Screen.