PeachDrawing.Core
PeachDrawing.Core Namespace
| Classes | |
|---|---|
| BlurEffect | Blurs the layer with a Gaussian of the given standard deviations. |
| Brush | A fill or stroke paint source - a closed set of plain-data shapes (a solid colour and three gradient kinds) any Canvas backend can interpret without knowing which other backend built the instance. This is the same discriminated-union shape CssImage (Html/Core/Entities/CssImage.cs) already uses for background/gradient/list-marker images - see CssImagePainter.Paint’s type-dispatch for the precedent. A concrete Canvas (GraphicsAdapter, RasterCanvas) pattern-matches on the concrete subtype to build whatever native paint representation it needs; nothing here names a PDF- or raster-specific type. |
| Canvas | Adapter for platform specific graphics rendering object - used to render graphics and text in platform specific context. The core HTML Renderer components use this class for rendering logic, extending this class in different platform: WinForms, WPF, Metro, PDF, etc. |
| CanvasLayer | An isolated group of drawing begun with BeginLayer(LayerOptions): draw onto Canvas, in the same coordinates as the canvas that began the layer, and disposing the layer composites everything drawn as one piece onto that canvas. |
| CanvasParagraphExtensions | Draws text that PeachDrawing.Text has already shaped and laid out onto any Canvas, so the positions a ParagraphLayout reports are the positions the text is painted at. Everything is in the canvas’s user units, the units DrawRectangle(Brush, double, double, double, double) takes; layout sizes are read in the same units, so a paragraph laid out at 16 draws 16 user units tall on a canvas whose PixelsPerPoint is 1. |
| ColorMatrixEffect | Transforms the layer’s colours. |
| ConicGradientBrush | A gradient that varies with angle around Center. Conic gradients have no repeating form in this codebase today (CSS repeating-conic-gradient() is not yet supported - see the accepted-gaps notes), so there is no GradientSpread here. |
| CurveContour | One subpath of a GraphicsPath with its curves intact - the counterpart of PathContour, which is the same subpath already reduced to a polyline. Read it with GetCurveContours(). |
| DropShadowEffect | Draws a blurred, offset, single-colour copy of the layer’s shape underneath it. |
| EllipticalArc | Converts an SVG-style endpoint-parameterized elliptical arc (the shape of a path’s own A command, and of AddArc(double, double, double, double, double, bool, bool)) to the center parameterization every ellipse point/tangent computation actually needs, per the standard algorithm (SVG 1.1 Appendix F.6.5, “Conversion from endpoint to center parameterization” - the same construction every SVG-conformant renderer uses, not something specific to this codebase). |
| Font | Adapter for platform specific font object - used to render text using specific font. |
| FontFamily | Adapter for platform specific font family object - define the available font families to use. Required for custom fonts handling: fonts that are not installed on the system. |
| FontPalette | A fully-resolved CSS font-palette selection carried alongside the text color into the graphics adapter. The light/dark keywords, @font-palette-values base-palette, and palette-mix() are all resolved to a concrete BasePaletteIndex (+ per-entry Overrides) on the CSS side, so the PDF backend only looks up an index and applies overrides. A nullFontPalette means the default (palette 0, no overrides) — the unchanged path. |
| GraphicsPath | Adapter for platform specific graphics path object - used to render (draw/fill) path shape. |
| HatchBrush | A paint of evenly spaced lines in one colour over a background colour, like the hatching on a map. |
| Image | Adapter for platform specific image object - used to render images. |
| InkCrossings | Finds where a run of text puts ink inside a horizontal band, so a line drawn through that band (an underline, say) can be broken around the letters. This is what GetInkCrossings(string, Font, PaintPoint, double, double, double, Nullable<ShapeSettings>) answers for a canvas that has the glyph outlines. |
| LayerEffect | An effect applied to a finished layer. All distances are in the units of the canvas that began the layer. |
| LinearGradientBrush | A gradient that varies along the line from Start to End (both in the same user-space coordinates the brush is painted in). |
| Matrix3x2Extensions | The two composition helpers the former RMatrix type had that System.Numerics.Matrix3x2 does not: a named “apply this first” alias for value1 * value2 (the same row-vector convention System.Numerics.Matrix3x2’s own operator * already uses - a.Then(b) and a * b compute identical results), and re-basing a transform’s fixed point without touching its linear part. TryInvert(this Matrix3x2, Matrix3x2) is a from-scratch reimplementation, not a thin wrapper over System.Numerics.Matrix3x2.Invert(System.Numerics.Matrix3x2,System.Numerics.Matrix3x2@): the BCL method’s own near-singular guard (MathF.Abs(det) < float.Epsilon) does not reject a NaN determinant (a NaN comparison is always false, so the guard is skipped and the division silently produces a NaN matrix instead of failing), which the CSS matrix()/transform pipeline relies on failing cleanly for. |
| PathContour | One flattened subpath: the polyline Flatten(double) reduced a contour to, and whether that contour was explicitly closed (CloseFigure()) - an open subpath gets caps where a closed one gets a join, so a stroker needs this distinction, not just the points. |
| PathText | Text set along a path: each glyph is placed at its own distance along the path and turned to follow it, using the shaper’s glyphs and advances, so ligatures, kerning and other shaping survive. |
| Pen | A stroke style - used to draw graphics (lines, rectangles and paths). Plain, self-describing data (not a backend-owned handle): any Canvas backend reads a pen’s properties directly to build whatever native stroke representation it needs, the same way Brush’s subtypes work. GetPen(PaintColor)/GetPen(Brush) are the only places one is constructed. |
| PixelMath | Integer pixel arithmetic shared by every raster consumer of PixelBuffer and RasterSurface. |
| RadialGradientBrush | A gradient that varies with distance from Center/Focus out to an ellipse of radius (RadiusX, RadiusY). |
| RasterRegion | A pixel surface handed out by BeginRasterSurface(Rect, Nullable<double>): paint into Graphics, post-process Surface if needed, then give the surface back to the canvas that produced it with DrawRaster(RasterSurface). Disposing releases the graphics and the pixel buffer. |
| RasterSurface | A premultiplied RGBA8 pixel buffer together with where it sits in the coordinate space of the graphics that created it. Pixel (0, 0) is the top-left; row-major, four bytes per pixel in R, G, B, A order. |
| RenderContext | Platform adapter to bridge platform specific objects to HTML Renderer core library. Core uses abstract renderer objects (RenderContext/RControl/REtc...) to access platform specific functionality, the concrete platforms implements those objects to provide concrete platform implementation. Those allowing the core library to be platform agnostic. Platforms: WinForms, WPF, Metro, PDF renders, etc. Objects: UI elements(Controls), Graphics(Render context), Colors, Brushes, Pens, Fonts, Images, Clipboard, etc. |
| RNetworkResponse | The result of resolving a resource URI via GetResourceStream(RUri). |
| RUri | Wraps System.Uri for use throughout resource loading, adding special-case handling for data: URIs and helpers for resolving a relative URI against a base URI. |
| SolidBrush | A single fill colour. |
| TextMeasurement | Measures a run of text against a Typeface at a size - the one measurement algorithm every backend’s own MeasureString(string, Font, Nullable<ShapeSettings>) needs, so it lives here once rather than once per backend. Line breaks split the run; each line is shaped as one run (so GSUB ligatures merge the way painting’s own shaping does) and its glyph advances (GPOS kerning included) summed. |
| TileBrush | A paint that repeats a small picture, the <em>tile</em>, across the whole plane: the picture is laid out in a grid of cells and each cell shows it once. A shape filled or stroked with it shows whatever part of the grid lies under it, so adjacent shapes filled with the same brush continue the same pattern. |
| TypefaceFont | A Font built directly from a Typeface and a size, with no backend-specific wrapper (a PDF font resource, a platform font handle, ...) underneath - every member below reads only Typeface/TypefaceMetrics data, scaled by Size. This is what a Canvas backend with no host-specific font representation of its own (a standalone raster canvas; any future backend in the same position) uses directly, and it is also the shape every backend’s own metric computation reduces to once its host-specific extras (PDF font-resource identity, a platform handle, ...) are set aside. |
| Structs | |
|---|---|
| ColorMatrix | The same shape as SVG’s feColorMatrix type="matrix" (SVG Filter Effects §15.17) and CSS Filter Effects’ color-altering filter functions (grayscale(), sepia(), saturate(), hue-rotate(), invert(), brightness(), contrast()): an affine map [R' G' B' A'] = Linear · [R G B A] + Offset over premultiplied-free RGBA components in [0, 1]. |
| EllipticalArcCenter | The center parameterization of an AddArc(double, double, double, double, double, bool, bool)-style endpoint-parameterized elliptical arc - StartAngle/EndAngle are in the ellipse’s own (rotated) local parameter space, so a caller samples a point at angle t as (CenterX + RadiusX*cos(t)*cos(RotationRadians) - RadiusY*sin(t)*sin(RotationRadians), CenterY + RadiusX*cos(t)*sin(RotationRadians) + RadiusY*sin(t)*cos(RotationRadians)). |
| FontFaceDescriptors | What an @font-face rule declares about the face it registers, in place of what the font file says about itself: the weights, widths and oblique angles it covers (CSS Fonts 4 section 4.4, where each descriptor is a value or a range) and whether it is italic. A null member says nothing, so the file is asked, and a variable font then covers the range of its own axes. |
| GlyphPlacement | One glyph, addressed directly by its font glyph index (not a Unicode character) and placed at an explicit position - see DrawGlyphs(IReadOnlyList<GlyphPlacement>, Font, PaintColor). |
| GradientStop | One colour/position pair in a gradient’s stop list. |
| InkSpan | One horizontal range of a text run in which glyph ink crosses a band — what GetInkCrossings(string, Font, PaintPoint, double, double, double, Nullable<ShapeSettings>) reports, and what text-decoration-skip-ink ([CSS Text |
| Decoration 4 §2.5](https://www.w3.org/TR/css-text-decor-4/#text-decoration-skip-ink-property ‘https://www.w3.org/TR/css-text-decor-4/#text-decoration-skip-ink-property’)) subtracts from an underline or overline. | |
| IntRect | An integer pixel rectangle; the right and bottom edges are exclusive. |
| LayerOptions | How a layer is composited onto the canvas that began it. |
| PaintColor | Represents an ARGB (alpha, red, green, blue) color. |
| PaintPoint | Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimensional plane. |
| ParagraphPaint | How one run of a paragraph is painted: what a layout, which knows only about faces, sizes and positions, leaves to the caller. |
| PathCommand | One drawing step of a CurveContour: a straight line or a cubic Bézier from the previous point (the contour’s Start for the first step) to End. Elliptical arcs never appear as their own kind: GraphicsPath records every arc as the cubic Béziers that approximate it. |
| PathGlyph | One glyph placed on a path. |
| PathTextOptions | How Layout(Typeface, double, string, PathMeasure, PathTextOptions) places text on a path. |
| PixelBuffer | A decoded image’s pixels, tightly packed premultiplied RGBA8 (Width * Height * 4 bytes, row-major, no padding) - what GetPixels() hands any Canvas backend that needs to sample an image’s actual pixels (the raster backend; a third party’s own backend), without that backend needing to know which concrete Image decoded them. |
| Rect | Stores a set of four floating-point numbers that represent the location and size of a rectangle. |
| Size | Stores an ordered pair of floating-point numbers, typically the width and height of a rectangle. |
| Interfaces | |
|---|---|
| ISvgGlyphPainter | Draws the SVG document a font gives for a glyph (OpenType SVG) into the graphics it is set on. A text-painting backend knows how to place a glyph but not how to render SVG, which needs a real SVG engine (for example an SVG renderer the host supplies) it may not have - this is the seam between the two, obtained through CreateSvgGlyphPainter(Canvas) so a backend with no SVG engine (a standalone raster canvas) can supply none. |
| Enums | |
|---|---|
| DashStyle | Specifies the style of dashed lines drawn with a Pen object. |
| FillMode | Specifies how the interior of a (possibly self-intersecting) path is determined for filling. |
| GradientSpread | Whether a gradient’s stop list covers [0, 1] once (Pad, CSS’s default) or repeats past its own extent (Repeat, CSS repeating-*-gradient()). |
| GraphicsPath.Corner | The 4 corners that are handled in arc rendering. |
| HatchStyle | The line pattern of a HatchBrush. |
| ImageSampling | How the pixels of an image are read when it is drawn at a size other than its own. |
| LineCap | Specifies how the ends of an unclosed subpath are drawn, matching SVG’s stroke-linecap values. |
| LineJoin | Specifies how consecutive stroked segments are joined, matching SVG’s stroke-linejoin values. |
| PaintBlendMode | A PDF separable/non-separable blend mode (PDF 32000-1 §11.3.5), used with PushBlendMode(PaintBlendMode)/PopBlendMode() to composite subsequent drawing against whatever is already painted underneath it. |
| PaintFontStyle | Specifies style information applied to text. |
| PathCommandKind | What a PathCommand draws from the previous point to its End. |
| PathTextAnchor | Which part of the text is placed at StartOffset. |
| PathTextSide | Which side of a path the text sits on. |
| TextDecorations | The lines drawn along a run of text. |
| TextHinting | Whether text drawn into a bitmap is fitted to the bitmap’s pixel grid by the font’s own hinting, which makes small text sharper. |