#include <config.h>
#include <stdlib.h>
#include <gdk/gdk.h>
#include "cairo-device.h"
Go to the source code of this file.
|
static void | dvi_cairo_draw_glyph (DviContext *dvi, DviFontChar *ch, int x0, int y0) |
|
static void | dvi_cairo_draw_rule (DviContext *dvi, int x, int y, Uint width, Uint height, int fill) |
|
static int | dvi_cairo_alloc_colors (void *device_data, Ulong *pixels, int npixels, Ulong fg, Ulong bg, double gamma, int density) |
|
static void * | dvi_cairo_create_image (void *device_data, Uint width, Uint height, Uint bpp) |
|
static void | dvi_cairo_free_image (void *ptr) |
|
static void | dvi_cairo_put_pixel (void *image, int x, int y, Ulong color) |
|
static void | dvi_cairo_image_done (void *ptr) |
|
static void | dvi_cairo_set_color (void *device_data, Ulong fg, Ulong bg) |
|
void | mdvi_cairo_device_init (DviDevice *device) |
|
void | mdvi_cairo_device_free (DviDevice *device) |
|
cairo_surface_t * | mdvi_cairo_device_get_surface (DviDevice *device) |
|
void | mdvi_cairo_device_render (DviContext *dvi) |
|
void | mdvi_cairo_device_set_margins (DviDevice *device, gint xmargin, gint ymargin) |
|
void | mdvi_cairo_device_set_scale (DviDevice *device, gdouble xscale, gdouble yscale) |
|
static int dvi_cairo_alloc_colors |
( |
void * |
device_data, |
|
|
Ulong * |
pixels, |
|
|
int |
npixels, |
|
|
Ulong |
fg, |
|
|
Ulong |
bg, |
|
|
double |
gamma, |
|
|
int |
density |
|
) |
| |
|
static |
Definition at line 196 of file cairo-device.c.
205 GdkColor color, color_fg;
209 color_fg.red = (fg >> 16) & 0xff;
210 color_fg.green = (fg >> 8) & 0xff;
211 color_fg.blue = (fg >> 0) & 0xff;
214 for (i = 0; i < npixels; i++) {
216 pow ((
double)i / n, 1 / gamma) :
217 1 - pow ((
double)(n - i) / n, -gamma);
219 color.red = frac * color_fg.red;
220 color.green = frac * color_fg.green;
221 color.blue = frac * color_fg.blue;
224 pixels[i] = (alpha << 24) + (color.red << 16) + (color.green << 8) + color.blue;
static void* dvi_cairo_create_image |
( |
void * |
device_data, |
|
|
Uint |
width, |
|
|
Uint |
height, |
|
|
Uint |
bpp |
|
) |
| |
|
static |
Definition at line 231 of file cairo-device.c.
236 return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
Definition at line 44 of file cairo-device.c.
53 cairo_surface_t *surface;
59 isbox = (glyph->
data == NULL ||
63 x = - glyph->
x + x0 + cairo_device->
xmargin;
64 y = - glyph->
y + y0 + cairo_device->
ymargin;
68 surface = cairo_get_target (cairo_device->
cr);
70 || x + w > cairo_image_surface_get_width (surface)
71 || y + h > cairo_image_surface_get_height (surface))
74 cairo_save (cairo_device->
cr);
76 cairo_rectangle (cairo_device->
cr,
80 cairo_stroke (cairo_device->
cr);
82 cairo_translate (cairo_device->
cr, x, y);
83 cairo_set_source_surface (cairo_device->
cr,
84 (cairo_surface_t *) glyph->
data,
86 cairo_paint (cairo_device->
cr);
89 cairo_restore (cairo_device->
cr);
static void dvi_cairo_draw_rule |
( |
DviContext * |
dvi, |
|
|
int |
x, |
|
|
int |
y, |
|
|
Uint |
width, |
|
|
Uint |
height, |
|
|
int |
fill |
|
) |
| |
|
static |
Definition at line 93 of file cairo-device.c.
105 color = cairo_device->
fg;
107 cairo_save (cairo_device->
cr);
108 cairo_scale (cairo_device->
cr, cairo_device->
xscale, cairo_device->
yscale);
110 cairo_set_source_rgb (cairo_device->
cr,
111 ((color >> 16) & 0xff) / 255.,
112 ((color >> 8) & 0xff) / 255.,
113 ((color >> 0) & 0xff) / 255.);
115 cairo_rectangle (cairo_device->
cr,
118 width / cairo_device->
xscale, height / cairo_device->
yscale);
120 cairo_stroke (cairo_device->
cr);
122 cairo_fill (cairo_device->
cr);
125 cairo_restore (cairo_device->
cr);
static void dvi_cairo_free_image |
( |
void * |
ptr) | |
|
|
static |
Definition at line 240 of file cairo-device.c.
242 cairo_surface_destroy ((cairo_surface_t *)ptr);
static void dvi_cairo_image_done |
( |
void * |
ptr) | |
|
|
static |
Definition at line 263 of file cairo-device.c.
265 cairo_surface_mark_dirty((cairo_surface_t *)ptr);
static void dvi_cairo_put_pixel |
( |
void * |
image, |
|
|
int |
x, |
|
|
int |
y, |
|
|
Ulong |
color |
|
) |
| |
|
static |
Definition at line 246 of file cairo-device.c.
248 cairo_surface_t *surface;
252 surface = (cairo_surface_t *) image;
254 rowstride = cairo_image_surface_get_stride (surface);
255 p = (guint32*) (cairo_image_surface_get_data (surface) + y * rowstride + x * 4);
258 cairo_surface_flush(surface);
static void dvi_cairo_set_color |
( |
void * |
device_data, |
|
|
Ulong |
fg, |
|
|
Ulong |
bg |
|
) |
| |
|
static |
void mdvi_cairo_device_free |
( |
DviDevice * |
device) | |
|
Definition at line 300 of file cairo-device.c.
306 if (cairo_device->
cr)
307 cairo_destroy (cairo_device->
cr);
309 g_free (cairo_device);
cairo_surface_t* mdvi_cairo_device_get_surface |
( |
DviDevice * |
device) | |
|
Definition at line 313 of file cairo-device.c.
319 return cairo_surface_reference (cairo_get_target (cairo_device->
cr));
void mdvi_cairo_device_init |
( |
DviDevice * |
device) | |
|
Definition at line 323 of file cairo-device.c.
328 cairo_surface_t *surface;
332 if (cairo_device->
cr)
333 cairo_destroy (cairo_device->
cr);
338 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
339 page_width, page_height);
341 cairo_device->
cr = cairo_create (surface);
342 cairo_surface_destroy (surface);
344 cairo_set_source_rgb (cairo_device->
cr, 1., 1., 1.);
345 cairo_paint (cairo_device->
cr);
void mdvi_cairo_device_set_margins |
( |
DviDevice * |
device, |
|
|
gint |
xmargin, |
|
|
gint |
ymargin |
|
) |
| |
void mdvi_cairo_device_set_scale |
( |
DviDevice * |
device, |
|
|
gdouble |
xscale, |
|
|
gdouble |
yscale |
|
) |
| |