PLplot 5.15.0
Loading...
Searching...
No Matches
cairo.c File Reference
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include "plDevs.h"
#include "plplotP.h"
#include "drivers.h"

Go to the source code of this file.

Classes

struct  PLCairo
 

Macros

#define DPI   72
 
#define PLCAIRO_DEFAULT_X   720
 
#define PLCAIRO_DEFAULT_Y   540
 
#define MAX_STRING_LEN   500
 
#define MAX_MARKUP_LEN   MAX_STRING_LEN * 10
 
#define NPANGOLOOKUP   5
 
#define FAMILY_LOOKUP_LEN   1024
 
#define TAG_LEN   200
 
#define RISE_FACTOR   0.8
 

Functions

PLCairostream_and_font_setup (PLStream *, int)
 
cairo_status_t write_to_stream (void *, unsigned char *, unsigned int)
 
void set_clip (PLStream *pls)
 
int cairo_family_check (PLStream *pls)
 
static void proc_str (PLStream *, EscText *)
 
static void text_begin_cairo (PLStream *pls, EscText *args)
 
static void text_char_cairo (PLStream *pls, EscText *args)
 
static void text_esc_cairo (PLStream *pls, EscText *args)
 
static void text_end_cairo (PLStream *pls, EscText *args)
 
static char * ucs4_to_pango_markup_format (PLUNICODE *, int, float)
 
static void open_span_tag (char *, PLUNICODE, float, int)
 
static void close_span_tag (char *, int)
 
static char * rise_span_tag (int, float, float, float)
 
static void set_current_context (PLStream *)
 
static void poly_line (PLStream *, short *, short *, PLINT)
 
static void filled_polygon (PLStream *pls, short *xa, short *ya, PLINT npts)
 
static void gradient (PLStream *pls, short *xa, short *ya, PLINT npts)
 
static void arc (PLStream *, arc_struct *)
 
static void rotate_cairo_surface (PLStream *, float, float, float, float, float, float, PLBOOL)
 
static void blit_to_x (PLStream *pls, double x, double y, double w, double h)
 
static void start_raster (PLStream *)
 
static void end_raster (PLStream *)
 
static void set_mode (PLStream *, PLINT *)
 
static void get_mode (PLStream *, PLINT *)
 
void get_line_properties (PLCairo *aStream, cairo_line_join_t *join, cairo_line_cap_t *cap)
 
void set_line_properties (PLCairo *aStream, cairo_line_join_t join, cairo_line_cap_t cap)
 
void plD_bop_cairo (PLStream *)
 
void plD_eop_cairo (PLStream *)
 
void plD_state_cairo (PLStream *, PLINT)
 
void plD_esc_cairo (PLStream *, PLINT, void *)
 
void plD_tidy_cairo (PLStream *)
 
void plD_line_cairo (PLStream *, short, short, short, short)
 
void plD_polyline_cairo (PLStream *, short *, short *, PLINT)
 
void plD_state_cairo (PLStream *PL_UNUSED(pls), PLINT PL_UNUSED(op))
 

Variables

static int text_clipping
 
static int text_anti_aliasing
 
static int graphics_anti_aliasing
 
static int external_drawable
 
static int rasterize_image
 
static int set_background
 
static int image_buffering
 
static int already_warned = 0
 
static DrvOpt cairo_options []
 
PLDLLIMPEXP_DRIVER const char * plD_DEVICE_INFO_cairo =
 
const char * defaultFamilyLookup [NPANGOLOOKUP]
 
const char * envFamilyLookup [NPANGOLOOKUP]
 
char familyLookup [NPANGOLOOKUP][FAMILY_LOOKUP_LEN]
 
const char * weightLookup [2]
 
const char * styleLookup [3]
 

Macro Definition Documentation

◆ DPI

#define DPI   72

Definition at line 71 of file cairo.c.

◆ FAMILY_LOOKUP_LEN

#define FAMILY_LOOKUP_LEN   1024

Definition at line 214 of file cairo.c.

◆ MAX_MARKUP_LEN

#define MAX_MARKUP_LEN   MAX_STRING_LEN * 10

Definition at line 76 of file cairo.c.

◆ MAX_STRING_LEN

#define MAX_STRING_LEN   500

Definition at line 75 of file cairo.c.

◆ NPANGOLOOKUP

#define NPANGOLOOKUP   5

Definition at line 196 of file cairo.c.

◆ PLCAIRO_DEFAULT_X

#define PLCAIRO_DEFAULT_X   720

Definition at line 72 of file cairo.c.

◆ PLCAIRO_DEFAULT_Y

