We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Getting current Style
Page Index Toggle Pages: 1
Getting current Style (Read 529 times)
Getting current Style
Mar 24th, 2009, 8:15pm
 
Hello

I want to write some functions that take account of the current 'style' as set by fill(), stroke(), strokeWeight() and possibly rectMode() and elipseMode(). A function that draws an outline and then shades in the contained space using cross hatching that lines up exactly with the inside of the line around the outside and does this for any current line weight, for example.

I realise you can save and restore the current style using push/popStyle() but is there a way a function can get current settings?

Sorry if this is a silly question but I have only been using Processing for a few weeks. Thanks

-Martin
Re: Getting current Style
Reply #1 - Mar 24th, 2009, 8:22pm
 
why dont you save your fillcolor, stroke and strokeweight as a variable? and for the mode check this :
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1236716129

Re: Getting current Style
Reply #2 - Mar 24th, 2009, 10:01pm
 
Thanks very much for that, Cedric, and JohnG in the other posting. Now I know the current instance is called g I can try some hacking. Already

float curWeight = g.strokeWeight;

looks promising.

-Martin
Page Index Toggle Pages: 1