Package limn.graphics
@NullMarked
package limn.graphics
Backend-neutral 2D drawing: the immediate-mode
Canvas every widget
paints through, the values it takes (Color,
Paint, Rect, Path2D)
and the facades for what a drawing loads and measures: Images,
Fonts, TextRulers and
Icons rasterized from SVG or bitmaps. Coordinates are logical
points and the backend supplies the pixels, so nothing here imports a graphics library.-
ClassDescriptionWhat a shape does to the pixels already behind it: a material, not a paint.The backdrop blurred along one axis.Which way one blur pass runs.A transparent pane: the backdrop is not blurred, it is refracted at the rim, the way light bends through the bevelled edge of real glass.The backdrop as a cathode-ray tube shows it: bent onto a curved face and striped by the scan.The backdrop reduced to squares: redaction, not decoration.The backdrop, undisplaced, with its saturation moved.How subsequent
Canvaspainting combines with what is already on the target.Immediate-mode 2D drawing API: what every widget paints through.Immutable straight-alpha RGBA color, channels in[0..1].A typeface selection: family name, size in logical points, and weight/style (regular / bold / italic / bold-italic).The set of font families the running backend can resolve: the bundled faces plus any enumerated from the operating system.Registers a font file the application ships, so its family becomes usable by name.Process-wide font configuration (mirrors theTextRulers/Uifacade lifecycle).The built-in GIF encoder: an animated image with every frame, each with its time, and the turns it asks for; a still image as one picture.An offscreen GPU render target owned by the backend: a texture (with its own depth buffer) that something can draw into off-screen and that the 2DCanvascan then composite as one layer viaCanvas.drawSurface(limn.graphics.GpuSurface, float, float, float, float).A themeable, resolution-independent glyph, conceptually distinct from anImage, which is just a fixed grid of RGBA pixels for display.Whether an icon turns around when the interface does.An immutable, backend-independent bitmap: RGBA8 pixels, straight (non premultiplied) alpha, row-major, row 0 at the top.Decodes encoded image bytes (PNG/JPG/…) into anImage.What an encode should produce: theImageFormat, plus the knobs a lossy format needs.Encodes anImageinto a file format.An encoded image format, named by its IANA media type: what a caller asksImages.encode(Image, ImageFormat)for and what anImageEncoderdeclares it can produce.Image loading and saving facade.Two-stop linear gradient from(x0,y0)(colorstart) to(x1,y1)(colorend), clamped beyond the endpoints.Mutable 2D path: move/line/quadratic/cubic segments and closed subpaths, in logical points.Receives the flattened (curve-free) form of a path.Receives a path as it was built: its moves, lines, curves and closes, in order and in the path's own coordinates.The toolkit's built-inImageEncoder: PNG, 8-bit RGBA with straight alpha, which isImage's pixel layout unchanged, so no channel is dropped, no value is quantized, and decoding the result yields the bytes that went in.Ear-clipping triangulation of simple (non-self-intersecting) polygons, convex or concave, any winding.Two-stop radial gradient:centercolor at(cx,cy)fading toedgecolor at distanceradius, clamped beyond it.AGpuSurfacewhose pixels can be brought back to the CPU.Immutable axis-aligned rectangle in logical points.Immutable rounded rectangle with independent corner radii, in logical points.Scene-referred pixels read back from aReadableSurface: RGBA floats, linear light, premultiplied alpha, row-major, row 0 at the top.One layer of the shadow a shape casts: the shape's own outline moved by an offset, blurred, in one colour.One line of text after shaping: the glyphs a face draws for it, where each one sits, and every geometric question a widget then asks about that line.Which side of a char index a caret sits on, and so which of the two points that index can occupy is meant.Assembles aShapedTextrun by run.The two places a caret may sit for one char index, for a caller that stores no side.Which way a paragraph reads.A caret position: where text is inserted, plus which side of that index the caret is on.One shaped stretch: a single face, a single embedding level, a single shaping call, and the unit the backend resolves a face at and batches a draw at.One horizontal box of a selection, in logical points from the left edge of the line.A themeable vectorIcon: keeps the SVG source and lazily draws it (via the installedSvgRenderer) to a cachedImageper requested pixel size (a small LRU of 16 sizes).SPI that draws SVG: opens a document from SVG text, draws it into pixels at any size, and lets an attribute of one of its elements be changed between two drawings, which is how an animated SVG is played.One SVG, opened: measured, drawn and changed until it is closed.Measured extents of a single line of text, in logical points, relative to the baseline.Measures text without a frame in flight: what widget layout uses (the layout pass runs before painting, when noCanvasexists).Process-wideTextRulerregistry, installed by the running backend (mirrors theUifacade lifecycle).