[cairo-commit] papers/gtkcairo_guadec04/presentation Makefile, NONE, 1.1 cairo_logo.svg, NONE, 1.1 gcp.c, NONE, 1.1 gnome2-fancy.svg, NONE, 1.1 hello_world.c, NONE, 1.1 png_io.c, NONE, 1.1 png_io.h, NONE, 1.1 romedalen.png, NONE, 1.1 slides.c, NONE, 1.1

OEyvind Kolaas commit at pdx.freedesktop.org
Wed Jun 30 05:59:23 PDT 2004


Committed by: pippin

Update of /cvs/cairo/papers/gtkcairo_guadec04/presentation
In directory pdx:/tmp/cvs-serv26241/gtkcairo_guadec04/presentation

Added Files:
	Makefile cairo_logo.svg gcp.c gnome2-fancy.svg hello_world.c 
	png_io.c png_io.h romedalen.png slides.c 
Log Message:
added pdf version of paper,. and source code to presentation tool used at guadec04 for gtkcairo talk


--- NEW FILE: Makefile ---
CFLAGS  = -O2

CFLAGS  += `pkg-config gtkcairo --cflags`
LDFLAGS += `pkg-config gtkcairo --libs`


CFLAGS  += `pkg-config libsvg-cairo --cflags`
LDFLAGS += `pkg-config libsvg-cairo --libs`

CC = gcc

all: gcp

gcp: gcp.o slides.o png_io.o

test: gcp
	./gcp

clean:
	rm -f *.o gcp *~

--- NEW FILE: cairo_logo.svg ---
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="310" height="410" >
	<defs id="cairo-artwork_defs">
		<g id="hacker_emblem">
			<!-- Note: This is similar though not identical to Keith Packard's SVG version
				of the hacker emblem (http://www.catb.org/hacker-emblem/glider.svg) -->
			<g id="hacker_emblem_grid" fill="white" stroke="none">
				<!-- Outside: Top, Right, Bottom, Left -->
				<rect x="-2.95" y="-3.05" width="6"   height="0.1" />
				<rect x="2.95"  y="-2.95" width="0.1" height="6" />
				<rect x="-3.05" y="2.95"  width="6"   height="0.1" />
				<rect x="-3.05" y="-3.05" width="0.1" height="6" />
				<!-- Vertical: Left, Right -->
				<rect x="-1.05" y="-2.95" width="0.1" height="5.9" />
				<rect x="0.95"  y="-2.95" width="0.1" height="5.9" />
				<!-- Horizontal: TopLeft, TopMiddle, TopRight -->
				<rect x="-2.95" y="-1.05" width="1.9" height="0.1" />
				<rect x="-0.95" y="-1.05" width="1.9" height="0.1" />
				<rect x="1.05"  y="-1.05" width="1.9" height="0.1" />
				<!-- Horizontal: BottomLeft, BottomMiddle, BottomRight -->
				<rect x="-2.95" y="0.95"  width="1.9" height="0.1" />
				<rect x="-0.95" y="0.95"  width="1.9" height="0.1" />
				<rect x="1.05"  y="0.95"  width="1.9" height="0.1" />
			</g>
			<g id="hacker_emblem_dots" fill="white">
				<circle cx="0"  cy="-2" r="0.7" />
				<circle cx="2"  cy="0"  r="0.7" />
				<circle cx="-2" cy="2"  r="0.7" />
				<circle cx="0"  cy="2"  r="0.7" />
				<circle cx="2"  cy="2"  r="0.7" />
			</g>
		</g>
		<g id="scarab" fill="#3B80AE">
			<g transform="translate(-150, -170)">
			<path id="scarab_head" d="M205.599,94.567c0-11.668-24.914-21.129-55.628-21.129
				c-30.723,0-55.624,9.46-55.624,21.129c0,10.203,24.901,7.346,55.624,7.346C180.685,101.913,205.599,104.233,205.599,94.567z"/>
			<path id="scarab_torso" d="M136.423,161.506c0,0,12.751,12.577,13.547,13.362
				c2.262-2.232,13.545-13.362,13.545-13.362c7.135-7.036,87.111-6.399,91.066-6.363c-0.469-6.298-1.254-12.472-2.325-18.519
				c-15.183-19.279-42.811-32.225-74.485-32.225h-55.518c-31.745,0-59.439,13.011-74.598,32.37c-1.054,6-1.829,12.128-2.296,18.374
				C49.321,155.106,129.288,154.47,136.423,161.506z"/>
			<path id="scarab_spine" d="M149.97,301.187c2.005-24.729,8.386-103.483,8.405-103.721
				c-0.09-0.219-6.478-15.578-8.405-20.214c-1.936,4.655-8.316,19.995-8.408,20.214C141.582,197.704,147.965,276.458,149.97,301.187z"/>
			<path id="scarab_wing_left" d="M140.403,197.149l8.862-21.31l-13.686-13.499
				c-5.65-5.573-67.074-6.235-90.259-6.019l-0.006-0.622c-0.154,2.144-0.271,4.302-0.35,6.475
				c-0.076,2.207,10.392,4.706,10.392,6.717c0,2.319-10.457,5.084-10.359,7.631c2.993,73.349,48.53,131.631,104.372,132.048
				l-9.02-111.29L140.403,197.149z"/>
			<path id="scarab_wing_right" d="M244.585,168.891c0-2.011,10.467-4.506,10.391-6.715
				c-0.079-2.174-0.195-4.332-0.351-6.479l-0.004,0.624c-23.186-0.216-84.608,0.445-90.26,6.017l-13.688,13.502l8.915,21.438
				l-9.017,111.29c55.854-0.417,101.378-58.698,104.373-132.049C255.04,173.976,244.585,171.209,244.585,168.891z"/>
			<path id="scarab_leg_front_left" d="M44.506,141.12c-4.135-0.856-4.895-1.54-7.935-2.92
				c-9.59-3.364-10.376-5.481-16.08-11.86c-7.426-8.306-12.661-20.142-17.1-29.463c-3.576-7.525-3.984-16.409-2.86-24.273
				c0.991-6.935,7.144-12.869,12.074-18.92c5.844-7.191,10.356-14.822,17.924-21.354c7.736-6.682,23.203-9.809,26.168-19.648
				C57.86,8.819,54.334,1.766,61.482,0c-0.366,4.703,3.639,8.477,2.397,13.575c-1.129,4.627-4.368,5.811-9.611,9.099
				c-7.564,4.746-18.366,8.779-24.748,13.965c-7.175,5.827-4.369,13.771-10.569,20.057c-2.001,2.03-7.901,4.706-9.137,6.83
				c-1.861,3.199-0.297,9.572-0.116,13.12c0.425,8.284,5.588,14.244,9.555,22.045c4.152,8.141,6.429,15.409,13.411,22.519
				c4.183,4.262,11.429,4.802,16.21,10.647l-3.555,4.186L44.506,141.12z"/>
			<path id="scarab_leg_middle_left" d="M43.94,191.922l-0.809-7.346
				c-9.506-4.579-10.339-9.772-20.738-12.466c-23.728-6.151-21.361,11.25-15.532,26.373c5.676,14.726,8.237,30.23,14.345,44.795
				c2.805,6.688,6.919,13.213,14.298,15.127c0.372-8.435-0.917-10.651-6.113-16.919c-4.395-5.293-3.326-12.548-6.072-18.504
				c-3.581-7.804-4.196-15.646-7.279-23.502c-1.363-3.479-8.33-13.966-6.452-17.861c3.183-6.603,9.178-0.083,12.179,2.077
				c4.218,3.036,6.467,2.223,11.681,2.898C34.041,186.673,37.005,188.756,43.94,191.922z"/>
			<path id="scarab_leg_back_left" d="M65.839,257.063l-2.771-4.837
				c-6.68,8.928-6.993,16.228-10.056,23.347c-5.277,12.263-0.157,28.851,9.854,37.676c6.052,5.375,15.907,9.618,23.122,13.136
				c10.035,4.892,20.113,11.286,31.336,13.396c2.482,0.466,8.798,1.295,6.693-3.522c-0.975-2.237-8.091-4.591-10.146-5.734
				c-8.312-4.623-16.377-10.524-24.142-16.176c-9.498-6.862-20.843-11.186-28.311-20.684c-3.054-3.885-3.544-4.922-2.816-9.39
				c0.693-4.263,1.344-9.174,2.241-13.439C61.855,266.029,63.274,261.378,65.839,257.063z"/>
			<path id="scarab_leg_front_right" d="M255.487,141.12c4.134-0.856,4.896-1.54,7.936-2.92
				c9.583-3.364,10.369-5.481,16.071-11.86c7.428-8.306,12.661-20.142,17.115-29.463c3.574-7.525,3.983-16.409,2.86-24.273
				c-0.992-6.935-7.157-12.869-12.087-18.92c-5.843-7.191-10.356-14.822-17.919-21.354c-7.735-6.682-23.202-9.809-26.167-19.648
				C242.135,8.819,245.66,1.766,238.511,0c0.366,4.703-3.637,8.477-2.396,13.575c1.131,4.627,4.368,5.811,9.611,9.099
				c7.563,4.746,18.367,8.779,24.747,13.965c7.17,5.827,4.362,13.771,10.563,20.057c2.001,2.03,7.901,4.706,9.139,6.83
				c1.859,3.199,0.295,9.572,0.113,13.12c-0.424,8.284-5.588,14.244-9.553,22.045c-4.152,8.141-6.431,15.409-13.404,22.519
				c-4.184,4.262-11.429,4.802-16.211,10.647l3.556,4.186L255.487,141.12z"/>
			<path id="scarab_leg_middle_right" d="M256.053,191.922l0.81-7.346
				c9.507-4.579,10.34-9.772,20.73-12.466c23.741-6.151,21.374,11.25,15.534,26.373c-5.676,14.726-8.238,30.23-14.347,44.795
				c-2.804,6.688-6.911,13.213-14.291,15.127c-0.371-8.435,0.918-10.651,6.113-16.919c4.39-5.293,3.319-12.548,6.066-18.504
				c3.58-7.804,4.197-15.646,7.278-23.502c1.363-3.479,8.33-13.966,6.453-17.861c-3.184-6.603-9.179-0.083-12.181,2.077
				c-4.217,3.036-6.458,2.223-11.672,2.898C265.951,186.673,262.986,188.756,256.053,191.922z"/>
			<path id="scarab_leg_back_right" d="M234.155,257.063l2.771-4.837
				c6.679,8.928,6.991,16.228,10.057,23.347c5.274,12.263,0.154,28.851-9.854,37.676c-6.055,5.375-15.903,9.618-23.117,13.136
				c-10.034,4.892-20.127,11.286-31.351,13.396c-2.481,0.466-8.789,1.295-6.691-3.522c0.976-2.237,8.092-4.591,10.146-5.734
				c8.312-4.623,16.392-10.524,24.155-16.176c9.498-6.862,20.838-11.186,28.305-20.684c3.055-3.885,3.543-4.922,2.818-9.39
				c-0.696-4.263-1.346-9.174-2.244-13.439C238.137,266.029,236.718,261.378,234.155,257.063z"/>
			</g>
		</g>
		<radialGradient id="gradient_radial_dung"
				cx="0" cy="0" r="60"
				fx="0" fy="0" gradientUnits="userSpaceOnUse"
		>
			<stop offset="0"    stop-color="#9a9a9a" />
			<stop offset="0.70" stop-color="#bababa" />
			<stop offset="0.95" stop-color="#FFFFFF" />
		</radialGradient>
		<g id="dung">
			<circle cx="0" cy="0" r="60" fill="url(#gradient_radial_dung)" />
			<g transform="translate(-61, -61)">
				<!-- rough equivalent: <circle cx="0" cy="0" r="60" stroke="#8a8a8a" stroke-width="2" /> -->
				<path fill="#8a8a8a" d="M0,61c0,33.636,27.364,61,61,61s61-27.364,61-61S94.636,0,61,0S0,27.364,0,61z
							M2,61C2,28.467,28.467,2,61,2c32.532,0,59,26.467,59,59c0,32.533-26.468,59-59,59C28.467,120,2,93.533,2,61z"/>
			</g>
			<use xlink:href="#hacker_emblem" x="0" y="0" transform="scale(9)" />
		</g>

		<!-- scarab dimensions: 300x340 -->
		<!-- dung dimensions: 120x120 (radius: 60) -->
		<!-- scarab and dung dimensions: 300x400 -->

		<g id="cairo_logo">
			<!-- dimensions: 300x400, centered -->
			<!-- The logo (scarab and dung), with the center-point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(0, -140)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(0, 30)" />
		</g>
		<g id="cairo_logo_dung-centered">
			<!-- The logo (scarab and dung), with the dung at (0,0), the scarab below -->
			<use xlink:href="#dung" x="0" y="0" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(0,170)" />
		</g>
		<g id="cairo_logo_scarab-centered">
			<!-- The logo (scarab and dung), with the scarab's rotational center at (0,0), the dung above -->
			<!-- The scarab's rotational center in this case is not the center of its bounding box,
				but is calculated to be the intersection-point of the torso, spine and wings -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(0, -175.85)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(0, -5.85)" />
		</g>
		<g id="cairo_logo_top-centered">
			<!-- The logo (scarab and dung), with the top-center point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(0, 60)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(0, 230)" /><!-- (0,170+60) -->
		</g>
		<g id="cairo_logo_bottom-centered">
			<!-- The logo (scarab and dung), with the bottom-center point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(0, -340)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(0, -170)" />
		</g>
		<g id="cairo_logo_right-centered">
			<!-- The logo (scarab and dung), with the right-center point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(-150, -140)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(-150, 30)" />
		</g>
		<g id="cairo_logo_left-centered">
			<!-- The logo (scarab and dung), with the left-center point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(150, -140)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(150, 30)" />
		</g>
		<g id="cairo_logo_topleft-centered">
			<!-- The logo (scarab and dung), with the top-left point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(150, 60)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(150, 230)" /><!-- (150, 170+60) -->
		</g>
		<g id="cairo_logo_topright-centered">
			<!-- The logo (scarab and dung), with the top-right point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(-150, 60)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(-150, 230)" /><!-- (-150,170+60) -->
		</g>
		<g id="cairo_logo_bottomleft-centered">
			<!-- The logo (scarab and dung), with the bottom-left point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(150, -340)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(150, -170)" />
		</g>
		<g id="cairo_logo_bottomright-centered">
			<!-- The logo (scarab and dung), with the bottom-right point of the bounding box at (0,0) -->
			<use xlink:href="#dung" x="0" y="0" transform="translate(-150, -340)" />
			<use xlink:href="#scarab" x="0" y="0" transform="translate(-150, -170)" />
		</g>

		<g id="cairo_text" fill="black">
			<!-- text: 'cairo' -->
			<!-- dimensions: 300x100, bottom-centered on cairo_text_i -->
			<!-- rough equivalent: <text text-anchor="middle" x="0" y="0" font-size="128">cairo</text> -->
			<g transform="translate(-152.5, -100)">
				<path id="cairo_text_c" d="M36.191,100.671c10.136,0,19.184-3.958,25.32-11.222l-8.081-8.081
					c-3.299,5.915-8.8,10.083-16.82,10.083c-14.528,0-20.255-14.387-20.255-25.842c0-15.366,8.801-26.401,20.535-26.401h0.14
					c6.982,0,12.753,3.867,16.326,10.061l8.355-8.355c-5.899-6.992-14.574-10.926-24.402-10.926h-0.14
					c-16.064,0-33.525,10.895-33.525,36.041C3.644,86.562,16.775,100.671,36.191,100.671z"/>
				<path id="cairo_text_a" d="M129.432,82.688c0,5.839,0,5.839,0,17.983h-10.011V90.334c-3.616,5.284-12.515,10.012-22.109,10.012
					c-13.626,0-20.579-9.594-20.579-19.327c0-16.269,14.461-25.167,40.463-25.029v-1.391c0-5.561-1.531-15.712-15.296-15.573
					c-6.396,0-12.931,1.807-17.659,5.006l-2.779-8.205c5.561-3.476,13.765-5.839,22.247-5.839c20.718,0,25.723,14.044,25.723,27.531
					V82.688z M117.475,64.471c-13.348-0.277-28.505,2.085-28.505,15.156c0,8.065,5.284,11.681,11.402,11.681
					c8.899,0,14.6-5.563,16.547-11.263c0.417-1.25,0.556-2.642,0.556-3.893V64.471z"/>
				<path id="cairo_text_i" d="M153.062,16.99c-4.819,0-8.033-3.797-8.033-8.324s3.359-8.178,8.324-8.178
					c4.966,0,8.179,3.65,8.179,8.178s-3.213,8.324-8.324,8.324H153.062z M146.927,100.67V29.988h12.853v70.683H146.927z"/>
				<path id="cairo_text_r" d="M180.375,53.676c0-7.807-0.137-14.518-0.046-23.688h10.547l0.045,16.019h0.412
					c3.012-8.902,15.479-16.019,23.559-16.019c1.232,0,2.189,0.137,3.285,0.411v11.23c-1.368-0.137-2.602-0.274-4.244-0.274
					c-8.492,0-19.588,7.939-21.231,16.841c-0.272,1.78-0.41,3.698-0.41,5.752v36.723h-12.052L180.375,53.676z"/>
				<path id="cairo_text_o" d="M261.708,100.67c-18.158,0-32.408-13.41-32.408-34.783c0-22.629,14.946-35.899,33.526-35.899
					c19.416,0,32.546,14.108,32.546,34.643c0,25.143-17.461,36.04-33.524,36.04H261.708z M262.127,91.451
					c11.734,0,20.535-11.035,20.535-26.401c0-11.455-5.729-25.842-20.256-25.842c-14.388,0-20.673,13.41-20.673,26.261
					c0,14.806,8.381,25.982,20.253,25.982H262.127z"/>
			</g>
		</g>

		<g id="cairo_logo_with_text">
			<!-- The logo (scarab and dung), with the text 'cairo' below, the dot of the 'i' positioned between the hind legs of the scarab -->
			<!-- dimensions: 300x490, centered -->
			<use xlink:href="#cairo_logo_top-centered" transform="translate(0, -245)" />
			<use xlink:href="#cairo_text" transform="translate(0, 245)" />
		</g>

		<g id="cairo_banner">
			<!-- The logo on the left, the text 'cairo' in the center, and a mirror image of the logo on the right -->
			<!-- The logos are scaled such that the scarab body nearly matches the height of the text characters (excepting the 'i')
				and the dung should nearly aligns with the dot of the 'i'. The bottoms of the logos are aligned with the bottom of the text. -->
			<!-- dimensions: 500x110, centered -->
			<use xlink:href="#cairo_logo_bottomleft-centered" transform="translate(-250, 55), scale(0.27)" />
			<use xlink:href="#cairo_text" transform="translate(0, 55)" />
			<use xlink:href="#cairo_logo_bottomleft-centered" transform="translate(250, 55), scale(0.27), scale(-1, 1)" />
		</g>
	</defs>
	<g transform="translate(5, 5)">
		<use xlink:href="#cairo_logo_topleft-centered" />
	</g>
</svg>

--- NEW FILE: gcp.c ---
#include <gtkcairo.h>
#include <gtk/gtk.h>
#include <stdio.h>

int width  = 400;
int height = 300;

typedef struct slide_t {
    char *title;
    void (*render) (cairo_t *cr);
} slide_t;

extern slide_t slides[];

gint slide_no=0;

static void
paint (GtkWidget *widget,
       cairo_t   *cr,
       gint      *slide_no)
{
    gint width, height;

    width  = widget->allocation.width;
    height = widget->allocation.height;

    cairo_save (cr);
        cairo_scale (cr, height/1.0, height/1.0);
        cairo_translate (cr, 0.15, 0.0);
        slides[*slide_no].render (cr);
    cairo_restore (cr);
}

static void
event_press (GtkWidget      *widget,
             GdkEventButton *bev,
             gpointer        user_data)
{
    switch (bev->button) {
        case 1:
            slide_no--;
            break;
        case 3:
            slide_no++;
            break;
    }
    if (slide_no<0)
        slide_no=0;
    if (!slides[slide_no].title)
        slide_no--;
    gtk_widget_queue_draw (widget);
    return;
}

int
main (int argc, char **argv)
{
    GtkWidget *window;
    GtkWidget *gtkcairo;

    gtk_init (&argc, &argv);

    if (argc>1)
        slide_no = atoi (argv[1]);

    window   = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtkcairo = gtk_cairo_new ();

    gtk_container_add (GTK_CONTAINER (window), gtkcairo);

    gtk_window_set_title (GTK_WINDOW (window),
    "GUADEC 2004-06-29 - gtkcairo - Øyvind Kolås <pippin at freedesktop.org - http://cairographics.org/");
    
    gtk_widget_set_size_request (gtkcairo, width, height);
    gtk_widget_add_events (gtkcairo, GDK_BUTTON_PRESS_MASK);

    g_signal_connect (G_OBJECT (gtkcairo), "paint",
            G_CALLBACK (paint), &slide_no);
    g_signal_connect (G_OBJECT (gtkcairo), "button_press_event",
            G_CALLBACK (event_press), NULL);
    g_signal_connect (G_OBJECT (window), "delete-event",
            G_CALLBACK (gtk_main_quit), NULL);

    gtk_widget_show_all (window);
    gtk_main ();
    return 0;
}


--- NEW FILE: gnome2-fancy.svg ---
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"   "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd" [
	<!ENTITY st0 "fill:url(#aigrd2);">
	<!ENTITY st1 "opacity:0.48;">
	<!ENTITY st2 "opacity:0.64;">
	<!ENTITY st3 "opacity:0.48;fill:url(#aigrd3);">
	<!ENTITY st4 "fill:url(#aigrd1);stroke:#000000;stroke-width:8.4729;">
	<!ENTITY st5 "fill-rule:nonzero;clip-rule:nonzero;fill:#FFFFFF;stroke:#000000;stroke-miterlimit:4;">
	<!ENTITY st6 "fill:#000000;">
	<!ENTITY st7 "stroke:none;">
]>
<svg  width="226pt" height="225pt" viewBox="0 0 226 225" xml:space="preserve">
	<g id="Layer_x0020_1" style="&st5;">
		<g style="&st7;">
			<g style="&st1;">
				<image width="226" height="225" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADTCAYAAADESVzGAAAABGdBTUEAAK/INwWK6QAAABl0RVh0
U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAePSURBVHjaYmAYBaNgFOAEAAE0ikbBKMAD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wCPAAggEbRKBgFeABA
AI2iUTAK8ACAABpFo2AU4AEAATSKRsEowAMAAmgUjYJRgAcABNAoGgWjAA8ACKBRNApGAR4AEECj
aBSMAjwAIIBG0SgYBXgAQACNolEwCvAAgAAaRaNgFOABAAE0ikbBKMADAAJoFI2CUYAHAATQKBoF
owAPAAigUTQKRgEeABBAo2gUjAI8ACCARtEoGAV4AEAAjaJRMArwAIAAGkWjYBTgAQABNIpGwSjA
AwACaBSNglGABwAE0CgaBaMADwAIoFE0CkYBHgAQQKNoFIwCPAAggEbRKBgFeABAAI2iUTAK8ACA
ABpFo2AU4AEAATSKRsEowAMAAmgUjYJRgAcABBgAlFEAAfuYg1cAAAAASUVORK5CYII="/>
			</g>
			<radialGradient id="aigrd1" cx="81.0659" cy="78.3418" r="137.5831" fx="81.0659" fy="78.3418" gradientUnits="userSpaceOnUse">
				<stop  offset="0" style="stop-color:#E1E1DE"/>
				<stop  offset="1" style="stop-color:#293133"/>
			</radialGradient>
			<path style="&st4;" d="M185.822,161.514c0,12.154-9.854,22.01-22.01,22.01H61.178c-12.156,0-22.012-9.855-22.012-22.01V58.878c0-12.157,9.855-22.011,22.012-22.011h102.634c12.156,0,22.01,9.854,22.01,22.011v102.635z"/>
			<linearGradient id="aigrd2" gradientUnits="userSpaceOnUse" x1="90.1099" y1="26.3491" x2="122.0016" y2="97.8025">
				<stop  offset="0" style="stop-color:#FFFFFF"/>
				<stop  offset="0.1359" style="stop-color:#F6F6F6"/>
				<stop  offset="1" style="stop-color:#C4C4C4"/>
			</linearGradient>
			<path style="&st0;" d="M64.042,44.956c-9.256,0-16.785,7.531-16.785,16.787V94.83c38.391,19.848,85.22-47.411,130.476-29.003v-4.084c0-9.256-7.529-16.787-16.785-16.787H64.042z"/>
			<g>
				<g>
					<g>
						<path style="&st2;" d="M143.719,50.78c-19.83,0-23.549,28.245-12.395,28.245s32.227-28.245,12.395-28.245z"/>
						<path style="&st2;" d="M110.792,75.524c5.94,0.363,12.456-22.667,1.292-21.219c-11.161,1.448-7.235,20.855-1.292,21.219z"/>
						<path style="&st2;" d="M83.571,89.834c4.224-1.858,0.543-20.048-6.64-15.087c-7.182,4.96,2.414,16.945,6.64,15.087z"/>
						<path style="&st2;" d="M95.472,80.314c5.03-1.025,5.306-21.653-3.663-17.953c-8.97,3.7-1.362,18.979,3.663,17.953z"/>
						<path id="newshape" style="&st2;" d="M121.732,126.479c0.893,6.813-5,10.178-10.77,5.785c-18.366-13.982,30.413-20.96,27.198-40.065c-2.668-15.857-51.326-10.977-56.867,13.837c-3.751,16.785,15.438,40.066,35.46,40.066c9.85,0,21.211-8.893,23.336-20.16
							c1.623-8.59-19.104-5.148-18.357,0.537z"/>
					</g>
				</g>
				<g style="&st2;">
					<path d="M87.831,157.334l-1.201,2.303c-0.338-0.306-0.86-0.609-1.565-0.912c-0.705-0.302-1.311-0.453-1.818-0.453c-1.587,0-2.839,0.539-3.757,1.617c-0.918,1.078-1.377,2.523-1.377,4.334c0,1.722,0.449,3.098,1.347,4.129c0.898,1.029,2.12,1.545,3.667,1.545
						c1.019,0,1.857-0.278,2.518-0.835v-3.165h-2.25v-2.438h5.125v7.201c-0.683,0.557-1.562,0.99-2.637,1.301s-2.145,0.467-3.208,0.467c-2.312,0-4.145-0.758-5.499-2.274s-2.031-3.519-2.031-6.009c0-2.488,0.738-4.512,2.213-6.068s3.462-2.336,5.958-2.336
						c1.77,0,3.274,0.531,4.516,1.594z"/>
					<path d="M101.671,172.365l-7.844-10.188v9.969h-2.75v-16.125h1.375l7.625,9.719v-9.719h2.75v16.344h-1.156z"/>
					<path d="M105.36,163.952c0-2.297,0.629-4.239,1.888-5.829c1.259-1.588,2.942-2.383,5.049-2.383c2.32,0,4.091,0.719,5.318,2.158c1.226,1.438,1.839,3.456,1.839,6.054s-0.641,4.659-1.921,6.187c-1.281,1.525-3.1,2.289-5.456,2.289
						c-2.166,0-3.827-0.756-4.983-2.268s-1.734-3.58-1.734-6.208z M108.329,163.951c0,1.891,0.319,3.354,0.959,4.391c0.639,1.037,1.569,1.555,2.789,1.555c1.433,0,2.526-0.508,3.279-1.521c0.753-1.016,1.13-2.489,1.13-4.424c0-3.786-1.396-5.68-4.188-5.68
						c-1.278,0-2.259,0.514-2.943,1.539s-1.025,2.406-1.025,4.141z"/>
					<path d="M137.042,172.146h-2.781l-1.656-8.688l-3.25,8.906h-1.031l-3.266-8.906l-1.766,8.688h-2.75l3.25-16.125h1.531l3.516,10.844l3.422-10.844h1.5l3.281,16.125z"/>
					<path d="M141.702,158.553v3.781h5.219v2.438h-5.219v4.844h7.313v2.531h-10.188v-16.125h10.188v2.531h-7.313z"/>
				</g>
			</g>
			<g style="&st6;">
				<g>
					<g>
						<path d="M142.719,49.78c-19.83,0-23.549,28.245-12.395,28.245s32.227-28.245,12.395-28.245z"/>
						<path d="M109.792,74.524c5.94,0.363,12.456-22.667,1.292-21.219c-11.161,1.448-7.235,20.855-1.292,21.219z"/>
						<path d="M82.571,88.834c4.224-1.858,0.543-20.048-6.64-15.087c-7.182,4.96,2.414,16.945,6.64,15.087z"/>
						<path d="M94.472,79.314c5.03-1.025,5.306-21.653-3.663-17.953c-8.97,3.7-1.362,18.979,3.663,17.953z"/>
						<path d="M120.732,125.479c0.893,6.813-5,10.178-10.77,5.785c-18.366-13.982,30.413-20.96,27.198-40.065c-2.668-15.857-51.326-10.977-56.867,13.837c-3.751,16.785,15.438,40.066,35.46,40.066c9.85,0,21.211-8.893,23.336-20.16
							c1.623-8.59-19.104-5.148-18.357,0.537z"/>
					</g>
				</g>
				<g>
					<path d="M86.831,156.334l-1.201,2.303c-0.338-0.306-0.86-0.609-1.565-0.912c-0.705-0.302-1.311-0.453-1.818-0.453c-1.587,0-2.839,0.539-3.757,1.617c-0.918,1.078-1.377,2.523-1.377,4.334c0,1.722,0.449,3.098,1.347,4.129c0.898,1.029,2.12,1.545,3.667,1.545
						c1.019,0,1.857-0.278,2.518-0.835v-3.165h-2.25v-2.438h5.125v7.201c-0.683,0.557-1.562,0.99-2.637,1.301s-2.145,0.467-3.208,0.467c-2.312,0-4.145-0.758-5.499-2.274s-2.031-3.519-2.031-6.009c0-2.488,0.738-4.512,2.213-6.068s3.462-2.336,5.958-2.336
						c1.77,0,3.274,0.531,4.516,1.594z"/>
					<path d="M100.671,171.365l-7.844-10.188v9.969h-2.75v-16.125h1.375l7.625,9.719v-9.719h2.75v16.344h-1.156z"/>
					<path d="M104.36,162.952c0-2.297,0.629-4.239,1.888-5.829c1.259-1.588,2.942-2.383,5.049-2.383c2.319,0,4.091,0.719,5.318,2.158c1.226,1.438,1.839,3.456,1.839,6.054s-0.641,4.659-1.921,6.187c-1.281,1.525-3.1,2.289-5.456,2.289
						c-2.166,0-3.827-0.756-4.983-2.268s-1.734-3.58-1.734-6.208z M107.329,162.951c0,1.891,0.319,3.354,0.959,4.391c0.639,1.037,1.569,1.555,2.789,1.555c1.433,0,2.526-0.508,3.279-1.521c0.753-1.016,1.13-2.489,1.13-4.424c0-3.786-1.396-5.68-4.188-5.68
						c-1.278,0-2.259,0.514-2.943,1.539s-1.025,2.406-1.025,4.141z"/>
					<path d="M136.042,171.146h-2.781l-1.656-8.688l-3.25,8.906h-1.031l-3.266-8.906l-1.766,8.688h-2.75l3.25-16.125h1.531l3.516,10.844l3.422-10.844h1.5l3.281,16.125z"/>
					<path d="M140.702,157.553v3.781h5.219v2.438h-5.219v4.844h7.313v2.531h-10.188v-16.125h10.188v2.531h-7.313z"/>
				</g>
			</g>
			<linearGradient id="aigrd3" gradientUnits="userSpaceOnUse" x1="111.7104" y1="31" x2="112.9217" y2="104.0708">
				<stop  offset="0" style="stop-color:#FFFFFF"/>
				<stop  offset="0.2401" style="stop-color:#EDECEC"/>
				<stop  offset="1" style="stop-color:#BBBBBA"/>
			</linearGradient>
			<path style="&st3;" d="M64.042,44.956c-9.256,0-16.785,7.531-16.785,16.787V94.83c38.391,19.848,85.22-47.411,130.476-29.003v-4.084c0-9.256-7.529-16.787-16.785-16.787H64.042z"/>
		</g>
	</g>
