forked from AuroraMiddleware/gtk
Porting MS Windows theme engine to cairo - Part 1: stippling
This commit is contained in:
parent
6e4765b1e9
commit
eea413fe9d
@ -82,81 +82,137 @@ typedef enum
|
|||||||
|
|
||||||
#define PART_SIZE 13
|
#define PART_SIZE 13
|
||||||
|
|
||||||
static const gchar check_aa_bits[] = {
|
static const unsigned char check_aa_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_base_bits[] = {
|
static const unsigned char check_base_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xfc, 0x07, 0xfc,
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
0x07, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_black_bits[] = {
|
static const unsigned char check_black_bits[] = {
|
||||||
0x00, 0x00, 0xfe, 0x0f, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00,
|
||||||
0x02, 0x00, 0x02,
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_dark_bits[] = {
|
static const unsigned char check_dark_bits[] = {
|
||||||
0xff, 0x1f, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
|
0xff, 0x1f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x01,
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_light_bits[] = {
|
static const unsigned char check_light_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
0x00, 0x10, 0x00,
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0xfe, 0x1f
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0xfe, 0x1f, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_mid_bits[] = {
|
static const unsigned char check_mid_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x08, 0x00,
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xfc, 0x0f, 0x00, 0x00
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_text_bits[] = {
|
static const unsigned char check_text_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x88, 0x03,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xd8, 0x01, 0xf8,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
|
||||||
0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x03, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00,
|
||||||
|
0xd8, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
|
||||||
|
0x70, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar check_inconsistent_bits[] = {
|
static const unsigned char check_inconsistent_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xf0, 0x03, 0xf0,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xf0, 0x03, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_base_bits[] = {
|
static const unsigned char radio_base_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xfc, 0x07, 0xfc,
|
0xf0, 0x01, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00,
|
||||||
0x07, 0xfc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||||
|
0xfc, 0x07, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00,
|
||||||
|
0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_black_bits[] = {
|
static const unsigned char radio_black_bits[] = {
|
||||||
0x00, 0x00, 0xf0, 0x01, 0x0c, 0x02, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
|
||||||
0x02, 0x00, 0x02,
|
0x0c, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_dark_bits[] = {
|
static const unsigned char radio_dark_bits[] = {
|
||||||
0xf0, 0x01, 0x0c, 0x06, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00,
|
0xf0, 0x01, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x01,
|
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_light_bits[] = {
|
static const unsigned char radio_light_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x10, 0x00,
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
0x10, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x0c, 0x06, 0xf0, 0x01
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||||
|
0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00,
|
||||||
|
0xf0, 0x01, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_mid_bits[] = {
|
static const unsigned char radio_mid_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x08, 0x00,
|
0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
|
||||||
0x08, 0x00, 0x08, 0x00, 0x04, 0x0c, 0x06, 0xf0, 0x01, 0x00, 0x00
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||||
|
0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
static const gchar radio_text_bits[] = {
|
static const unsigned char radio_text_bits[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xf0, 0x01,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xf0, 0x01, 0xf0,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0xe0, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
|
||||||
|
0xf0, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
|
||||||
|
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const gchar *bits;
|
const unsigned char *bits;
|
||||||
GdkBitmap *bmap;
|
cairo_surface_t *bmap;
|
||||||
} parts[] = {
|
} parts[] = {
|
||||||
{ check_aa_bits, NULL },
|
{ check_aa_bits, NULL },
|
||||||
{ check_base_bits, NULL },
|
{ check_base_bits, NULL },
|
||||||
@ -871,28 +927,27 @@ combo_box_draw_arrow (GtkStyle *style,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
draw_part (GdkDrawable *drawable,
|
draw_part (GdkDrawable *drawable,
|
||||||
GdkGC *gc, GdkRectangle *area, gint x, gint y, Part part)
|
GdkColor *gc, GdkRectangle *area, gint x, gint y, Part part)
|
||||||
{
|
{
|
||||||
|
cairo_t *cr = gdk_cairo_create (drawable);
|
||||||
|
|
||||||
if (area)
|
if (area)
|
||||||
gdk_gc_set_clip_rectangle (gc, area);
|
{
|
||||||
|
gdk_cairo_rectangle (cr, area);
|
||||||
|
cairo_clip (cr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!parts[part].bmap)
|
if (!parts[part].bmap)
|
||||||
{
|
{
|
||||||
parts[part].bmap = gdk_bitmap_create_from_data (drawable,
|
parts[part].bmap = cairo_image_surface_create_for_data ((unsigned char *)parts[part].bits,
|
||||||
parts[part].bits,
|
CAIRO_FORMAT_A1,
|
||||||
PART_SIZE, PART_SIZE);
|
PART_SIZE, PART_SIZE, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_set_ts_origin (gc, x, y);
|
gdk_cairo_set_source_color (cr, gc);
|
||||||
gdk_gc_set_stipple (gc, parts[part].bmap);
|
cairo_mask_surface (cr, parts[part].bmap, x, y);
|
||||||
gdk_gc_set_fill (gc, GDK_STIPPLED);
|
|
||||||
|
|
||||||
gdk_draw_rectangle (drawable, gc, TRUE, x, y, PART_SIZE, PART_SIZE);
|
cairo_destroy(cr);
|
||||||
|
|
||||||
gdk_gc_set_fill (gc, GDK_SOLID);
|
|
||||||
|
|
||||||
if (area)
|
|
||||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user