GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Savapo
New User
New User
Posts: 8
Joined: Sun Jun 02, 2013 1:55 am

GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Post by Savapo »

Hello,

Please, would it be possible to add the function 'memo=GetDrawingMode()' or 'memo=DrawingMode()', to be able to store and restore the state of DrawingMode() ?

same for 'memo=GetFrontColor()' or 'memo=FrontColor()'
same for 'memo=GetBackColor()' or 'memo=BackColor()'

To simplify writing programs, without having to manipulate global variables.

Code: Select all

Procedure Plot_Slow(x.l,y.l)
  Protected MemoDrawingMode.l
  
  MemoDrawingMode=GetDrawingMode() ; <- record state DrawingMode(...)
  
  Box(x,y,1,1)
  
  DrawingMode(memoDrawingMode)     ; <- restore state DrawingMode(...)
  
EndProcedure
Or DrawingMode() without parameters

Code: Select all

Procedure Plot_Slow(x.l,y.l)
  Protected MemoDrawingMode.l
  
  MemoDrawingMode=DrawingMode() ; <- record state DrawingMode(...)
  
  Box(x,y,1,1)
  
  DrawingMode(memoDrawingMode)  ; <- restore state DrawingMode(...)
  
EndProcedure
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Post by STARGÅTE »

+1

Or like push and pop

Code: Select all

PushDrawingMode() ; Save the old drawing mode

DrawingMode(NewMode)

PopDrawingMode() ; restore the old drawing mode
but at the moment you can define a macro like:

Code: Select all

Global CurrentDrawingMode.i

Macro GetDrawingMode()
	CurrentDrawingMode
EndMacro

Macro SetDrawingMode(Mode)
	DrawingMode(Mode) : CurrentDrawingMode = Mode
EndMacro
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Post by Demivec »

Already requested in this thread.

+1 :)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Post by Polo »

I like the idea of a push/pop drawing mode!! :)
codeprof
User
User
Posts: 65
Joined: Sun Sep 16, 2012 12:13 pm

Re: GetDrawingMode() + GetFrontColor() + GetBackColor() ?

Post by codeprof »

+1
Post Reply