</svg>

--- NEW FILE: hello_world.c ---
#include <gtkcairo.h>
#include <gtk/gtk.h>

static void
redraw (GtkCairo *gtkcairo,
        cairo_t  *cr,
        gpointer  userdata)
{
     cairo_set_rgb_color (cr, 0,0,0);
     cairo_move_to       (cr, 20,90);
     cairo_scale_font    (cr, 70);
     cairo_show_text     (cr, "Hello world");
}

gint
main (gint   argc,
      char **argv)
{
    GtkWidget *window;
    GtkWidget *gtkcairo;

    gtk_init (&argc, &argv);

    window   = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtkcairo = gtk_cairo_new ();

    gtk_container_add (GTK_CONTAINER (window), gtkcairo);

    g_signal_connect (G_OBJECT (gtkcairo), "redraw",
                      G_CALLBACK (redraw), NULL);

    gtk_widget_show_all (window);
    gtk_main ();
}

--- NEW FILE: png_io.c ---
/* png input and output functions, originally coded by Carl Worth, based
 * on the sample code in libpng */

#include <stdio.h>
#include <png.h>
#include <stdlib.h>

#include "png_io.h"

static void
premultiply_data (png_structp   png,
                  png_row_infop row_info,
                  png_bytep     data)
{
    int i;

    for (i = 0; i < row_info->rowbytes; i += 4) {
	unsigned char  *base = &data[i];
	unsigned char  blue = base[0];
	unsigned char  green = base[1];
	unsigned char  red = base[2];
	unsigned char  alpha = base[3];
	unsigned long	p;

	red = (unsigned) red * (unsigned) alpha / 255;
	green = (unsigned) green * (unsigned) alpha / 255;
	blue = (unsigned) blue * (unsigned) alpha / 255;
	p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
	memcpy (base, &p, sizeof (unsigned long));
    }
}