#define PLCAIRO_DEFAULT_Y   540

Definition at line 73 of file cairo.c.

◆ RISE_FACTOR

#define RISE_FACTOR   0.8

Definition at line 1226 of file cairo.c.

◆ TAG_LEN

#define TAG_LEN   200

Definition at line 217 of file cairo.c.

Function Documentation

◆ arc()

void arc ( PLStream * pls,
arc_struct * arc_info )
static

Definition at line 1608 of file cairo.c.

◆ blit_to_x()

static void blit_to_x ( PLStream * pls,
double x,
double y,
double w,
double h )
static

◆ cairo_family_check()

int cairo_family_check ( PLStream * pls)

Definition at line 1585 of file cairo.c.

◆ close_span_tag()

void close_span_tag ( char * pangoMarkupString,
int upDown )
static

Definition at line 1199 of file cairo.c.

◆ end_raster()

void end_raster ( PLStream * pls)
static

Definition at line 342 of file cairo.c.

◆ filled_polygon()

void filled_polygon ( PLStream * pls,
short * xa,
short * ya,
PLINT npts )
static

Definition at line 1452 of file cairo.c.

◆ get_line_properties()

void get_line_properties ( PLCairo * aStream,
cairo_line_join_t * join,
cairo_line_cap_t * cap )

Definition at line 422 of file cairo.c.

◆ get_mode()

void get_mode ( PLStream * pls,
PLINT * mode )
static

Definition at line 614 of file cairo.c.

◆ gradient()

void gradient ( PLStream * pls,
short * xa,
short * ya,
PLINT npts )
static

Definition at line 1499 of file cairo.c.

◆ open_span_tag()

void open_span_tag ( char * pangoMarkupString,
PLUNICODE fci,
float fontSize,
int upDown )
static

Definition at line 1137 of file cairo.c.

◆ plD_bop_cairo()

void plD_bop_cairo ( PLStream * pls)

Definition at line 385 of file cairo.c.

◆ plD_eop_cairo()

void plD_eop_cairo ( PLStream * pls)

Definition at line 483 of file cairo.c.

◆ plD_esc_cairo()

void plD_esc_cairo ( PLStream * pls,
PLINT op,
void * ptr )

Definition at line 530 of file cairo.c.

◆ plD_line_cairo()

void plD_line_cairo ( PLStream * pls,
short x1a,
short y1a,
short x2a,
short y2a )

Definition at line 434 of file cairo.c.

◆ plD_polyline_cairo()

void plD_polyline_cairo ( PLStream * pls,
short * xa,
short * ya,
PLINT npts )

Definition at line 460 of file cairo.c.

◆ plD_state_cairo() [1/2]

void plD_state_cairo ( PLStream * ,
PLINT  )

◆ plD_state_cairo() [2/2]

void plD_state_cairo ( PLStream * PL_UNUSEDpls,
PLINT PL_UNUSEDop )

Definition at line 520 of file cairo.c.

◆ plD_tidy_cairo()

void plD_tidy_cairo ( PLStream * pls)

Definition at line 498 of file cairo.c.

◆ poly_line()

void poly_line ( PLStream * pls,
short * xa,
short * ya,
PLINT npts )
static

Definition at line 1430 of file cairo.c.

◆ proc_str()

void proc_str ( PLStream * pls,
EscText * args )
static

Definition at line 873 of file cairo.c.

◆ rise_span_tag()

char * rise_span_tag ( int ifsuperscript,
float fontSize,
float multiplier,
float rise )
static

Definition at line 1239 of file cairo.c.

◆ rotate_cairo_surface()

void rotate_cairo_surface ( PLStream * pls,
float x11,
float x12,
float x21,
float x22,
float x0,
float y0,
PLBOOL is_xcairo )
static

Definition at line 1666 of file cairo.c.

◆ set_clip()

void set_clip ( PLStream * pls)

Definition at line 1543 of file cairo.c.

◆ set_current_context()

void set_current_context ( PLStream * pls)
static

Definition at line 1401 of file cairo.c.

◆ set_line_properties()

void set_line_properties ( PLCairo * aStream,
cairo_line_join_t join,
cairo_line_cap_t cap )

Definition at line 428 of file cairo.c.

◆ set_mode()

void set_mode ( PLStream * pls,
PLINT * mode )
static

Definition at line 586 of file cairo.c.

◆ start_raster()

void start_raster ( PLStream * pls)
static

Definition at line 298 of file cairo.c.

◆ stream_and_font_setup()

PLCairo * stream_and_font_setup ( PLStream * pls,
int interactive )

Definition at line 1301 of file cairo.c.

