1999-07-16 20:35:21 +00:00
|
|
|
|
1999-07-19 02:13:34 +00:00
|
|
|
/* testpixbuf -- test program for gdk-pixbuf code
|
|
|
|
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
1999-07-08 16:04:16 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "gdk-pixbuf.h"
|
1999-10-26 20:43:39 +00:00
|
|
|
#include "gdk-pixbuf-io.h"
|
|
|
|
#include "gdk-pixbuf-loader.h"
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-08 23:01:05 +00:00
|
|
|
#define DEFAULT_WIDTH 24
|
|
|
|
#define DEFAULT_HEIGHT 24
|
|
|
|
|
|
|
|
static const unsigned char default_image[] = {
|
1999-10-18 19:29:45 +00:00
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0xae, 0xb3, 0xb3, 0xc6, 0xc9, 0xcd, 0xd7, 0xd4, 0xdf,
|
|
|
|
0xec, 0xde, 0xf3, 0xe7, 0xcb, 0xe9, 0xd9, 0xb5, 0xd3, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb1, 0xb7, 0xa5,
|
|
|
|
0xb0, 0xb8, 0xad, 0xb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00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0xb6, 0xa1, 0xd0, 0xb8, 0xa8,
|
|
|
|
0xcd, 0xb6, 0xb7, 0xc0, 0xb4, 0xb5, 0xb1, 0xb1, 0xaa, 0xca, 0xd1, 0xb4,
|
|
|
|
0xe3, 0xd7, 0xb5, 0xe2, 0xc1, 0xb0, 0xdb, 0xa8, 0xa3, 0xd2, 0x8a, 0xa9,
|
|
|
|
0xb7, 0x7e, 0xa2, 0xbd, 0x89, 0xa9, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0xaf, 0xaf,
|
|
|
|
0xc5, 0xb5, 0xb8, 0xb8, 0xb1, 0xb1, 0xb6, 0xbb, 0xad, 0xd0, 0xd6, 0xb5,
|
|
|
|
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xaf, 0xdd, 0xb4, 0xa9, 0xdb, 0x92, 0x9a,
|
|
|
|
0xc6, 0x84, 0xa7, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0xac, 0xaa, 0xa6, 0xbd, 0xc3, 0xb0, 0xd2, 0xd7, 0xb5,
|
|
|
|
0xe3, 0xd7, 0xb5, 0xe2, 0xbf, 0xae, 0xdb, 0xb6, 0xa8, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff,
|
|
|
|
0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff
|
1999-10-08 23:01:05 +00:00
|
|
|
};
|
|
|
|
|
1999-10-22 23:26:22 +00:00
|
|
|
|
|
|
|
static const char * book_open_xpm[] = {
|
|
|
|
"16 16 4 1",
|
|
|
|
" c None s None",
|
|
|
|
". c black",
|
|
|
|
"X c #808080",
|
|
|
|
"o c white",
|
|
|
|
" ",
|
|
|
|
" .. ",
|
|
|
|
" .Xo. ... ",
|
|
|
|
" .Xoo. ..oo. ",
|
|
|
|
" .Xooo.Xooo... ",
|
|
|
|
" .Xooo.oooo.X. ",
|
|
|
|
" .Xooo.Xooo.X. ",
|
|
|
|
" .Xooo.oooo.X. ",
|
|
|
|
" .Xooo.Xooo.X. ",
|
|
|
|
" .Xooo.oooo.X. ",
|
|
|
|
" .Xoo.Xoo..X. ",
|
|
|
|
" .Xo.o..ooX. ",
|
|
|
|
" .X..XXXXX. ",
|
|
|
|
" ..X....... ",
|
|
|
|
" .. ",
|
|
|
|
" "};
|
|
|
|
|
|
|
|
static const char * book_closed_xpm[] = {
|
|
|
|
"16 16 6 1",
|
|
|
|
" c None s None",
|
|
|
|
". c black",
|
|
|
|
"X c red",
|
|
|
|
"o c yellow",
|
|
|
|
"O c #808080",
|
|
|
|
"# c white",
|
|
|
|
" ",
|
|
|
|
" .. ",
|
|
|
|
" ..XX. ",
|
|
|
|
" ..XXXXX. ",
|
|
|
|
" ..XXXXXXXX. ",
|
|
|
|
".ooXXXXXXXXX. ",
|
|
|
|
"..ooXXXXXXXXX. ",
|
|
|
|
".X.ooXXXXXXXXX. ",
|
|
|
|
".XX.ooXXXXXX.. ",
|
|
|
|
" .XX.ooXXX..#O ",
|
|
|
|
" .XX.oo..##OO. ",
|
|
|
|
" .XX..##OO.. ",
|
|
|
|
" .X.#OO.. ",
|
|
|
|
" ..O.. ",
|
|
|
|
" .. ",
|
|
|
|
" "};
|
|
|
|
|
|
|
|
static const char * mini_page_xpm[] = {
|
|
|
|
"16 16 4 1",
|
|
|
|
" c None s None",
|
|
|
|
". c black",
|
|
|
|
"X c white",
|
|
|
|
"o c #808080",
|
|
|
|
" ",
|
|
|
|
" ....... ",
|
|
|
|
" .XXXXX.. ",
|
|
|
|
" .XoooX.X. ",
|
|
|
|
" .XXXXX.... ",
|
|
|
|
" .XooooXoo.o ",
|
|
|
|
" .XXXXXXXX.o ",
|
|
|
|
" .XooooooX.o ",
|
|
|
|
" .XXXXXXXX.o ",
|
|
|
|
" .XooooooX.o ",
|
|
|
|
" .XXXXXXXX.o ",
|
|
|
|
" .XooooooX.o ",
|
|
|
|
" .XXXXXXXX.o ",
|
|
|
|
" ..........o ",
|
|
|
|
" oooooooooo ",
|
|
|
|
" "};
|
|
|
|
|
|
|
|
static const char * gtk_mini_xpm[] = {
|
|
|
|
"15 20 17 1",
|
|
|
|
" c None",
|
|
|
|
". c #14121F",
|
|
|
|
"+ c #278828",
|
|
|
|
"@ c #9B3334",
|
|
|
|
"# c #284C72",
|
|
|
|
"$ c #24692A",
|
|
|
|
"% c #69282E",
|
|
|
|
"& c #37C539",
|
|
|
|
"* c #1D2F4D",
|
|
|
|
"= c #6D7076",
|
|
|
|
"- c #7D8482",
|
|
|
|
"; c #E24A49",
|
|
|
|
"> c #515357",
|
|
|
|
", c #9B9C9B",
|
|
|
|
"' c #2FA232",
|
|
|
|
") c #3CE23D",
|
|
|
|
"! c #3B6CCB",
|
|
|
|
" ",
|
|
|
|
" ***> ",
|
|
|
|
" >.*!!!* ",
|
|
|
|
" ***....#*= ",
|
|
|
|
" *!*.!!!**!!# ",
|
|
|
|
" .!!#*!#*!!!!# ",
|
|
|
|
" @%#!.##.*!!$& ",
|
|
|
|
" @;%*!*.#!#')) ",
|
|
|
|
" @;;@%!!*$&)'' ",
|
|
|
|
" @%.%@%$'&)$+' ",
|
|
|
|
" @;...@$'*'*)+ ",
|
|
|
|
" @;%..@$+*.')$ ",
|
|
|
|
" @;%%;;$+..$)# ",
|
|
|
|
" @;%%;@$$$'.$# ",
|
|
|
|
" %;@@;;$$+))&* ",
|
|
|
|
" %;;;@+$&)&* ",
|
|
|
|
" %;;@'))+> ",
|
|
|
|
" %;@'&# ",
|
|
|
|
" >%$$ ",
|
|
|
|
" >= "};
|
|
|
|
|
|
|
|
const gchar ** xpms[] = {
|
|
|
|
book_open_xpm,
|
|
|
|
book_closed_xpm,
|
|
|
|
mini_page_xpm,
|
|
|
|
gtk_mini_xpm,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
1999-07-08 16:04:16 +00:00
|
|
|
static void
|
|
|
|
quit_func (GtkWidget *widget, gpointer dummy)
|
|
|
|
{
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_main_quit ();
|
1999-07-08 16:04:16 +00:00
|
|
|
}
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
static void
|
1999-07-15 04:58:39 +00:00
|
|
|
expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
1999-07-08 16:04:16 +00:00
|
|
|
{
|
1999-10-18 19:29:45 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
|
|
|
|
|
|
|
if (pixbuf->art_pixbuf->has_alpha) {
|
|
|
|
gdk_draw_rgb_32_image (drawing_area->window,
|
|
|
|
drawing_area->style->black_gc,
|
|
|
|
event->area.x, event->area.y,
|
|
|
|
event->area.width,
|
|
|
|
event->area.height,
|
|
|
|
GDK_RGB_DITHER_MAX,
|
|
|
|
pixbuf->art_pixbuf->pixels
|
|
|
|
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
|
|
|
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
|
|
|
pixbuf->art_pixbuf->rowstride);
|
|
|
|
} else {
|
|
|
|
gdk_draw_rgb_image (drawing_area->window,
|
|
|
|
drawing_area->style->white_gc,
|
|
|
|
event->area.x, event->area.y,
|
|
|
|
event->area.width,
|
|
|
|
event->area.height,
|
|
|
|
GDK_RGB_DITHER_NORMAL,
|
|
|
|
pixbuf->art_pixbuf->pixels
|
|
|
|
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
|
|
|
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
|
|
|
pixbuf->art_pixbuf->rowstride);
|
|
|
|
}
|
1999-10-27 20:16:37 +00:00
|
|
|
}
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
static void
|
1999-07-16 20:35:21 +00:00
|
|
|
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
|
|
|
{
|
1999-10-20 21:20:49 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
1999-07-16 20:35:21 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
1999-07-16 20:35:21 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
g_print("X:%d Y:%d\n", event->width, event->height);
|
1999-07-16 20:35:21 +00:00
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
#if 0
|
1999-10-18 19:29:45 +00:00
|
|
|
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
|
|
|
((event->height) != (pixbuf->art_pixbuf->height)))
|
|
|
|
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
1999-10-20 21:20:49 +00:00
|
|
|
#endif
|
1999-07-16 20:35:21 +00:00
|
|
|
}
|
|
|
|
|
1999-10-27 19:42:34 +00:00
|
|
|
static GtkWidget*
|
1999-10-18 19:29:45 +00:00
|
|
|
new_testrgb_window (GdkPixbuf *pixbuf)
|
1999-07-08 16:04:16 +00:00
|
|
|
{
|
1999-10-18 19:29:45 +00:00
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *drawing_area;
|
|
|
|
gint w, h;
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
w = pixbuf->art_pixbuf->width;
|
|
|
|
h = pixbuf->art_pixbuf->height;
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
window = gtk_widget_new (gtk_window_get_type (),
|
|
|
|
"GtkObject::user_data", NULL,
|
|
|
|
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
|
|
|
"GtkWindow::title", "testrgb",
|
|
|
|
"GtkWindow::allow_shrink", TRUE,
|
|
|
|
NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
|
|
|
(GtkSignalFunc) quit_func, NULL);
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
drawing_area = gtk_drawing_area_new ();
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
|
1999-07-15 04:58:39 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
|
|
|
|
GTK_SIGNAL_FUNC(expose_func), NULL);
|
|
|
|
gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
|
|
|
|
GTK_SIGNAL_FUNC (config_func), NULL);
|
1999-07-16 20:35:21 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
|
1999-07-15 04:58:39 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_widget_show (drawing_area);
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
button = gtk_button_new_with_label ("Quit");
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
|
|
|
(GtkSignalFunc) gtk_widget_destroy,
|
|
|
|
GTK_OBJECT (window));
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_widget_show (button);
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
1999-07-08 16:04:16 +00:00
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
gtk_widget_show (window);
|
1999-10-27 19:42:34 +00:00
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
update_timeout(gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget** window_loc = data;
|
|
|
|
|
|
|
|
if (*window_loc != NULL) {
|
|
|
|
gtk_widget_queue_draw(*window_loc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
progressive_prepared_callback(GdkPixbufLoader* loader, gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget** retloc = data;
|
|
|
|
GdkPixbuf* pixbuf;
|
|
|
|
|
|
|
|
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
|
|
|
|
g_assert(pixbuf != NULL);
|
|
|
|
|
|
|
|
gdk_pixbuf_ref(pixbuf); /* for the RGB window */
|
|
|
|
*retloc = new_testrgb_window(pixbuf);
|
|
|
|
|
|
|
|
return;
|
1999-07-08 16:04:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
1999-10-18 19:29:45 +00:00
|
|
|
int i;
|
|
|
|
int found_valid = FALSE;
|
|
|
|
|
|
|
|
GdkPixbuf *pixbuf;
|
1999-10-27 18:55:00 +00:00
|
|
|
GdkPixbufLoader *pixbuf_loader;
|
1999-10-26 20:43:39 +00:00
|
|
|
FILE *file;
|
|
|
|
gint val;
|
|
|
|
guchar buf;
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
gdk_rgb_set_verbose (TRUE);
|
|
|
|
|
|
|
|
gdk_rgb_init ();
|
|
|
|
|
|
|
|
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
|
|
|
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
if (argc == 1) {
|
1999-10-22 23:26:22 +00:00
|
|
|
const gchar*** xpmp;
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_data ((guchar *) default_image, ART_PIX_RGB, FALSE,
|
|
|
|
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
|
|
|
|
NULL, NULL);
|
|
|
|
new_testrgb_window (pixbuf);
|
1999-10-22 23:26:22 +00:00
|
|
|
|
|
|
|
xpmp = xpms;
|
|
|
|
while (*xpmp) {
|
|
|
|
pixbuf = gdk_pixbuf_new_from_xpm_data (*xpmp);
|
|
|
|
new_testrgb_window (pixbuf);
|
|
|
|
++xpmp;
|
|
|
|
}
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
found_valid = TRUE;
|
1999-10-18 19:29:45 +00:00
|
|
|
} else {
|
|
|
|
for (i = 1; i < argc; i++) {
|
1999-10-20 21:20:49 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_file (argv[i]);
|
|
|
|
#if 0
|
1999-10-18 19:29:45 +00:00
|
|
|
pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
|
1999-10-20 21:20:49 +00:00
|
|
|
#endif
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
if (pixbuf) {
|
|
|
|
new_testrgb_window (pixbuf);
|
|
|
|
found_valid = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-27 19:42:34 +00:00
|
|
|
{
|
|
|
|
GtkWidget* rgb_window = NULL;
|
|
|
|
guint timeout;
|
|
|
|
|
|
|
|
pixbuf_loader = gdk_pixbuf_loader_new ();
|
|
|
|
|
|
|
|
gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
|
|
|
|
"area_prepared",
|
|
|
|
GTK_SIGNAL_FUNC(progressive_prepared_callback),
|
|
|
|
&rgb_window);
|
|
|
|
|
|
|
|
timeout = gtk_timeout_add(1000, update_timeout, &rgb_window);
|
|
|
|
|
|
|
|
file = fopen (argv[1], "r");
|
|
|
|
g_assert (file != NULL);
|
|
|
|
|
|
|
|
while (TRUE) {
|
|
|
|
val = fgetc (file);
|
|
|
|
if (val == EOF)
|
|
|
|
break;
|
|
|
|
buf = (guint) val;
|
|
|
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
printf(".");
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
while (gtk_events_pending())
|
|
|
|
gtk_main_iteration();
|
|
|
|
|
|
|
|
}
|
|
|
|
gtk_timeout_remove(timeout);
|
|
|
|
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (pixbuf_loader));
|
|
|
|
gtk_object_destroy (GTK_OBJECT(pixbuf_loader));
|
|
|
|
fclose (file);
|
|
|
|
|
|
|
|
if (rgb_window != NULL)
|
|
|
|
gtk_widget_queue_draw(rgb_window);
|
|
|
|
}
|
1999-10-27 16:41:44 +00:00
|
|
|
|
1999-10-26 20:43:39 +00:00
|
|
|
}
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
if (found_valid)
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
1999-07-08 16:04:16 +00:00
|
|
|
}
|