相关文章推荐
安静的人字拖  ·  Swagger中的对象列表·  1 月前    · 
安静的人字拖  ·  详解C# ...·  7 月前    · 
安静的人字拖  ·  push() / Reference / ...·  10 月前    · 
聪明伶俐的冰棍  ·  AttributeError: ...·  6 分钟前    · 
独立的柚子  ·  SpringBoot ...·  6 分钟前    · 
细心的蟠桃  ·  Spring Boot 2 实战:集成 ...·  6 分钟前    · 
高兴的蚂蚁  ·  mapstruct ...·  6 分钟前    · 
沉着的沙滩裤  ·  【feign】SpringCloud ...·  2 小时前    · 
眼睛小的生姜  ·  Feign的ErrorDecoder.Def ...·  2 小时前    · 
仗义的竹笋  ·  Spring Cloud Feign ...·  2 小时前    · 

Name

push()

Description

The push() function saves the current drawing style settings and transformations, while pop() restores these settings. Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push(), it builds on the current style and transform information.
push() stores information related to the current transformation state and style settings controlled by the following functions: rotate() , translate() , scale() , fill() , stroke() , tint() , strokeWeight() , strokeCap() , strokeJoin() , imageMode() , rectMode() , ellipseMode() , colorMode() , textAlign() , textFont() , textMode() , textSize() , textLeading() .
The push() and pop() functions were added with Processing 3.5. They can be used in place of pushMatrix() , popMatrix() , pushStyles() , and popStyles() . The difference is that push() and pop() control both the transformations (rotate, scale, translate) and the drawing styles at the same time.

Examples

  • fill(255);
    rect(0, 0, 200, 200);  // White rectangle
    push();
    translate(80, 70);
    fill(0);  
    rect(0, 0, 200, 200);  // Black rectangle
    pop();  // Restore original settings
    fill(100);  
    rect(40, 40, 200, 200);  // Gray rectangle
  • ellipse(0, 200, 133, 133);  // Left circle
    push(); 
    
 
推荐文章