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

19
LINES

< > BotCompany Repo | #1025059 // bwImageFromColumnFloats

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

Libraryless. Click here for Pure Java version (2988L/18K).

1  
static BWImage bwImageFromColumnFloats(float[] cols) {
2  
  ret bwImageFromColumnFloats(cols, 20);
3  
}
4  
5  
static BWImage bwImageFromColumnFloats(float[] cols, int h) {
6  
  if (empty(cols) || h <= 0) null;
7  
  int w = l(cols);
8  
  BWImage bw = new(w, h);
9  
  for x to w: {
10  
    float f = cols[x];
11  
    for y to h:
12  
      bw.setPixel(x, y, f);
13  
  }
14  
  ret bw;
15  
}
16  
17  
static BWImage bwImageFromColumnFloats(int h, float[] cols) {
18  
  ret bwImageFromColumnFloats(cols, h);
19  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025059
Snippet name: bwImageFromColumnFloats
Eternal ID of this version: #1025059/3
Text MD5: 92e9fcf70599c6e15802c4273f5d30fc
Transpilation MD5: 497ee1618c9ad593c49f1681c8f349c8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-04 01:05:09
Source code size: 462 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 351
Version history: 2 change(s)
Referenced in: [show references]