Libraryless. Click here for Pure Java version (17327L/106K).
1 | sclass IIImageSurface extends ImageSurface { |
2 | IBWIntegralImage ii; |
3 | |
4 | *() {} |
5 | |
6 | *(IBWIntegralImage *ii) {} |
7 | *(IBWIntegralImage *ii, BufferedImage img) { super(img); } |
8 | |
9 | void drawImageItself(int w, int h, Graphics2D g) { |
10 | if (ii == null) |
11 | ret with super.drawImageItself(w, h, g); |
12 | |
13 | int iw = getZoomedWidth(), ih = getZoomedHeight(); |
14 | |
15 | Rect r = toRect(getVisibleRect()); |
16 | //_print(visibleRect := r); |
17 | |
18 | // TODO: scale only the visible part |
19 | //var scaled = scaledGrayImageFromBWIntegralImage(ii, iw, ih); |
20 | var scaled = scaledGrayImageFromBWIntegralImage_clip(ii, doubleRatio(iw, ii.getWidth()), r); |
21 | g.drawImage(scaled, r.x, r.y, null); |
22 | } |
23 | |
24 | public void setImage(BufferedImage img) { |
25 | ii = null; |
26 | super.setImage(img); |
27 | } |
28 | |
29 | void setImage(BWIntegralImage ii, BufferedImage img default null) { |
30 | this.ii = ii; |
31 | super.setImage(img); |
32 | } |
33 | |
34 | bool hasImage() { ret ii != null || image != null; } |
35 | int w() { ret ii != null ? ii.getWidth() : super.w(); } |
36 | int h() { ret ii != null ? ii.getHeight() : super.h(); } |
37 | } |
Began life as a copy of #1004553
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033519 |
Snippet name: | IIImageSurface - Image Surface showing integral image |
Eternal ID of this version: | #1033519/21 |
Text MD5: | a571c6207c693ddb028ae17bc3c7c1ad |
Transpilation MD5: | 60c706f9a653baf014cb18b7d863df66 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-12-25 23:06:00 |
Source code size: | 1110 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 198 / 308 |
Version history: | 20 change(s) |
Referenced in: | [show references] |