3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include <libx/base.h>
24 #include <libx/object.h>
25 #include <libx/image.h>
26 #include <libx/cursor.h>
27 #include <libx/text.h>
36 unsigned key_pressed (int keycode
)
38 int scancode
= getkey ();
40 if (scancode
== keycode
)
43 if (scancode
== keycode
+128)
49 int main (int argc
, char **argv
)
52 puts ("Pls specify bmp image filename\nimgshow <bmpimage>\n");
57 xbitmap
*image
= ximage_open (argv
[1]);
62 /* Switch to VGA graphics mode */
68 /* Draw image to vga buffer */
69 ximage_draw (image
, 0, 0, -1);
71 xtext_puts (10, image
->width
+10, 30, (char *) argv
[1]);
74 itoa (image
->height
, buf_x
, 10);
77 itoa (image
->width
, buf_y
, 10);
79 xtext_puts (10, image
->width
+20, 30, "X: ");
80 xtext_puts (25, image
->width
+20, 30, buf_x
);
82 xtext_puts (10, image
->width
+29, 30, "Y: ");
83 xtext_puts (25, image
->width
+29, 30, buf_y
);
85 /* Flip double buffer - show image */
88 /* Repeat until escape is pressed */
89 while (!key_pressed (ESC
))
92 /* Go back to textual mode */