mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 00:38:06 +02:00
Move surface-specific cairo_t functions to cairo.c.
Remove functions that have now moved to cairo.c. A few new files to ignore now with new compilation mode using a libtool helper library.
This commit is contained in:
parent
12de3807b4
commit
9bb1715159
16 changed files with 288 additions and 465 deletions
20
ChangeLog
20
ChangeLog
|
|
@ -1,3 +1,23 @@
|
|||
2005-03-23 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo.c: (cairo_set_target_glitz), (cairo_set_target_pdf),
|
||||
(cairo_set_target_pdf_as_file), (cairo_set_target_png),
|
||||
(cairo_set_target_ps), (cairo_set_target_win32),
|
||||
(cairo_set_target_xcb), (cairo_set_target_drawable): Move
|
||||
surface-specific cairo_t functions to cairo.c.
|
||||
|
||||
* src/cairo_glitz_surface.c:
|
||||
* src/cairo_pdf_surface.c:
|
||||
* src/cairo_png_surface.c:
|
||||
* src/cairo_ps_surface.c:
|
||||
* src/cairo_win32_surface.c:
|
||||
* src/cairo_xcb_surface.c:
|
||||
* src/cairo_xlib_surface.c: Remove functions that have now moved
|
||||
to cairo.c.
|
||||
|
||||
* test/.cvsignore: A few new files to ignore now with new
|
||||
compilation mode using a libtool helper library.
|
||||
|
||||
2005-03-23 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo.h: Add backwards-compatibility for recently renamed
|
||||
|
|
|
|||
|
|
@ -27,25 +27,6 @@
|
|||
#include "cairoint.h"
|
||||
#include "cairo-glitz.h"
|
||||
|
||||
void
|
||||
cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
|
||||
{
|
||||
cairo_surface_t *crsurface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
crsurface = cairo_glitz_surface_create (surface);
|
||||
if (crsurface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, crsurface);
|
||||
|
||||
cairo_surface_destroy (crsurface);
|
||||
}
|
||||
|
||||
typedef struct _cairo_glitz_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -2276,78 +2276,3 @@ _cairo_pdf_document_add_page (cairo_pdf_document_t *document,
|
|||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_set_target_pdf_as_stream (cairo_t *cr,
|
||||
cairo_output_stream_t *stream,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = _cairo_pdf_surface_create_for_stream (stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_pdf (cairo_t *cr,
|
||||
cairo_write_func_t write,
|
||||
cairo_destroy_func_t destroy_closure,
|
||||
void *closure,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_output_stream_t *stream;
|
||||
|
||||
stream = _cairo_output_stream_create (write, destroy_closure, closure);
|
||||
if (stream == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_set_target_pdf_as_stream (cr, stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_pdf_as_file (cairo_t *cr,
|
||||
FILE *fp,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_output_stream_t *stream;
|
||||
|
||||
stream = _cairo_output_stream_create_for_file (fp);
|
||||
if (stream == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_set_target_pdf_as_stream (cr, stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,46 +42,6 @@
|
|||
|
||||
static const cairo_surface_backend_t cairo_ps_surface_backend;
|
||||
|
||||
/**
|
||||
* cairo_set_target_ps:
|
||||
* @cr: a #cairo_t
|
||||
* @file: an open, writeable file
|
||||
* @width_inches: width of the output page, in inches
|
||||
* @height_inches: height of the output page, in inches
|
||||
* @x_pixels_per_inch: X resolution to use for image fallbacks;
|
||||
* not all cairo drawing can be represented in a postscript
|
||||
* file, so cairo will write out images for some portions
|
||||
* of the output.
|
||||
* @y_pixels_per_inch: Y resolution to use for image fallbacks.
|
||||
*
|
||||
* Directs output for a #cairo_t to a postscript file. The file must
|
||||
* be kept open until the #cairo_t is destroyed or set to have a
|
||||
* different target, and then must be closed by the application.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_ps (cairo_t *cr,
|
||||
FILE *file,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_ps_surface_create (file,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
typedef struct cairo_ps_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,27 +76,6 @@ _cairo_win32_print_gdi_error (const char *context)
|
|||
return CAIRO_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_win32 (cairo_t *cr,
|
||||
HDC hdc)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_win32_surface_create (hdc);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_create_dc_and_bitmap (cairo_win32_surface_t *surface,
|
||||
HDC original_dc,
|
||||
|
|
|
|||
|
|
@ -158,30 +158,6 @@ format_from_cairo(XCBConnection *c, cairo_format_t fmt)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_xcb (cairo_t *cr,
|
||||
XCBConnection *dpy,
|
||||
XCBDRAWABLE drawable,
|
||||
XCBVISUALTYPE *visual,
|
||||
cairo_format_t format)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
typedef struct cairo_xcb_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,47 +46,6 @@ typedef enum {
|
|||
|
||||
static void _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
|
||||
|
||||
/**
|
||||
* cairo_set_target_drawable:
|
||||
* @cr: a #cairo_t
|
||||
* @dpy: an X display
|
||||
* @drawable: a window or pixmap on the default screen of @dpy
|
||||
*
|
||||
* Directs output for a #cairo_t to an Xlib drawable. @drawable must
|
||||
* be a Window or Pixmap on the default screen of @dpy using the
|
||||
* default colormap and visual. Using this function is slow because
|
||||
* the function must retrieve information about @drawable from the X
|
||||
* server.
|
||||
|
||||
* The combination of cairo_xlib_surface_create() and
|
||||
* cairo_set_target_surface() is somewhat more flexible, although
|
||||
* it still is slow.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_drawable (cairo_t *cr,
|
||||
Display *dpy,
|
||||
Drawable drawable)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xlib_surface_create (dpy, drawable,
|
||||
DefaultVisual (dpy, DefaultScreen (dpy)),
|
||||
0,
|
||||
DefaultColormap (dpy, DefaultScreen (dpy)));
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
struct _cairo_xlib_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
265
src/cairo.c
265
src/cairo.c
|
|
@ -355,6 +355,271 @@ cairo_set_target_image (cairo_t *cr,
|
|||
CAIRO_CHECK_SANITY (cr);
|
||||
}
|
||||
|
||||
#ifdef CAIRO_HAS_GLITZ_SURFACE
|
||||
|
||||
#include "cairo-glitz.h"
|
||||
|
||||
void
|
||||
cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
|
||||
{
|
||||
cairo_surface_t *crsurface;
|
||||
|
||||
CAIRO_CHECK_SANITY (cr);
|
||||
if (cr->status)
|
||||
return;
|
||||
|
||||
crsurface = cairo_glitz_surface_create (surface);
|
||||
if (crsurface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, crsurface);
|
||||
|
||||
cairo_surface_destroy (crsurface);
|
||||
|
||||
CAIRO_CHECK_SANITY (cr);
|
||||
}
|
||||
#endif /* CAIRO_HAS_GLITZ_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_PDF_SURFACE
|
||||
|
||||
#include "cairo-pdf.h"
|
||||
|
||||
void
|
||||
cairo_set_target_pdf (cairo_t *cr,
|
||||
cairo_write_func_t write,
|
||||
cairo_destroy_func_t destroy_closure,
|
||||
void *closure,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
CAIRO_CHECK_SANITY (cr);
|
||||
if (cr->status)
|
||||
return;
|
||||
|
||||
surface = cairo_pdf_surface_create (write, destroy_closure, closure,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_pdf_as_file (cairo_t *cr,
|
||||
FILE *fp,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
CAIRO_CHECK_SANITY (cr);
|
||||
if (cr->status)
|
||||
return;
|
||||
|
||||
surface = cairo_pdf_surface_create_for_file (fp,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_PDF_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_PNG_SURFACE
|
||||
|
||||
#include "cairo-png.h"
|
||||
|
||||
void
|
||||
cairo_set_target_png (cairo_t *cr,
|
||||
FILE *file,
|
||||
cairo_format_t format,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_png_surface_create (file, format,
|
||||
width, height);
|
||||
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_PNG_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_PS_SURFACE
|
||||
|
||||
#include "cairo-ps.h"
|
||||
|
||||
/**
|
||||
* cairo_set_target_ps:
|
||||
* @cr: a #cairo_t
|
||||
* @file: an open, writeable file
|
||||
* @width_inches: width of the output page, in inches
|
||||
* @height_inches: height of the output page, in inches
|
||||
* @x_pixels_per_inch: X resolution to use for image fallbacks;
|
||||
* not all cairo drawing can be represented in a postscript
|
||||
* file, so cairo will write out images for some portions
|
||||
* of the output.
|
||||
* @y_pixels_per_inch: Y resolution to use for image fallbacks.
|
||||
*
|
||||
* Directs output for a #cairo_t to a postscript file. The file must
|
||||
* be kept open until the #cairo_t is destroyed or set to have a
|
||||
* different target, and then must be closed by the application.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_ps (cairo_t *cr,
|
||||
FILE *file,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_ps_surface_create (file,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_PS_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_WIN32_SURFACE
|
||||
|
||||
#include "cairo-win32.h"
|
||||
|
||||
void
|
||||
cairo_set_target_win32 (cairo_t *cr,
|
||||
HDC hdc)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_win32_surface_create (hdc);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_WIN32_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_XCB_SURFACE
|
||||
|
||||
#include "cairo-xcb.h"
|
||||
|
||||
void
|
||||
cairo_set_target_xcb (cairo_t *cr,
|
||||
XCBConnection *dpy,
|
||||
XCBDRAWABLE drawable,
|
||||
XCBVISUALTYPE *visual,
|
||||
cairo_format_t format)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_XCB_SURFACE */
|
||||
|
||||
#ifdef CAIRO_HAS_XLIB_SURFACE
|
||||
|
||||
#include "cairo-xlib.h"
|
||||
|
||||
/**
|
||||
* cairo_set_target_drawable:
|
||||
* @cr: a #cairo_t
|
||||
* @dpy: an X display
|
||||
* @drawable: a window or pixmap on the default screen of @dpy
|
||||
*
|
||||
* Directs output for a #cairo_t to an Xlib drawable. @drawable must
|
||||
* be a Window or Pixmap on the default screen of @dpy using the
|
||||
* default colormap and visual. Using this function is slow because
|
||||
* the function must retrieve information about @drawable from the X
|
||||
* server.
|
||||
|
||||
* The combination of cairo_xlib_surface_create() and
|
||||
* cairo_set_target_surface() is somewhat more flexible, although
|
||||
* it still is slow.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_drawable (cairo_t *cr,
|
||||
Display *dpy,
|
||||
Drawable drawable)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xlib_surface_create (dpy, drawable,
|
||||
DefaultVisual (dpy, DefaultScreen (dpy)),
|
||||
0,
|
||||
DefaultColormap (dpy, DefaultScreen (dpy)));
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
#endif /* CAIRO_HAS_XLIB_SURFACE */
|
||||
|
||||
/**
|
||||
* cairo_set_operator:
|
||||
* @cr: a #cairo_t
|
||||
|
|
|
|||
|
|
@ -27,25 +27,6 @@
|
|||
#include "cairoint.h"
|
||||
#include "cairo-glitz.h"
|
||||
|
||||
void
|
||||
cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
|
||||
{
|
||||
cairo_surface_t *crsurface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
crsurface = cairo_glitz_surface_create (surface);
|
||||
if (crsurface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, crsurface);
|
||||
|
||||
cairo_surface_destroy (crsurface);
|
||||
}
|
||||
|
||||
typedef struct _cairo_glitz_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -2276,78 +2276,3 @@ _cairo_pdf_document_add_page (cairo_pdf_document_t *document,
|
|||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_set_target_pdf_as_stream (cairo_t *cr,
|
||||
cairo_output_stream_t *stream,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = _cairo_pdf_surface_create_for_stream (stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_pdf (cairo_t *cr,
|
||||
cairo_write_func_t write,
|
||||
cairo_destroy_func_t destroy_closure,
|
||||
void *closure,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_output_stream_t *stream;
|
||||
|
||||
stream = _cairo_output_stream_create (write, destroy_closure, closure);
|
||||
if (stream == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_set_target_pdf_as_stream (cr, stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_pdf_as_file (cairo_t *cr,
|
||||
FILE *fp,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_output_stream_t *stream;
|
||||
|
||||
stream = _cairo_output_stream_create_for_file (fp);
|
||||
if (stream == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
_cairo_set_target_pdf_as_stream (cr, stream,
|
||||
width_inches,
|
||||
height_inches,
|
||||
x_pixels_per_inch,
|
||||
y_pixels_per_inch);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,29 +45,6 @@ static const cairo_surface_backend_t cairo_png_surface_backend;
|
|||
static cairo_int_status_t
|
||||
_cairo_png_surface_copy_page (void *abstract_surface);
|
||||
|
||||
void
|
||||
cairo_set_target_png (cairo_t *cr,
|
||||
FILE *file,
|
||||
cairo_format_t format,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_png_surface_create (file, format,
|
||||
width, height);
|
||||
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
typedef struct cairo_png_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,46 +42,6 @@
|
|||
|
||||
static const cairo_surface_backend_t cairo_ps_surface_backend;
|
||||
|
||||
/**
|
||||
* cairo_set_target_ps:
|
||||
* @cr: a #cairo_t
|
||||
* @file: an open, writeable file
|
||||
* @width_inches: width of the output page, in inches
|
||||
* @height_inches: height of the output page, in inches
|
||||
* @x_pixels_per_inch: X resolution to use for image fallbacks;
|
||||
* not all cairo drawing can be represented in a postscript
|
||||
* file, so cairo will write out images for some portions
|
||||
* of the output.
|
||||
* @y_pixels_per_inch: Y resolution to use for image fallbacks.
|
||||
*
|
||||
* Directs output for a #cairo_t to a postscript file. The file must
|
||||
* be kept open until the #cairo_t is destroyed or set to have a
|
||||
* different target, and then must be closed by the application.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_ps (cairo_t *cr,
|
||||
FILE *file,
|
||||
double width_inches,
|
||||
double height_inches,
|
||||
double x_pixels_per_inch,
|
||||
double y_pixels_per_inch)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_ps_surface_create (file,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
typedef struct cairo_ps_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,27 +76,6 @@ _cairo_win32_print_gdi_error (const char *context)
|
|||
return CAIRO_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_win32 (cairo_t *cr,
|
||||
HDC hdc)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_win32_surface_create (hdc);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_create_dc_and_bitmap (cairo_win32_surface_t *surface,
|
||||
HDC original_dc,
|
||||
|
|
|
|||
|
|
@ -158,30 +158,6 @@ format_from_cairo(XCBConnection *c, cairo_format_t fmt)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
cairo_set_target_xcb (cairo_t *cr,
|
||||
XCBConnection *dpy,
|
||||
XCBDRAWABLE drawable,
|
||||
XCBVISUALTYPE *visual,
|
||||
cairo_format_t format)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
typedef struct cairo_xcb_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,47 +46,6 @@ typedef enum {
|
|||
|
||||
static void _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
|
||||
|
||||
/**
|
||||
* cairo_set_target_drawable:
|
||||
* @cr: a #cairo_t
|
||||
* @dpy: an X display
|
||||
* @drawable: a window or pixmap on the default screen of @dpy
|
||||
*
|
||||
* Directs output for a #cairo_t to an Xlib drawable. @drawable must
|
||||
* be a Window or Pixmap on the default screen of @dpy using the
|
||||
* default colormap and visual. Using this function is slow because
|
||||
* the function must retrieve information about @drawable from the X
|
||||
* server.
|
||||
|
||||
* The combination of cairo_xlib_surface_create() and
|
||||
* cairo_set_target_surface() is somewhat more flexible, although
|
||||
* it still is slow.
|
||||
**/
|
||||
void
|
||||
cairo_set_target_drawable (cairo_t *cr,
|
||||
Display *dpy,
|
||||
Drawable drawable)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
|
||||
return;
|
||||
|
||||
surface = cairo_xlib_surface_create (dpy, drawable,
|
||||
DefaultVisual (dpy, DefaultScreen (dpy)),
|
||||
0,
|
||||
DefaultColormap (dpy, DefaultScreen (dpy)));
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
/* cairo_set_target_surface takes a reference, so we must destroy ours */
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
struct _cairo_xlib_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,5 +18,6 @@ text_rotate
|
|||
user_data
|
||||
*-out.png
|
||||
*-diff.png
|
||||
|
||||
|
||||
*.la
|
||||
*.lo
|
||||
*.log
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue