Skip to content

Add style stack - #214

Open
tychedelia wants to merge 1 commit into
processing:mainfrom
tychedelia:style
Open

Add style stack#214
tychedelia wants to merge 1 commit into
processing:mainfrom
tychedelia:style

Conversation

@tychedelia

Copy link
Copy Markdown
Member

Adds the style stack, which works similarly to the existing transform stack and cleans up our RenderState struct that had been overflowing with style related options. Also adds the combo push/pop operations that also capture the transform state.

@tychedelia
tychedelia requested a review from catilac July 27, 2026 20:29
@SableRaf

SableRaf commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Thanks, @tychedelia!

I see this implements push()/pop() and pushStyle()/popStyle(). Does it also include pushMatrix()/popMatrix()?

This is one difference between Processing and p5.js: Processing includes three separate pairs of functions; pushMatrix()/popMatrix(), pushStyle()/popStyle(), and the general push()/pop() (which was added later and does both); while p5.js only includes the consolidated push()/pop() functions.

If it doesn't add too much complexity, I think it'd be good to include all three for backwards compatibility.

See: https://processing.org/reference/push_.html

@tychedelia

Copy link
Copy Markdown
Member Author

I see this implements push()/pop() and pushStyle()/popStyle(). Does it also include pushMatrix()/popMatrix()?

Yes! We already have matrix support (what I refer to here as "transforms"), so this just rounds it out.

@catilac catilac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think the color choices for the example make it a bit hard to see, but after making the circle darker I could see it! Looks cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants