|
NPWGraphics.h File ReferenceHelper functions for graphics.
More...
#include "NPWBase.h"
Go to the source code of this file.
|
Defines |
#define | NPWGraphicsMove(pdf, x, y) NPWGraphicsCmd(pdf, "m", "ff", (NPWFloat)(x), (NPWFloat)(y)) |
| Path "move" command.
|
#define | NPWGraphicsLine(pdf, x, y) NPWGraphicsCmd(pdf, "l", "ff", (NPWFloat)(x), (NPWFloat)(y)) |
| Path "line" command.
|
#define | NPWGraphicsBezier(pdf, x1, y1, x2, y2, x3, y3) |
| Path "bezier" command.
|
#define | NPWGraphicsClosePath(pdf) NPWGraphicsCmd(pdf, "h", "") |
| Close path.
|
#define | NPWGraphicsRectangle(pdf, x, y, w, h) NPWGraphicsCmd(pdf, "re", "ffff", (NPWFloat)(x), (NPWFloat)(y), (NPWFloat)(w), (NPWFloat)(h)) |
| Create a rectangular path.
|
#define | NPWGraphicsEllipse(pdf, x0, y0, rx, ry) |
| Create an elliptic path.
|
#define | NPWGraphicsStroke(pdf) NPWGraphicsCmd(pdf, "S", "") |
| Stroke path.
|
#define | NPWGraphicsCloseStroke(pdf) NPWGraphicsCmd(pdf, "s", "") |
| Close and stroke path.
|
#define | NPWGraphicsFill(pdf) NPWGraphicsCmd(pdf, "f", "") |
| Fill path using nonzero winding number rule.
|
#define | NPWGraphicsFillEO(pdf) NPWGraphicsCmd(pdf, "f*", "") |
| Fill path using even-odd rule.
|
#define | NPWGraphicsFillStroke(pdf) NPWGraphicsCmd(pdf, "B", "") |
| Fill path using nonzero winding number rule, then stroke it.
|
#define | NPWGraphicsFillEOStroke(pdf) NPWGraphicsCmd(pdf, "B*", "") |
| Fill path using even-odd rule, then stroke it.
|
#define | NPWGraphicsCloseFillStroke(pdf) NPWGraphicsCmd(pdf, "b", "") |
| Close path, fill it using nonzero winding number rule, then stroke it.
|
#define | NPWGraphicsCloseFillEOStroke(pdf) NPWGraphicsCmd(pdf, "b*", "") |
| Close path, fill it using even-odd rule, then stroke it.
|
#define | NPWGraphicsEndPath(pdf) NPWGraphicsCmd(pdf, "n", "") |
| Discard path.
|
#define | NPWGraphicsClip(pdf) NPWGraphicsCmd(pdf, "W", "") |
| Use path to define the clipping region with nonzero winding number rule.
|
#define | NPWGraphicsClipEO(pdf) NPWGraphicsCmd(pdf, "W*", "") |
| Use path to define the clipping region with even-odd rule.
|
#define | NPWGraphicsGrayStroke(pdf, g) NPWGraphicsCmd(pdf, "G", "f", (NPWFloat)(g)) |
| Define the gray shade for stroking.
|
#define | NPWGraphicsGray(pdf, g) NPWGraphicsCmd(pdf, "g", "f", (NPWFloat)g) |
| Define the gray shade for filling.
|
#define | NPWGraphicsRGBStroke(pdf, r, g, b) NPWGraphicsCmd(pdf, "RG", "fff", (NPWFloat)(r), (NPWFloat)(g), (NPWFloat)(b)) |
| Define the RGB color for stroking.
|
#define | NPWGraphicsRGB(pdf, r, g, b) NPWGraphicsCmd(pdf, "rg", "fff", (NPWFloat)(r), (NPWFloat)(g), (NPWFloat)(b)) |
| Define the RGB color for filling.
|
#define | NPWGraphicsCMYKStroke(pdf, c, m, y, k) NPWGraphicsCmd(pdf, "K", "ffff", (NPWFloat)(c), (NPWFloat)(m), (NPWFloat)(y), (NPWFloat)(k)) |
| Define the CMYK color for stroking.
|
#define | NPWGraphicsCMYK(pdf, c, m, y, k) NPWGraphicsCmd(pdf, "k", "ffff", (NPWFloat)(c), (NPWFloat)(m), (NPWFloat)(y), (NPWFloat)(k)) |
| Define the CMYK color for filling.
|
#define | NPWGraphicsSave(pdf) NPWGraphicsCmd(pdf, "q", "") |
| Save graphics state.
|
#define | NPWGraphicsRestore(pdf) NPWGraphicsCmd(pdf, "Q", "") |
| Restore graphics state.
|
#define | NPWGraphicsConcatCTM(pdf, a, b, c, d, e, f) |
| Concatenate a matrix to the current coordinate transform matrix.
|
#define | NPWGraphicsSetLineWidth(pdf, w) NPWGraphicsCmd(pdf, "w", "f", (NPWFloat)(w)) |
| Set line width for stroking.
|
#define | NPWGraphicsSetLineCap(pdf, c) NPWGraphicsCmd(pdf, "j", "f", c) |
| Set line cap.
|
#define | NPWGraphicsSetLineJoin(pdf, j) NPWGraphicsCmd(pdf, "J", "f", j) |
| Set line join.
|
#define | NPWGraphicsSetMiterLimit(pdf, l) NPWGraphicsCmd(pdf, "w", "f", (NPWFloat)(l)) |
| Set miter limit.
|
#define | NPWInlineImageBegin(pdf, w, h, cs, bpc, f) |
| Begin an inline raster image (must be followed by the raster data written with NPWFilterBegin, NPWFilterWrite and NPWFilterEnd).
|
#define | NPWInlineImageEnd(pdf) NPWWrite(pdf, "EI\n", -1); |
| End an inline image.
|
#define | NPWGraphicsSetCharSpace(pdf, s) NPWGraphicsCmd(pdf, "Tc", "f", (NPWFloat)(s)) |
| Set additional space between each character pair (positive to reduce space).
|
#define | NPWGraphicsSetWordSpace(pdf, s) NPWGraphicsCmd(pdf, "Tw", "f", (NPWFloat)(s)) |
| Set additional space between each word.
|
#define | NPWGraphicsSetHorizontalScaling(pdf, s) NPWGraphicsCmd(pdf, "Tz", "f", (NPWFloat)(s)) |
| Set horizontal scaling.
|
#define | NPWGraphicsSetTextLeading(pdf, leading) NPWGraphicsCmd(pdf, "TL", "f", (NPWFloat)(leading)) |
| Set text leading (distance between lines, negative to go downward).
|
#define | NPWGraphicsSetTextFont(pdf, font, size) NPWGraphicsCmd(pdf, "Tf", "Sf", font, -1, (NPWFloat)(size)) |
| Set text font (NPWFontNameCourier etc.) and size.
|
#define | NPWGraphicsSetTextRenderingMode(pdf, render) NPWGraphicsCmd(pdf, "Tr", "f", (NPWFloat)(render)) |
| Set text rendering mode (default = kNPWTextRenderingModeFill).
|
#define | NPWGraphicsSetTextRise(pdf, rise) NPWGraphicsCmd(pdf, "Ts", "f", (NPWFloat)(rise)) |
| Set text rise (positive for superscript).
|
#define | NPWGraphicsBeginText(pdf) NPWGraphicsCmd(pdf, "BT", "") |
| Begin writing text.
|
#define | NPWGraphicsEndText(pdf) NPWGraphicsCmd(pdf, "ET", "") |
| End writing text.
|
#define | NPWGraphicsMoveText(pdf, x, y) NPWGraphicsCmd(pdf, "Td", "ff", (NPWFloat)(x), (NPWFloat)(y)) |
| Move position of next text drawing.
|
#define | NPWGraphicsNL(pdf) NPWGraphicsCmd(pdf, "T*", "") |
| Move to beginning of next line.
|
#define | NPWGraphicsShowText(pdf, str, len) NPWGraphicsCmd(pdf, "Tj", "s", str, len) |
| Show text.
|
#define | NPWGraphicsNLShowText(pdf, str, len) NPWGraphicsCmd(pdf, "'", "s", str, len) |
| Move to beginning of next line, then show text.
|
#define | NPWGraphicsNLShowTextSp(pdf, aw, ac, str, len) NPWGraphicsCmd(pdf, "\"", "ffs", (NPWFloat)(aw), (NPWFloat)(ac), str, len) |
| Move to beginning of next line, set space between words and characters, then show text.
|
#define | NPWGraphicsHorSkip(pdf, dx) NPWGraphicsCmd(pdf, "TJ", "[f]", -(NPWFloat)dx) |
| Adjust horizontal displacement by moving to the right, in 1/1000 font size.
|
Enumerations |
enum | { kNPWLineCapButt = 0,
kNPWLineCapRound,
kNPWLineCapSquare
} |
| Line cap type. More...
|
enum | { kNPWLineJoinMitter = 0,
kNPWLineJoinRound,
kNPWLineJoinBevel
} |
| Line join type. More...
|
enum | {
kNPWTextRenderingModeFill = 0,
kNPWTextRenderingModeStroke,
kNPWTextRenderingModeFillStroke,
kNPWTextRenderingModeInvisible,
kNPWTextRenderingModeFillClip,
kNPWTextRenderingModeStrokeClip,
kNPWTextRenderingModeFillStrokeClip,
kNPWTextRenderingModeClip
} |
| Text rendering modes. More...
|
Functions |
NPWErr | NPWGraphicsCmd (NPW *pdf, NPWConstText cmd, NPWConstText fmt,...) |
| Write arguments and a command.
|
Detailed Description
Helper functions for graphics.
- Author:
- Yves Piguet. Copyright 2008-2010, Yves Piguet
Definition in file NPWGraphics.h.
Define Documentation
#define NPWGraphicsBezier |
( |
pdf, |
|
|
x1, |
|
|
y1, |
|
|
x2, |
|
|
y2, |
|
|
x3, |
|
|
y3 |
|
) |
|
#define NPWGraphicsConcatCTM |
( |
pdf, |
|
|
a, |
|
|
b, |
|
|
c, |
|
|
d, |
|
|
e, |
|
|
f |
|
) |
|
Value: Concatenate a matrix to the current coordinate transform matrix.
Definition at line 141 of file NPWGraphics.h.
#define NPWGraphicsEllipse |
( |
pdf, |
|
|
x0, |
|
|
y0, |
|
|
rx, |
|
|
ry |
|
) |
|
Value: do { \
NPWGraphicsMove(pdf, (x0) - (rx), y0); \
NPWGraphicsBezier(pdf, \
(x0) - (rx), (y0) + (ry) * 55 / 100, \
(x0) - (rx) * 55 / 100, (y0) + (ry), \
x0, (y0) + (ry)); \
NPWGraphicsBezier(pdf, \
(x0) + (rx) * 55 / 100, (y0) + (ry), \
(x0) + (rx), (y0) + (ry) * 55 / 100, \
(x0) + (rx), y0); \
NPWGraphicsBezier(pdf, \
(x0) + (rx), (y0) - (ry) * 55 / 100, \
(x0) + (rx) * 55 / 100, (y0) - (ry), \
x0, (y0) - (ry)); \
NPWGraphicsBezier(pdf, \
(x0) - (rx) * 55 / 100, (y0) - (ry), \
(x0) - (rx), (y0) - (ry) * 55 / 100, \
(x0) - (rx), y0); \
NPWGraphicsClosePath(pdf); \
} while (0)
Create an elliptic path.
Definition at line 42 of file NPWGraphics.h.
#define NPWInlineImageBegin |
( |
pdf, |
|
|
w, |
|
|
h, |
|
|
cs, |
|
|
bpc, |
|
|
f |
|
) |
|
Value: do { \
NPWWrite(pdf, "BI\n/W ", -1); \
NPWWriteInt(pdf, w, -1); \
NPWWrite(pdf, "\n/H ", -1); \
NPWWriteInt(pdf, h, -1); \
NPWWrite(pdf, "\n/CS ", -1); \
NPWWrite(pdf, cs, -1); \
NPWWrite(pdf, "\n/BPC ", -1); \
NPWWriteInt(pdf, bpc, -1); \
NPWWrite(pdf, "\n/F ", -1); \
NPWWrite(pdf, f, -1); \
NPWWrite(pdf, "\nID\n", -1); \
} while (0)
Begin an inline raster image (must be followed by the raster data written with NPWFilterBegin, NPWFilterWrite and NPWFilterEnd).
Definition at line 159 of file NPWGraphics.h.
Enumeration Type Documentation
Line cap type.
- Enumerator:
-
kNPWLineCapButt |
butt cap |
kNPWLineCapRound |
round cap |
kNPWLineCapSquare |
square cap |
Definition at line 119 of file NPWGraphics.h.
Line join type.
- Enumerator:
-
kNPWLineJoinMitter |
mitter join |
kNPWLineJoinRound |
round join |
kNPWLineJoinBevel |
bevel join |
Definition at line 127 of file NPWGraphics.h.
Text rendering modes.
- Enumerator:
-
kNPWTextRenderingModeFill |
fill text (normal) |
kNPWTextRenderingModeStroke |
stroke text |
kNPWTextRenderingModeFillStroke |
fill, then stroke text |
kNPWTextRenderingModeInvisible |
do nothing (invisible) |
kNPWTextRenderingModeFillClip |
fill text and add to path for clipping |
kNPWTextRenderingModeStrokeClip |
stroke text and add to path for clipping |
kNPWTextRenderingModeFillStrokeClip |
fill, then stroke text and add to path for clipping |
kNPWTextRenderingModeClip |
add text to path for clipping |
Definition at line 178 of file NPWGraphics.h.
Function Documentation
Write arguments and a command.
- Parameters:
-
| pdf | reference to NPW structure |
[in] | cmd | PDF command |
[in] | fmt | argument types (f=float, i=int, S=raw string+len, s=PDF string+len) |
- Returns:
- error code (kNPWErrOk for success)
Definition at line 21 of file NPWGraphics.c.
|
Generated by Doxygen.
Copyright 2007-2010, Yves Piguet.
All rights reserved.
|
|