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

sclass DrawMousePointer {
  S pointerImgID = #1102978;
  Pt hotspot = new(75, 11);
  int ptrW = 24;
  
  transient Pt scaledHotspot;
  transient BufferedImage imgPointer;
  
  BufferedImage drawOn(BufferedImage canvas, Pt mouse) {
    if (imgPointer == null) {
      imgPointer = loadImage2(pointerImgID);
      scaledHotspot = scalePt(hotspot, doubleRatio(ptrW, imgPointer.getWidth()));
      imgPointer = scaleImageToWidth(imgPointer, ptrW);
    }
    
    drawImage(canvas, imgPointer, translatePt(neg(hotspot), mouse));
    ret canvas;
  }
}

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: 245 / 446
Version history: 1 change(s)
Referenced in: [show references]