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

13
LINES

< > BotCompany Repo | #1004602 // utfToImage

JavaX fragment (include)

static BWImage utfToImage(S text) {
  byte[] data = toUtf8(text);
  int h = 12, w = data.length+2;
  BWImage img = new BWImage(w, h, 1f);
  for (int i = 0; i < l(data); i++) {
    img.setPixel(i+1, 0, 0f);
    img.setPixel(i+1, 11, 0f);
    for (int b = 0; b < 8; b++)
      if (bitSet(data[i], 7-b))
        img.setPixel(i+1, b+2, 0f);
  }
  ret img;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004602
Snippet name: utfToImage
Eternal ID of this version: #1004602/1
Text MD5: bc59732213c5bef5ec4c597d1ace3d4e
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-23 22:01:53
Source code size: 365 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 634 / 611
Referenced in: [show references]