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).

sclass JVolatileImageSurface > Surface {
  VolatileImageMakerForComponent volatileImageMaker;
  settable bool volatileMode = true;
  settable Renderable renderable;
  
  *() {}
  *(Renderable *renderable) {}
  
  { clearSurface = false; }
  
  @Override
  public void render(int w, int h, Graphics2D g) {
    if (renderable == null)
      ret with fillRect(g, 0, 0, w, h, Color.white);
      
    if (!volatileMode)
      renderable.renderOn(g, w, h);
    else {
      if (volatileImageMaker == null || !volatileImageMaker.sizeIs(w, h))
        volatileImageMaker = new VolatileImageMakerForComponent(this, w, h, renderable);
          
      volatileImageMaker.paintOnScreen(g);
    }
  }
}

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: 154 / 294
Version history: 11 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)