It is currently Fri Nov 22, 2019 9:44 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: ClearCanvasGadget(gadget, colour)
PostPosted: Thu Sep 19, 2019 10:00 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 652
Location: Portugal
@Fred

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

Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: ClearCanvasGadget(gadget, colour)
PostPosted: Thu Sep 19, 2019 10:09 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1090
What is wrong with
Code:
Box(0, 0, OutputWidth(), OutputHeight(), Color)

???

_________________
PureBasic 5.71 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce GTX 980 X4 Ultra | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
 Post subject: Re: ClearCanvasGadget(gadget, colour)
PostPosted: Thu Sep 19, 2019 10:10 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 18, 2019 8:17 am
Posts: 394
He tried Box() and said it's too slow: viewtopic.php?f=13&t=72106


Top
 Profile  
Reply with quote  
 Post subject: Re: ClearCanvasGadget(gadget, colour)
PostPosted: Fri Sep 20, 2019 10:35 am 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1056
Location: Russia
Code:
  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

_________________
Library XP_Menu_Lib - office menu; HID_Lib - USB Library
Torrent client - pbTorrent (source code); Create driver in PureBasic.


Top
 Profile  
Reply with quote  
 Post subject: Re: ClearCanvasGadget(gadget, colour)
PostPosted: Fri Sep 20, 2019 7:20 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 939
I have posted something to this in the main thread:
https://www.purebasic.fr/english/viewtopic.php?p=542107#p542107

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: ClearCanvasGadget(gadget, colour)
PostPosted: Fri Sep 20, 2019 7:47 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1675
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.

_________________
On GitHub: PB Includes - IDE Tools - Color Themes


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye