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

17
LINES

< > BotCompany Repo | #1015025 // Renderable

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

Libraryless. Click here for Pure Java version (5636L/31K).

1  
sinterface Renderable extends MakesBufferedImage, G2Drawable {
2  
  void renderOn(Graphics2D g, int w, int h);
3  
  
4  
  default Pt preferredSize() { ret pt(640, 480); }
5  
  
6  
  default int getWidth() { ret preferredSize().x; }
7  
  default int getHeight() { ret preferredSize().y; }
8  
  
9  
  default BufferedImage getBufferedImage aka render() {
10  
    ret renderableToImage(this);
11  
  }
12  
  
13  
  // unknown size
14  
  default void drawOn(Graphics2D g) {
15  
    renderOn(g, -1, -1);
16  
  }
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015025
Snippet name: Renderable
Eternal ID of this version: #1015025/8
Text MD5: 911d376be64e2b315c92fba438f0a5f3
Transpilation MD5: 5019e922b0fe61a3577b048b0bf1f8a8
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-15 17:58:51
Source code size: 471 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 1091
Version history: 7 change(s)
Referenced in: [show references]