char *
read_png_argb32 (const char *filename,
		         int        *widthp,
                 int        *heightp,
                 int        *stridep)
{
    FILE    *f;
    char    *buffer;
    png_structp png;
    png_infop info;
    png_bytepp rows;
    int i;
    png_uint_32 width, height;
    png_uint_32	stride;
    int depth, color, interlace;
    
    png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (png == NULL)
	return NULL;
    info = png_create_info_struct (png);
    if (info == NULL)
    {
	png_destroy_read_struct (&png, NULL, NULL);
	return NULL;
    }
    if (setjmp (png->jmpbuf))
    {
	png_destroy_read_struct (&png, &info, NULL);
	return NULL;
    }
    f = fopen (filename, "rb");
    if (f == NULL)
    {
	png_destroy_read_struct (&png, &info, NULL);
	return NULL;
    }
    png_init_io (png, f);
    png_read_info (png, info);
    png_get_IHDR (png, info, &width, &height, &depth, &color, &interlace,
		  NULL, NULL);

    if (color == PNG_COLOR_TYPE_PALETTE && depth <= 8)
	png_set_expand (png);

    if (color == PNG_COLOR_TYPE_GRAY && depth < 8)
	png_set_expand (png);

    if (png_get_valid (png, info, PNG_INFO_tRNS))
	png_set_expand (png);

    if (depth == 16)
	png_set_strip_16 (png);

    if (depth < 8)
	png_set_packing (png);

    if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA)
	png_set_gray_to_rgb (png);

    if (interlace != PNG_INTERLACE_NONE)
	png_set_interlace_handling (png);

    png_set_bgr (png);
    png_set_filler (png, 255, PNG_FILLER_AFTER);

    png_set_read_user_transform_fn (png, premultiply_data);

    png_read_update_info (png, info);

    stride = width * 4;
    buffer = malloc (stride * height);
    
    rows = malloc (sizeof (png_bytep) * height);

    for (i = 0; i < height; i++)
	rows[i] = (png_bytep) (buffer + i * stride);
    
    png_read_image (png, rows);
    png_read_end (png, info);

    free (rows);
    fclose (f);
    png_destroy_read_struct (&png, &info, NULL);

    *widthp = (int) width;
    *heightp = (int) height;
    *stridep = (int) stride;
    
    return buffer;
}

		    

