GetDrawingMode or ReturnValue for DrawingMode

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Franky
Enthusiast
Enthusiast
Posts: 213
Joined: Sat Apr 26, 2003 2:58 pm

GetDrawingMode or ReturnValue for DrawingMode

Post by Franky »

Hi there,

when creating an include for drawing of specific elements, sometimes it's needed to set the DrawingMode (for example for Texts-Entries).
Including a Procedure of such an include might take effect on the behavior of the main sourcecode.
This means, that I might want to draw some PureBasic specific elements like text, than call a function to draw for example a star and than draw some text again.
When changing the drawingmode inside the "DrawStar"-Procedure, I'm unable to restore the old DrawingMode.

So, when adding a function "GetDrawingMode", I could save the old drawing mode, set my drawing mode, draw my elements and restore the old drawingmode before Returning from the procedure.
A second possibility would be to make DrawingMode return the old drawingmode.

Please check and implement that, it should not be that much work.

Thank you and best Regards

Franky
Give Up everything but trying!
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: GetDrawingMode or ReturnValue for DrawingMode

Post by kenmo »

+1

Good request for writing modular drawing functions. Glad I searched before posting...

I wish DrawingMode() returned the previous mode, similar to UseGadgetList() so we can write:

Code: Select all

Procedure DrawMyObject()
  
  PrevMode = DrawingMode(#PB_2DDrawing_AlphaBlend)
  ; draw something here
  
  DrawingMode(#PB_2DDrawing_Gradient)
  ; draw something here
  
  DrawingMode(#PB_2DDrawing_Transparent)
  ; draw something here
  
  ; restore drawing mode
  DrawingMode(PrevMode)
EndProcedure
In fact, FrontColor() and BackColor() could return the previous values too!
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: GetDrawingMode or ReturnValue for DrawingMode

Post by DoubleDutch »

Good idea.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: GetDrawingMode or ReturnValue for DrawingMode

Post by davido »

+1
DE AA EB
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: GetDrawingMode or ReturnValue for DrawingMode

Post by Bisonte »

+1 ! This is a really enhancement.
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Post Reply