Image Interpolation with Geometric Contour Stencils
|
Vector drawing abstraction. More...
Go to the source code of this file.
Macros | |
#define | FILE_BUFFER_CAPACITY (1024*4) |
Buffer size to use for file output. More... | |
#define | SWAP(A, B) |
Swap A and B. More... | |
Functions | |
pen * | NewPen () |
Create a new pen. More... | |
void | FreePen (pen *Pen) |
Free all memory associated with a pen. More... | |
FILE * | PenGetFile (pen *Pen) |
Get the stdio FILE* pointer associated with a pen. More... | |
int | PenDrawLine (pen *Pen, float x1, float y1, float x2, float y2) |
Draw a line. More... | |
int | PenDrawRectangle (pen *Pen, float x1, float y1, float x2, float y2) |
Draw a rectangle. More... | |
int | PenDrawQBezier (pen *Pen, float x1, float y1, float x2, float y2, float x3, float y3) |
Draw a quadratic Bezier curve. More... | |
int | PenDrawCircle (pen *Pen, float x, float y, float r) |
Draw a circle. More... | |
int | PenDrawEllipse (pen *Pen, float x, float y, float rx, float ry, float Theta) |
Draw an ellipse. More... | |
void | PenWriteDouble (FILE *File, double Value, int NumDigits) |
Write a floating-point value without trailing zeros. More... | |
int | PenGetNumDigits (pen *Pen) |
Get the number of digits used for writing floats. More... | |
void | PenSetNumDigits (pen *Pen, int NumDigits) |
Set the number of digits used for writing floats. More... | |
pentrans | PenGetTrans (pen *Pen) |
Get the pen canvas transformation. More... | |
void | PenSetTrans (pen *Pen, pentrans Trans) |
(Re)set the pen canvas transformation More... | |
void | PenTransformCanvas (pen *Pen, double a, double b, double c, double d, double e, double f) |
Transform the pen's canvas. More... | |
void | PenTranslateCanvas (pen *Pen, double tx, double ty) |
Translate the pen's canvas. More... | |
void | PenScaleCanvas (pen *Pen, double XScale, double YScale) |
Scale the pen's canvas. More... | |
void | PenRotateCanvas (pen *Pen, double Theta) |
Rotate the pen's canvas. More... | |
void | PenXSkewCanvas (pen *Pen, double Skew) |
Horizontally skew the pen's canvas. More... | |
void | PenYSkewCanvas (pen *Pen, double Skew) |
Vertically skew the pen's canvas. More... | |
int | PenColorToIndex (pen *Pen, const float *Color) |
Find the pen palette index of a color. More... | |
int | PenDefineColor (pen *Pen, const float *Color) |
Add a color to a pen's palette. More... | |
int | PenSetColor (pen *Pen, const float *Color) |
Set the current pen drawing color. More... | |
void | TransformEllipse (float *x, float *y, float *rx, float *ry, float *Theta, pentrans Trans) |
Compute canvas transformation for an ellipse. More... | |
float | EstArcLenQBezier (float x1, float y1, float x2, float y2, float x3, float y3, pentrans Trans) |
Estimate arc length of a quadratic Bezier curve. More... | |
float | EstArcLenEllipse (float x, float y, float rx, float ry, float Theta, pentrans Trans) |
Estimate the arc length of an ellipse. More... | |
int | PenRenderToImage (pen *Pen, float *Image, int Width, int Height) |
Set pen to render to a raster image. More... | |
void | EpsSetColor (pen *Pen, const float *Color) |
Set drawing color in an EPS. More... | |
int | EpsOpen (pen *Pen, const char *FileName, float Width, float Height) |
Start writing a new EPS file. More... | |
int | EpsClose (pen *Pen) |
Finish writing an EPS file. More... | |
int | WriteASCII85 (FILE *File, const uint8_t *Data, int NumBytes) |
Write ASCII85 encoded data. More... | |
int | EpsWriteGrayImage (FILE *File, const uint8_t *Image, int Width, int Height) |
Writes a grayscale image to an EPS file. More... | |
int | EpsWriteColorImage (FILE *File, const uint8_t *Image, int Width, int Height) |
Writes an RGB color image to an EPS file. More... | |
int | SvgOpen (pen *Pen, const char *FileName, float Width, float Height) |
Start writing a new SVG file. More... | |
int | SvgClose (pen *Pen) |
Finish writing an SVG file. More... | |
Variables | |
const pentrans | IdentityPenTrans = {1, 0, 0, 1, 0, 0} |
Identity transform. More... | |
Vector drawing abstraction.
Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file pen.c.
#define FILE_BUFFER_CAPACITY (1024*4) |
#define SWAP | ( | A, | |
B | |||
) |
int EpsClose | ( | pen * | Pen | ) |
int EpsOpen | ( | pen * | Pen, |
const char * | FileName, | ||
float | Width, | ||
float | Height | ||
) |
void EpsSetColor | ( | pen * | Pen, |
const float * | Color | ||
) |
int EpsWriteColorImage | ( | FILE * | File, |
const uint8_t * | Image, | ||
int | Width, | ||
int | Height | ||
) |
Writes an RGB color image to an EPS file.
File | the stdio file handle to write to |
Image | interleaved RGB color image data |
Width,Height | the image dimensions |
The image is plotted on the canvas in the rectangle [0,Width] x [0,Height] where the lower-left corner is at the origin.
This routine only writes the image data. EpsOpen should be called first, then this routine and other drawing commands, and finally EpsClose.
For relative simplicity, the image data is written uncompressed in ASCII85 encoding. The file size is approximately 25% larger than in the PGM file format.
int EpsWriteGrayImage | ( | FILE * | File, |
const uint8_t * | Image, | ||
int | Width, | ||
int | Height | ||
) |
Writes a grayscale image to an EPS file.
File | the stdio file handle to write to |
Image | grayscale image data |
Width,Height | the image dimensions |
The image is plotted on the canvas in the rectangle [0,Width] x [0,Height] where the lower-left corner is at the origin.
This routine only writes the image data. EpsOpen should be called first, then this routine and other drawing commands, and finally EpsClose.
For relative simplicity, the image data is written uncompressed in ASCII85 encoding. The file size is approximately 25% larger than in the PGM file format.
float EstArcLenEllipse | ( | float | x, |
float | y, | ||
float | rx, | ||
float | ry, | ||
float | Theta, | ||
pentrans | Trans | ||
) |
Estimate the arc length of an ellipse.
x,y,rx,ry,Theta | parameters for pen::DrawEllipse |
Trans | the canvas transformation |
float EstArcLenQBezier | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | x3, | ||
float | y3, | ||
pentrans | Trans | ||
) |
void FreePen | ( | pen * | Pen | ) |
pen* NewPen | ( | ) |
int PenColorToIndex | ( | pen * | Pen, |
const float * | Color | ||
) |
int PenDefineColor | ( | pen * | Pen, |
const float * | Color | ||
) |
int PenDrawCircle | ( | pen * | Pen, |
float | x, | ||
float | y, | ||
float | r | ||
) |
Draw a circle.
Pen | the pen object |
x,y | circle center |
r | circle radius |
This function is a wrapper for pen::DrawEllipse.
int PenDrawEllipse | ( | pen * | Pen, |
float | x, | ||
float | y, | ||
float | rx, | ||
float | ry, | ||
float | Theta | ||
) |
Draw an ellipse.
Pen | the pen object |
x,y | center of the ellipse |
rx,ry | radii of the ellipse |
Theta | ellipse rotation |
This function is a wrapper for pen::DrawEllipse.
int PenDrawLine | ( | pen * | Pen, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
Draw a line.
Pen | the pen object |
x1,y1,x2,y2 | endpoints of the line |
This function is a wrapper for pen::DrawLine.
int PenDrawQBezier | ( | pen * | Pen, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | x3, | ||
float | y3 | ||
) |
Draw a quadratic Bezier curve.
Pen | the pen object |
x1,y1,x2,y2,x3,y3 | starting point, control point, and endpoint |
This function is a wrapper for pen::DrawQBezier.
int PenDrawRectangle | ( | pen * | Pen, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2 | ||
) |
FILE* PenGetFile | ( | pen * | Pen | ) |
int PenGetNumDigits | ( | pen * | Pen | ) |
Get the number of digits used for writing floats.
Pen | the pen object |
Gets the number of digits used in PenWriteDouble().
Get the pen canvas transformation.
Pen | the pen object |
Gets pen::Trans. This is useful in combination with PenSetTrans() to save and later restore the canvas transformation.
int PenRenderToImage | ( | pen * | Pen, |
float * | Image, | ||
int | Width, | ||
int | Height | ||
) |
void PenRotateCanvas | ( | pen * | Pen, |
double | Theta | ||
) |
void PenScaleCanvas | ( | pen * | Pen, |
double | XScale, | ||
double | YScale | ||
) |
int PenSetColor | ( | pen * | Pen, |
const float * | Color | ||
) |
void PenSetNumDigits | ( | pen * | Pen, |
int | NumDigits | ||
) |
Set the number of digits used for writing floats.
Pen | the pen object |
NumDigits | the number of digits |
Sets the number of digits used in PenWriteDouble().
(Re)set the pen canvas transformation
Pen | the pen object |
Trans | the pentrans canvas transformation |
Sets pen::Trans to Trans. This is useful in combination with PenGetTrans() to save and later restore the canvas transformation.
void PenTransformCanvas | ( | pen * | Pen, |
double | a, | ||
double | b, | ||
double | c, | ||
double | d, | ||
double | e, | ||
double | f | ||
) |
void PenTranslateCanvas | ( | pen * | Pen, |
double | tx, | ||
double | ty | ||
) |
void PenWriteDouble | ( | FILE * | File, |
double | Value, | ||
int | NumDigits | ||
) |
void PenXSkewCanvas | ( | pen * | Pen, |
double | Skew | ||
) |
void PenYSkewCanvas | ( | pen * | Pen, |
double | Skew | ||
) |
int SvgClose | ( | pen * | Pen | ) |
int SvgOpen | ( | pen * | Pen, |
const char * | FileName, | ||
float | Width, | ||
float | Height | ||
) |
void TransformEllipse | ( | float * | x, |
float * | y, | ||
float * | rx, | ||
float * | ry, | ||
float * | Theta, | ||
pentrans | Trans | ||
) |
Compute canvas transformation for an ellipse.
x,y,rx,ry,Theta | parameters for pen::DrawEllipse |
Trans | the canvas transformation |
The input values of the parameters x, y, rx, ry, Theta are the untransformed parameters as given to pen::DrawEllipse. They are replaced with transformed values.
int WriteASCII85 | ( | FILE * | File, |
const uint8_t * | Data, | ||
int | NumBytes | ||
) |