Page 1 of 1

GetDrawingMode or ReturnValue for DrawingMode

Posted: Fri Jun 13, 2014 9:57 am
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

Re: GetDrawingMode or ReturnValue for DrawingMode

Posted: Tue Feb 23, 2016 2:43 pm
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!

Re: GetDrawingMode or ReturnValue for DrawingMode

Posted: Tue Feb 23, 2016 3:49 pm
by DoubleDutch
Good idea.

Re: GetDrawingMode or ReturnValue for DrawingMode

Posted: Tue Feb 23, 2016 5:30 pm
by davido
+1

Re: GetDrawingMode or ReturnValue for DrawingMode

Posted: Wed Feb 24, 2016 7:45 am
by Bisonte
+1 ! This is a really enhancement.