Document renderer C reference
These are private implementation contracts, not installed C APIs. Component callers use Renderer C reference; these helpers borrow export state and have backend-specific preconditions. See Document renderer primitives for linked comparisons of state, color and clipping policies. Parameter contracts distinguish borrowed geometry from document-owned resources; no callback here transfers ownership of the source image, font or mapped point array.
PDF drawing callbacks
- group PDF drawing backend
Private renderer callbacks; components use the common renderer interface.
Functions
-
static void PdfClipBegin(Rbc_RenderContext *ctx, int x, int y, int width, int height)
Save graphics state and intersect a rectangular clip.
Coordinates are mapped display pixels. Emits q/re/W/n; PdfClipEnd must balance the save. Common renderer clip-depth tracking owns pairing, not this callback.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
-
static void PdfClipEnd(Rbc_RenderContext *ctx)
Restore one rectangular clipping scope.
Emits Q only. Requires a matching begin; does not inspect or change common clip depth.
- Parameters:
ctx – [inout] Live Pdf context with a matching rectangular clip scope; common depth is not changed here.
-
static void PdfColor(Rbc_ExportContext *token, const XColor *color, int stroke)
Select DeviceRGB stroke or fill color.
Converts 16-bit XColor components to unit values. A NULL color leaves the current color unchanged; this helper does not save graphics state.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
color – [in] Optional borrowed Tk color; NULL leaves the current PDF color unchanged.
stroke – [in] Nonzero selects stroking RGB; zero selects nonstroking RGB.
-
static void PdfPath(Rbc_ExportContext *token, const Point2D *points, Tcl_Size count, int close)
Append a polygonal path without painting it.
Borrows count points in mapped pixels and optionally emits h. The caller supplies valid geometry, chooses the fill rule and owns graphics-state scope.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
close – [in] Nonzero appends a close-path operator; zero leaves the path open.
-
static void PdfRectangle(Rbc_ExportContext *token, double x, double y, double width, double height, const XColor *color)
Paint a positive-size solid rectangle in an isolated scope.
NULL color or nonpositive dimensions produce no output. Uses nonstroking RGB and restores the previous graphics state.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
color – [in] Borrowed rectangle color; NULL emits no paint.
-
static void PdfArcPath(Rbc_ExportContext *token, const Rbc_RenderArcGeometry *arc)
Append an elliptical arc using cubic Bezier pieces.
Requires normalized finite geometry with nonzero extent from the renderer dispatcher. Each piece spans at most 90 degrees. Negates angles for screen Y, closes full ellipses and chords, and adds the center for partial pieslices. Does not paint or change the transformation matrix.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
arc – [in] Borrowed normalized finite ellipse geometry with positive radii and nonzero extent.
-
static void PdfStrokeStyle(Rbc_RenderContext *ctx, int background)
Emit cached stroke color, width, cap, join and dashes.
The background pass selects the off-color and an empty dash pattern with zero offset. The foreground pass uses the bounded dash array and its offset. The caller saves/restores graphics state.
- Parameters:
ctx – [inout] Live Pdf stroke context with configured color, width and dash state.
background – [in] Nonzero emits the solid off-color pass; zero selects cached foreground dashes.
-
static void PdfPolyline(Rbc_RenderContext *ctx, const Point2D *points, Tcl_Size count)
Stroke a connected path, optionally over a solid dash background.
No foreground color or fewer than two points is a no-op. Each pass reconstructs the whole path and has its own q/Q scope; the input array remains borrowed.
- Parameters:
ctx – [inout] Live Pdf stroke context with configured color, width and dash state.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PdfSegments(Rbc_RenderContext *ctx, const Segment2D *segments, Tcl_Size count)
Stroke independent segments in their original painter order.
Each segment delegates to PdfPolyline, including its background and foreground passes, before the next segment. Does not combine the batch into one shared path.
- Parameters:
ctx – [inout] Live Pdf stroke context with configured color, width and dash state.
segments – [in] Borrowed mapped endpoint pairs readable for count Segment2D records.
count – [in] Number of geometry records, not bytes.
-
static void PdfArc(Rbc_RenderContext *ctx, const Rbc_RenderArcGeometry *arc)
Stroke normalized arc geometry with the cached line style.
No foreground color is a no-op. Rebuilds the arc for each dash-background/foreground pass and balances graphics state for each pass.
- Parameters:
ctx – [inout] Live Pdf stroke context with configured color, width and dash state.
arc – [in] Borrowed normalized finite ellipse geometry with positive radii and nonzero extent.
-
static void PdfBitmapRuns(Rbc_ExportContext *token, XImage *bits, XImage *mask, const XColor *color)
Convert set bitmap pixels into filled horizontal rectangles.
Borrows a valid XImage and optional same-sized mask. Emits runs where both images are set; NULL color produces no output. Uses the current transform and graphics scope, paints once with f, and does not release either image.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
bits – [in] Borrowed readable monochrome XImage supplying set pixels.
mask – [in] Optional borrowed same-sized XImage; only pixels set in both images are emitted.
color – [in] Borrowed paint color; omission follows this helper’s format-specific policy.
-
static int PdfPhotoResource(Rbc_ExportContext *token, const Tk_PhotoImageBlock *block)
Copy a Tk photo block into PDF RGB and optional alpha resources.
Returns an image object ID, or zero for empty/invalid input. Invalid size/storage records an export error. Requires valid Tk channel offsets and row layout. Copies RGB bytes row by row and creates an 8-bit grayscale SMask only if any alpha is nonopaque. Frees temporary DStrings; does not retain the borrowed block or pixel pointer.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
block – [in] Borrowed readable Tk photo block with valid pitch, pixel size and RGB channel offsets.
-
static void PdfImageUse(Rbc_ExportContext *token, int id, double x, double y, int width, int height)
Place an image resource using top-left display coordinates.
A zero resource ID is a no-op. Emits a locally saved matrix with negative image height to correct raster orientation, then invokes the image XObject.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
id – [in] Document-local image object ID; zero emits nothing.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Image display width in pixels.
height – [in] Image display height in pixels; negated in the placement matrix to correct raster orientation.
-
static int PdfColorImageResource(Rbc_ExportContext *token, Rbc_ColorImage image)
Adapt a packed RBC color image to the photo resource writer.
Borrows the image, checks that row pitch fits int, and describes Pix32 channel offsets without copying the source first. Resource construction copies the pixels. Returns zero and records an export error for excessive pitch; does not free the image.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
image – [in] Borrowed RBC color image with readable packed pixels; not freed by this helper.
-
static unsigned int PdfPattern(Rbc_RenderContext *ctx, const XColor *foreground)
Create or reuse this fill context’s colored tiling pattern.
Uses a borrowed tile for backgroundOnly fills, otherwise a stipple bitmap. Tile photos use their pixel block; other Tk images use raster capture. Stipples become bitmap runs over an optional background. Restores token->buffer after constructing temporary pattern content and releases temporary images. The pattern matrix includes page scale/Y reversal; tile origin also accounts for graph ancestry. Caches the resource ID until the tile setter invalidates it. Zero means no pattern; the enclosing export error remains authoritative.
- Parameters:
ctx – [inout] Live Pdf fill context with initialized fillStyle and any required graph/tile resources.
foreground – [in] Borrowed resolved pattern foreground color; not retained by the emitter.
-
static int PdfFillStyle(Rbc_RenderContext *ctx)
Prepare nonstroking opacity and solid or patterned fill state.
Returns false for nonpositive opacity, missing solid color or unavailable pattern. Opacity below one uses an ExtGState ca resource. Pattern creation precedes path construction so resource emission cannot consume the drawing path. The caller provides a q/Q scope; this helper is not a Tcl status API.
- Parameters:
ctx – [inout] Live Pdf fill context with initialized fillStyle and any required graph/tile resources.
-
static void PdfFillPolygon(Rbc_RenderContext *ctx, const Point2D *points, Tcl_Size count)
Fill a closed polygon with the even-odd rule.
Establishes fill resources before appending borrowed geometry. Always balances its local graphics save, including when the style produces no fill.
- Parameters:
ctx – [inout] Live Pdf fill context with initialized fillStyle and any required graph/tile resources.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PdfFillRectangles(Rbc_RenderContext *ctx, const Rbc_RenderRectangle *rectangles, Tcl_Size count)
Fill each supplied rectangle in a separate graphics scope.
Uses the cached fill style, with shared pattern resource reuse across the batch. Geometry is already mapped; no outline or clipping calculation is performed here.
- Parameters:
ctx – [inout] Live Pdf fill context with initialized fillStyle and any required graph/tile resources.
rectangles – [in] Borrowed mapped rectangle array readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PdfFillArc(Rbc_RenderContext *ctx, const Rbc_RenderArcGeometry *arc)
Fill normalized ellipse, chord or sector geometry.
Prepares fill state before constructing the path and uses even-odd fill. The caller selects a fillable arc style; the helper balances graphics state even if filling is disabled.
- Parameters:
ctx – [inout] Live Pdf fill context with initialized fillStyle and any required graph/tile resources.
arc – [in] Borrowed normalized closed ellipse segment; common dispatch excludes open arcs.
-
static void PdfText(Rbc_RenderContext *ctx, char *string, TextStyle *style, double x, double y)
Emit anchored, rotated text using document-local font resources.
Owns and frees a temporary TextLayout. Resolves glyphs before output to widen zero-width Tk measurements when a fallback has positive advance, then recomputes justification. Emits shadow before foreground, selecting active color when requested. Each glyph uses Tk prefix advance plus fallback corrections; genuine zero-width glyphs retain their position. Font/width errors are recorded on the export; this void emitter does not return a completed-document status.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
string – [in] Borrowed NUL-terminated Tcl UTF text consumed during the call.
style – [in] Borrowed text style with live font/color resources; layout and placement follow its fields.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PdfPhoto(Rbc_RenderContext *ctx, Tk_PhotoHandle photo, double x, double y)
Read a borrowed Tk photo and place its copied PDF resource.
A missing/unreadable photo records an export error. Does not destroy the photo or retain its pixel block.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
photo – [in] Borrowed Tk photo handle, read synchronously.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PdfTkImage(Rbc_RenderContext *ctx, Tk_Image image, double x, double y)
Rasterize a non-photo Tk image and emit its PDF resource.
Owns the capture returned by Rbc_RenderExportRasterImage and frees it after resource creation. A NULL capture emits no image; consult the export error for failed captures.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
image – [in] Borrowed live Tk image; no ownership transfer.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PdfWindow(Rbc_RenderContext *ctx, Tk_Window window, double x, double y)
Capture a mapped window at its current screen dimensions.
Unmapped or empty windows are omitted. Owns and frees the captured color image; capture failure records an export error. The caller decides whether window export is enabled. This captures pixels, not a reconstructed widget or new clipping container.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
window – [in] Borrowed live Tk window; capture does not create or resize it.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PdfBitmapMask(Rbc_RenderContext *ctx, Display *display, Pixmap bitmap, double x, double y, int width, int height, const XColor *color, int background)
Paint a positioned one-bit mask as vector rectangles.
Missing bitmap/color or nonpositive dimensions are ignored. Acquires and destroys an XImage; failure records an export error. The background selector is unused because the explicit color determines painting. Translation is confined to a q/Q scope.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
display – [in] Borrowed display owning the source bitmap.
bitmap – [in] Borrowed one-bit pixmap readable over width by height pixels; None suppresses output.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Source bitmap width and mapped extent in pixels; nonpositive values emit nothing.
height – [in] Source bitmap height and mapped extent in pixels; nonpositive values emit nothing.
color – [in] Borrowed paint color; omission follows this helper’s format-specific policy.
background – [in] Unused pass selector; the caller supplies the paint color explicitly.
-
static void PdfBackgroundPolygon(Rbc_RenderContext *ctx, const XColor *color, const Point2D *points, Tcl_Size count)
Paint a solid even-odd background polygon.
NULL color is a no-op. Borrows mapped points and isolates the RGB fill in a saved graphics scope.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
color – [in] Borrowed background color; NULL emits no paint.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PdfPolygon(Rbc_ExportContext *token, const Point2D *points, Tcl_Size count, const XColor *color, double opacity)
Adapt border polygon output to a temporary export state.
Creates a stack-local state borrowing the token and delegates to PdfBackgroundPolygon. The opacity parameter is currently ignored; border callers pass opaque color.
- Parameters:
token – [inout] Borrowed initialized export document; output and resource/error state may be updated.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
color – [in] Borrowed paint color; omission follows this helper’s format-specific policy.
opacity – [in] Unused; this border adapter always delegates opaque painting.
-
static void PdfBorder(Rbc_RenderContext *ctx, Tk_3DBorder border, double x, double y, int width, int height, int borderWidth, int relief, int fill)
Approximate Tk relief using solid rectangles and a polygon.
Obtains border colors after forcing lazy light-GC allocation. Optionally fills the interior, then emits raised/sunken/solid edges; groove and ridge recurse into two half-width borders. Flat, nonpositive or undersized borders omit the edges. Borrows the Tk border; does not allocate replacement colors.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
border – [in] Borrowed Tk 3D border; lazy shadow-color initialization may occur.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
borderWidth – [in] Relief thickness in display pixels; caller keeps size arithmetic representable.
relief – [in] Tk relief constant.
fill – [in] Nonzero paints the interior before relief; zero requests edges only.
-
static void PdfClearRectangle(Rbc_RenderContext *ctx, double x, double y, int width, int height)
Paint an opaque white rectangle.
Clearing document output means white paint, not erasing to transparency. Nonpositive dimensions are ignored by PdfRectangle.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
-
static void PdfBackgroundRectangles(Rbc_RenderContext *ctx, const XColor *color, const Rbc_RenderRectangle *rectangles, Tcl_Size count)
Paint background rectangles in order.
NULL color selects opaque white; otherwise uses the supplied RGB color. Borrows the batch and does not retain geometry.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
color – [in] Optional borrowed background color; NULL paints using the format clear-background policy.
rectangles – [in] Borrowed mapped rectangle array readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PdfPlotBegin(Rbc_RenderContext *ctx, Tk_Font font, double x, double y, int width, int height, const XColor *background)
Paint the plot background and open its clipping scope.
NULL background selects white. Ignores the font argument because text resolves its own resources. Emits q/re/W/n after painting; PdfPlotEnd balances this separate plot scope.
- Parameters:
ctx – [inout] Live Pdf renderer context borrowing the active export document.
font – [in] Unused by this backend; retained for the common plot-operation signature.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
background – [in] Borrowed plot background color; NULL selects the format’s clear-background policy.
-
static void PdfPlotEnd(Rbc_RenderContext *ctx)
Close the saved plot clipping scope.
Requires a matching PdfPlotBegin. This Q is separate from common renderer clip-depth unwinding.
- Parameters:
ctx – [inout] Live Pdf context with a matching plot scope; common depth is not changed here.
-
static void PdfSymbolPoints(Rbc_RenderContext *ctx, const Point2D *centers, Tcl_Size count)
Paint symbol centers with legacy size corrections and painter order.
Bar samples delegate to rectangle fills. Bitmap symbols acquire their source/mask once per batch, require matching mask dimensions when used, and release both XImages on completion or failure. Each center has a local transform; bitmap aspect ratio is preserved. Geometric symbols fill before outlining, skinny symbols only stroke, and cross variants rotate the plus geometry. Borrows style colors and handles throughout the call.
- Parameters:
ctx – [inout] Live Pdf symbol context with selected symbol style and document resources.
centers – [in] Borrowed mapped symbol centers readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PdfClipBegin(Rbc_RenderContext *ctx, int x, int y, int width, int height)
PostScript drawing callbacks
- group PostScript drawing backend
Private renderer callbacks; components use the common renderer interface.
Functions
-
static void PostScriptClipBegin(Rbc_RenderContext *ctx, int x, int y, int width, int height)
Open a saved rectangular PostScript clip.
Emits gsave and a closed path followed by clip/newpath. Common renderer depth tracking owns pairing; PostScriptClipEnd closes this scope.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
-
static void PostScriptClipEnd(Rbc_RenderContext *ctx)
Restore one rectangular PostScript clipping scope.
Emits grestore without changing common clip depth. Requires a matching begin.
- Parameters:
ctx – [inout] Live Postscript context with a matching rectangular clip scope; common depth is not changed here.
-
static void PostScriptPolyline(Rbc_RenderContext *ctx, const Point2D *points, Tcl_Size count)
Stroke a connected path in bounded PostScript batches.
Fewer than two points is a no-op. Splits at 1500 path components and restarts at the shared vertex. Invokes the current DashesProc before each foreground stroke; caller ordering must preserve that document-level definition.
- Parameters:
ctx – [inout] Live Postscript stroke context with configured color, width and dash state.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptSegments(Rbc_RenderContext *ctx, const Segment2D *segments, Tcl_Size count)
Delegate an independent segment batch to the legacy token.
Positive counts pass borrowed mapped geometry to Rbc_2DSegmentsToPostScript. Does not own points or establish a new line style.
- Parameters:
ctx – [inout] Live Postscript stroke context with configured color, width and dash state.
segments – [in] Borrowed mapped endpoint pairs readable for count Segment2D records.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptLineStyle(Rbc_RenderContext *ctx, int capStyle, int joinStyle)
Emit cap and join settings immediately.
Delegates to the legacy token conversion functions. Unlike PDF/SVG setters, this mutates the output graphics state rather than a cached style record.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
capStyle – [in] X/Tk line cap constant passed to the PostScript conversion helper.
joinStyle – [in] X/Tk line join constant passed to the PostScript conversion helper.
-
static void PostScriptDashBackground(Rbc_RenderContext *ctx, const XColor *color)
Define the document’s dash-background procedure.
For a dashed stroke with a color, defines DashesProc to paint an undashed background inside gsave/grestore. Otherwise defines an empty procedure. Dictionary definitions are not scoped by gsave: emit a batch before another context changes this definition.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
color – [in] Optional borrowed off-dash color; NULL installs an empty dash-background procedure.
-
static void PostScriptFillPath(Rbc_RenderContext *ctx)
Paint the current path using legacy fill and stipple helpers.
Paints an optional background via the prolog Fill procedure, then selects foreground. backgroundOnly returns after that selection. Otherwise paints stipple or solid fill. Borrows graph/display and style resources; does not apply fill opacity or image tiles.
- Parameters:
ctx – [inout] Live Postscript fill context with initialized fillStyle and any required graph/tile resources.
-
static void PostScriptFillPolygon(Rbc_RenderContext *ctx, const Point2D *points, Tcl_Size count)
Close and fill a supplied polygonal path.
Delegates path creation to the legacy token and fill policy to PostScriptFillPath. The caller supplies valid mapped geometry and retains its storage.
- Parameters:
ctx – [inout] Live Postscript fill context with initialized fillStyle and any required graph/tile resources.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptArcPath(Rbc_RenderContext *ctx, const Rbc_RenderArcGeometry *arc)
Build an elliptical arc while restoring display-space line units.
Requires normalized nonzero arc geometry. Saves the current matrix on the operand stack, constructs a scaled unit-circle arc, then restores the matrix without losing the path. Negated angles preserve screen-space orientation. Closes full ellipses/chords and joins partial pieslices to the center.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
arc – [in] Borrowed normalized finite ellipse geometry with positive radii and nonzero extent.
-
static void PostScriptArc(Rbc_RenderContext *ctx, const Rbc_RenderArcGeometry *arc)
Stroke an arc with the current dash-background procedure.
Builds the path and invokes DashesProc before stroke. Does not independently establish line style.
- Parameters:
ctx – [inout] Live Postscript stroke context with configured color, width and dash state.
arc – [in] Borrowed normalized finite ellipse geometry with positive radii and nonzero extent.
-
static void PostScriptFillArc(Rbc_RenderContext *ctx, const Rbc_RenderArcGeometry *arc)
Fill an arc with the legacy fill policy.
Builds normalized geometry then delegates to PostScriptFillPath; does not emit an outline.
- Parameters:
ctx – [inout] Live Postscript fill context with initialized fillStyle and any required graph/tile resources.
arc – [in] Borrowed normalized closed ellipse segment; common dispatch excludes open arcs.
-
static void PostScriptFillRectangles(Rbc_RenderContext *ctx, const Rbc_RenderRectangle *rectangles, Tcl_Size count)
Paint mapped rectangles using legacy solid/stipple behavior.
Stipple fills paint optional background then foreground, falling back to background color when foreground is absent. Solid rectangles require foreground. This path does not implement image tiles or opacity, and does not share every polygon backgroundOnly rule.
- Parameters:
ctx – [inout] Live Postscript fill context with initialized fillStyle and any required graph/tile resources.
rectangles – [in] Borrowed mapped rectangle array readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptSymbolPoints(Rbc_RenderContext *ctx, const Point2D *centers, Tcl_Size count)
Emit centers using the context’s configured prolog macro.
Requires symbol setup to have selected a valid macro and size and defined DrawSymbolProc. Emits centers in order without retaining them or redefining the procedure.
- Parameters:
ctx – [inout] Live Postscript symbol context with selected symbol style and document resources.
centers – [in] Borrowed mapped symbol centers readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptText(Rbc_RenderContext *ctx, char *string, TextStyle *style, double x, double y)
Delegate mapped text to the legacy PostScript text writer.
Borrows the string and TextStyle. Uses token font/color maps and legacy encoding, not the PDF/SVG document font pipeline.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
string – [in] Borrowed NUL-terminated Tcl UTF text consumed during the call.
style – [in] Borrowed text style with live font/color resources; layout and placement follow its fields.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PostScriptTkImage(Rbc_RenderContext *ctx, Tk_Image image, double x, double y)
Retain the legacy omission of non-photo Tk images.
Intentionally emits nothing. Photo markers use PostScriptPhoto; generic Tk-image raster capture is not attempted here.
- Parameters:
ctx – [inout] Unused; generic Tk images are intentionally omitted by this legacy callback.
image – [in] Unused; generic Tk images are intentionally omitted by this legacy callback.
x – [in] Unused; generic Tk images are intentionally omitted by this legacy callback.
y – [in] Unused; generic Tk images are intentionally omitted by this legacy callback.
-
static void PostScriptPhoto(Rbc_RenderContext *ctx, Tk_PhotoHandle photo, double x, double y)
Delegate a non-NULL photo to the legacy image writer.
Borrows the handle and emits at the supplied mapped origin. NULL is a no-op; does not use the PDF alpha-resource path.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
photo – [in] Borrowed Tk photo handle, read synchronously.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PostScriptWindow(Rbc_RenderContext *ctx, Tk_Window tkwin, double x, double y)
Delegate window capture to the legacy PostScript writer.
Borrows the live window. Capture behavior and errors belong to Rbc_WindowToPostScript; this adapter does not introduce a clipping container.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
tkwin – [in] Borrowed live Tk window passed to the legacy capture writer.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
-
static void PostScriptBackgroundPolygon(Rbc_RenderContext *ctx, const XColor *color, const Point2D *points, Tcl_Size count)
Select background color and emit a filled polygon.
Uses the token’s background/color-map policy and borrows the mapped point array. Does not establish an independent saved graphics scope.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
color – [in] Borrowed background color interpreted by the legacy PostScript color-map policy.
points – [in] Borrowed mapped point array readable for count vertices.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptBorder(Rbc_RenderContext *ctx, Tk_3DBorder border, double x, double y, int width, int height, int borderWidth, int relief, int fill)
Dispatch filled or outline-only Tk relief output.
Borrows the border and delegates to the matching legacy 3D rectangle helper. Geometry and relief are already selected by the component.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
border – [in] Borrowed Tk 3D border; lazy shadow-color initialization may occur.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
borderWidth – [in] Relief thickness in display pixels; caller keeps size arithmetic representable.
relief – [in] Tk relief constant.
fill – [in] Nonzero paints the interior before relief; zero requests edges only.
-
static void PostScriptClearRectangle(Rbc_RenderContext *ctx, double x, double y, int width, int height)
Paint a rectangle using the token’s clear-background policy.
Clearing emits paint through legacy helpers; it does not remove prior document content.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
-
static void PostScriptBackgroundRectangles(Rbc_RenderContext *ctx, const XColor *color, const Rbc_RenderRectangle *rectangles, Tcl_Size count)
Select one background and paint a rectangle batch.
NULL color uses the clear-background policy. Otherwise selects background once, then emits all borrowed rectangles in order.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
color – [in] Optional borrowed background color; NULL paints using the format clear-background policy.
rectangles – [in] Borrowed mapped rectangle array readable for count entries.
count – [in] Number of geometry records, not bytes.
-
static void PostScriptPlotBegin(Rbc_RenderContext *ctx, Tk_Font font, double x, double y, int width, int height, const XColor *background)
Paint plot background and open its saved clipping scope.
Selects the supplied font, constructs the region and paints via prolog Fill before gsave/clip. NULL background uses the token’s clear policy. PostScriptPlotEnd balances this plot scope.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
font – [in] Borrowed Tk font for plot setup.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Mapped rectangle width in display pixels.
height – [in] Mapped rectangle height in display pixels.
background – [in] Borrowed plot background color; NULL selects the format’s clear-background policy.
-
static void PostScriptPlotEnd(Rbc_RenderContext *ctx)
Close the saved plot clipping scope.
Emits grestore separately from the common renderer’s explicit clip-depth mechanism. Requires a matching plot begin.
- Parameters:
ctx – [inout] Live Postscript context with a matching plot scope; common depth is not changed here.
-
static void PostScriptBitmapMask(Rbc_RenderContext *ctx, Display *display, Pixmap bitmap, double x, double y, int width, int height, const XColor *color, int background)
Emit a translated and Y-corrected imagemask.
Missing bitmap or nonpositive dimensions produce no output. Selects foreground/background according to the flag, emits bitmap bytes through the legacy helper and balances gsave/grestore. Borrows display, pixmap and color.
- Parameters:
ctx – [inout] Live Postscript renderer context borrowing the active export document.
display – [in] Borrowed display owning the source bitmap.
bitmap – [in] Borrowed one-bit pixmap readable over width by height pixels; None suppresses output.
x – [in] Mapped destination X coordinate in display pixels.
y – [in] Mapped destination Y coordinate in display pixels.
width – [in] Source bitmap width and mapped extent in pixels; nonpositive values emit nothing.
height – [in] Source bitmap height and mapped extent in pixels; nonpositive values emit nothing.
color – [in] Borrowed paint color; omission follows this helper’s format-specific policy.
background – [in] Nonzero selects the legacy background-color policy; zero selects foreground.
-
static void PostScriptClipBegin(Rbc_RenderContext *ctx, int x, int y, int width, int height)
Context storage
-
struct Rbc_RenderExportState
Shared document-renderer prefix and copied paint state.
The core must be first so backend callbacks can downcast. Styles are shallow copies: colors, bitmaps and tiles remain borrowed unless stored as XColor values. Pattern IDs belong to the document builder, not this context.
Public Members
-
Rbc_RenderContext core
Common dispatch prefix; must remain first.
-
Rbc_ExportContext *exportPtr
Borrowed document builder; outlives this context.
-
Rbc_RenderFillStyle fillStyle
Copied fill policy with borrowed Tk resources.
-
double symbolSize
Backend-adjusted symbol size in mapped display units.
-
int vectorHasColor
Nonzero when vectorColor is present.
-
int vectorHasOffColor
Nonzero when vectorOffColor is present.
-
int vectorWidth
Stroke width in display pixels.
-
int vectorCap
X cap-style selector.
-
int vectorJoin
X join-style selector.
-
Rbc_Dashes vectorDashes
Copied dash lengths and offset.
-
Rbc_RenderSymbolStyle vectorSymbol
Copied export symbol policy with borrowed bitmap and color resources.
-
int vectorBarSymbol
Nonzero selects the bar-legend square convention.
-
unsigned int vectorPatternId
Document-owned pattern identifier; the context does not free the definition.
-
Rbc_Tile vectorTile
Borrowed tile used by SVG/PDF fills.
-
Rbc_RenderContext core
-
struct PostscriptRenderContext
PostScript context borrowing the token and prolog; does not own document output.
Public Members
-
Rbc_RenderExportState exportState
Shared document prefix; must remain first.
-
PsToken psToken
Borrowed PostScript token used for legacy primitive emission.
-
int postScriptDashed
Nonzero when the current stroke has a dash pattern.
-
const char *symbolMacro
Borrowed static prolog macro name selected for symbol emission.
-
Rbc_RenderExportState exportState