1 package be
.nikiroo
.jvcard
.tui
;
5 import be
.nikiroo
.jvcard
.tui
.ImageText
.Mode
;
7 import com
.googlecode
.lanterna
.TerminalSize
;
8 import com
.googlecode
.lanterna
.gui2
.BorderLayout
;
9 import com
.googlecode
.lanterna
.gui2
.Panel
;
10 import com
.googlecode
.lanterna
.gui2
.TextBox
;
12 public class ImageTextControl
extends Panel
{
13 private ImageText img
;
17 public ImageTextControl(Image image
, TerminalSize size
) {
18 Mode mode
= Mode
.DOUBLE_DITHERING
;
19 if (!UiColors
.getInstance().isUnicode()) {
23 Mode
[] modes
= Mode
.values();
24 for (int i
= 0; i
< modes
.length
; i
++) {
29 this.setLayoutManager(new BorderLayout());
30 setImg(new ImageText(image
, size
, mode
));
33 public boolean switchMode() {
34 if (img
== null || !UiColors
.getInstance().isUnicode())
37 Mode
[] modes
= Mode
.values();
39 if (mode
>= modes
.length
)
42 img
.setMode(modes
[mode
]);
48 public void invertColor() {
50 img
.setColorInvert(!img
.isColorInvert());
55 private void setImg(ImageText img
) {
57 removeAllComponents();
60 txt
= new TextBox(img
.getText());
61 this.addComponent(txt
, BorderLayout
.Location
.CENTER
);