File: TrueColor.java

package info (click to toggle)
libcaca 0.99.beta19-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,200 kB
  • ctags: 3,824
  • sloc: ansic: 22,346; python: 2,316; cs: 1,213; cpp: 1,114; java: 916; objc: 836; makefile: 606; sh: 457; ruby: 193; asm: 65
file content (36 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 *  libcaca       Java bindings for libcaca
 *  Copyright (c) 2009 Adrien Grand <jpountz@dinauz.org>
 *
 *  This library is free software. It comes without any warranty, to
 *  the extent permitted by applicable law. You can redistribute it
 *  and/or modify it under the terms of the Do What the Fuck You Want
 *  to Public License, Version 2, as published by Sam Hocevar. See
 *  http://www.wtfpl.net/ for more details.
 */

import org.zoy.caca.Canvas;
import org.zoy.caca.Color;
import org.zoy.caca.Display;
import org.zoy.caca.Event;

public class TrueColor {

  public static void main(String[] args) {
    Canvas cv = new Canvas(32, 16);
    Display dp = new Display(cv);
    for (int y = 0; y < 16; y++) {
      for (int x = 0; x < 16; x++) {
        int bgcolor = 0xff00 | (y << 4) | x;
        int fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
        cv.setColor(new Color.Argb(bgcolor), new Color.Argb(fgcolor));
        cv.put(x*2, y, "CA");
      }
    }
    cv.setColor(Color.Ansi.WHITE, Color.Ansi.LIGHTBLUE);
    cv.put(2, 1, "truecolor libcaca");
    dp.refresh();
    dp.getEvent(Event.Type.KEY_PRESS, -1);
  }

}