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

19
LINES

< > BotCompany Repo | #1030575 // DrawMousePointer

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

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

1  
sclass DrawMousePointer {
2  
  S pointerImgID = #1102978;
3  
  Pt hotspot = new(75, 11);
4  
  int ptrW = 24;
5  
  
6  
  transient Pt scaledHotspot;
7  
  transient BufferedImage imgPointer;
8  
  
9  
  BufferedImage drawOn(BufferedImage canvas, Pt mouse) {
10  
    if (imgPointer == null) {
11  
      imgPointer = loadImage2(pointerImgID);
12  
      scaledHotspot = scalePt(hotspot, doubleRatio(ptrW, imgPointer.getWidth()));
13  
      imgPointer = scaleImageToWidth(imgPointer, ptrW);
14  
    }
15  
    
16  
    drawImage(canvas, imgPointer, translatePt(neg(hotspot), mouse));
17  
    ret canvas;
18  
  }
19  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030575
Snippet name: DrawMousePointer
Eternal ID of this version: #1030575/2
Text MD5: aaa04469f9e06a8b7eb4697f8af6f3fe
Transpilation MD5: efa8328d1a086217733c6a33583d32a3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-01-11 00:47:22
Source code size: 563 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 135 / 336
Version history: 1 change(s)
Referenced in: [show references]