◆ text_begin_cairo()

void text_begin_cairo ( PLStream * pls,
EscText * args )
static

Definition at line 646 of file cairo.c.

◆ text_char_cairo()

void text_char_cairo ( PLStream * pls,
EscText * args )
static

Definition at line 670 of file cairo.c.

◆ text_end_cairo()

void text_end_cairo ( PLStream * pls,
EscText * args )
static

Definition at line 773 of file cairo.c.

◆ text_esc_cairo()

void text_esc_cairo ( PLStream * pls,
EscText * args )
static

Definition at line 704 of file cairo.c.

◆ ucs4_to_pango_markup_format()

char * ucs4_to_pango_markup_format ( PLUNICODE * ucs4,
int ucs4Len,
float fontSize )
static

Definition at line 992 of file cairo.c.

◆ write_to_stream()

cairo_status_t write_to_stream ( void * filePointer,
unsigned char * data,
unsigned int length )

Definition at line 1277 of file cairo.c.

Variable Documentation

◆ already_warned

int already_warned = 0
static

Definition at line 85 of file cairo.c.

◆ cairo_options

DrvOpt cairo_options[]
static
Initial value:
= { { "text_clipping", DRV_INT, &text_clipping, "Use text clipping (text_clipping=0|1)" },
{ "text_anti_aliasing", DRV_INT, &text_anti_aliasing, "Set desired text anti-aliasing (text_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t)" },
{ "graphics_anti_aliasing", DRV_INT, &graphics_anti_aliasing, "Set desired graphics anti-aliasing (graphics_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t" },
{ "external_drawable", DRV_INT, &external_drawable, "Plot to external X drawable" },
{ "rasterize_image", DRV_INT, &rasterize_image, "Raster or vector image rendering (rasterize_image=0|1)" },
{ "set_background", DRV_INT, &set_background, "Set the background for the extcairo device (set_background=0|1). If 1 then the plot background will set by PLplot" },
{ "image_buffering", DRV_INT, &image_buffering, "Buffered offscreen rendering for the xcairo device (image_buffering=0|1)." },
{ NULL, DRV_INT, NULL, NULL } }
static int graphics_anti_aliasing
Definition cairo.c:80
static int text_clipping
Definition cairo.c:78
static int text_anti_aliasing
Definition cairo.c:79
static int external_drawable
Definition cairo.c:81
static int set_background
Definition cairo.c:83
static int image_buffering
Definition cairo.c:84
static int rasterize_image
Definition cairo.c:82
@ DRV_INT
Definition plplotP.h:758

Definition at line 87 of file cairo.c.

◆ defaultFamilyLookup

const char* defaultFamilyLookup[NPANGOLOOKUP]
Initial value:
= {
"sans",
"serif",
"monospace",
"sans,serif",
"sans,serif"
}

Definition at line 198 of file cairo.c.

◆ envFamilyLookup

const char* envFamilyLookup[NPANGOLOOKUP]
Initial value:
= {
"PLPLOT_FREETYPE_SANS_FAMILY",
"PLPLOT_FREETYPE_SERIF_FAMILY",
"PLPLOT_FREETYPE_MONO_FAMILY",
"PLPLOT_FREETYPE_SCRIPT_FAMILY",
"PLPLOT_FREETYPE_SYMBOL_FAMILY"
}

Definition at line 206 of file cairo.c.

◆ external_drawable

int external_drawable
static

Definition at line 81 of file cairo.c.

◆ familyLookup

char familyLookup[NPANGOLOOKUP][FAMILY_LOOKUP_LEN]

Definition at line 215 of file cairo.c.

◆ graphics_anti_aliasing

int graphics_anti_aliasing
static

Definition at line 80 of file cairo.c.

◆ image_buffering

int image_buffering
static

Definition at line 84 of file cairo.c.

◆ plD_DEVICE_INFO_cairo

PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_cairo =

Definition at line 149 of file cairo.c.

◆ rasterize_image

int rasterize_image
static

Definition at line 82 of file cairo.c.

◆ set_background

int set_background
static

Definition at line 83 of file cairo.c.

◆ styleLookup

const char* styleLookup[3]
Initial value:
= {
"normal",
"italic",
"oblique"
}

Definition at line 224 of file cairo.c.

◆ text_anti_aliasing

int text_anti_aliasing
static

Definition at line 79 of file cairo.c.

◆ text_clipping

int text_clipping
static

Definition at line 78 of file cairo.c.

◆ weightLookup

const char* weightLookup[2]
Initial value:
= {
"normal",
"bold"
}

Definition at line 219 of file cairo.c.