--- NEW FILE: png_io.h ---
#ifndef PNG_IO_H
#define PNG_IO_H

char *
read_png_argb32 (const char *filename,
		         int        *width,
                 int        *height,
                 int        *stride);

#endif

--- NEW FILE: romedalen.png ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: slides.c ---
#include <gtkcairo.h>
#include <svg-cairo.h>
#include <stdio.h>
#include <math.h>
#include "png_io.h"

typedef struct slide_t {
    char *title;
    void (*render) (cairo_t *cr);
} slide_t;

#define INDENT_AMOUNT   0.1
#define ITEM_HEIGHT     0.07
#define ITEM_FONTSIZE   0.05
#define BULLET_RADIUS   0.005

double VERBATIM_FONT_SIZE   = 0.035;
double VERBATIM_LINE_HEIGHT = 0.055;

[...1036 lines suppressed...]
    {"text path",         text_path},
    {"image",             image},
    {"svg",               svg},
    {"svg",               svg2},
    {"clip",              clip},
    {"colors from theme", colors_from_theme},
    {"requesting redraw", requesting_redraw},
    {"user interaction",  user_interaction},
    {"demo's",            demos},
    {"questions",         questions},
    {NULL,    NULL}
};

/*
 *  demos:   gtkcairo_slide,   path paint,   bauxite widgets (using webcam)
 *  bauxite sequence editor
 *
 *
 *
 */





More information about the cairo-commit mailing list