Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1034400 // JVolatileImageSurface [seems to work]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7000L/40K).

1  
sclass JVolatileImageSurface > Surface {
2  
  VolatileImageMakerForComponent volatileImageMaker;
3  
  settable bool volatileMode = true;
4  
  settable Renderable renderable;
5  
  
6  
  *() {}
7  
  *(Renderable *renderable) {}
8  
  
9  
  { clearSurface = false; }
10  
  
11  
  @Override
12  
  public void render(int w, int h, Graphics2D g) {
13  
    if (renderable == null)
14  
      ret with fillRect(g, 0, 0, w, h, Color.white);
15  
      
16  
    if (!volatileMode)
17  
      renderable.renderOn(g, w, h);
18  
    else {
19  
      if (volatileImageMaker == null || !volatileImageMaker.sizeIs(w, h))
20  
        volatileImageMaker = new VolatileImageMakerForComponent(this, w, h, renderable);
21  
          
22  
      volatileImageMaker.paintOnScreen(g);
23  
    }
24  
  }
25  
}

Author comment

Began life as a copy of #1033788

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034400
Snippet name: JVolatileImageSurface [seems to work]
Eternal ID of this version: #1034400/12
Text MD5: 8f53c987f15bef5df18bceb314c2edf6
Transpilation MD5: 7279ba3fb626efd9e0270e777cc2f370
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-05 23:50:50
Source code size: 715 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 155 / 295
Version history: 11 change(s)
Referenced in: [show references]