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

15
LINES

< > BotCompany Repo | #1022982 // clipIBWImage (virtual clip)

JavaX fragment (include)

1  
static IBWImage clipIBWImage(IBWImage img, int x1, int y1, int w, int h) {
2  
  if (x1 == 0 && y1 == 0 && w == img.getWidth() && h == img.getHeight()) ret img;
3  
  ret new IBWImage {
4  
    public int getWidth() { ret w; }
5  
    public int getHeight() { ret h; }
6  
    
7  
    public float getFloatPixel(int x, int y) {
8  
      ret img.getFloatPixel(x+x1, y+y1);
9  
    }
10  
  };
11  
}
12  
13  
static IBWImage clipIBWImage(IBWImage img, Rect r) {
14  
  ret clipIBWImage(img, r.x, r.y, r.w, r.h);
15  
}

Author comment

Began life as a copy of #1018779

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022982
Snippet name: clipIBWImage (virtual clip)
Eternal ID of this version: #1022982/2
Text MD5: 1da929b878021f20e5334f48197a23b4
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-17 08:03:58
Source code size: 473 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 296 / 340
Version history: 1 change(s)
Referenced in: [show references]