PeachDrawing.Core
PeachDrawing.Core
RasterSurface Class
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.
public sealed class RasterSurface : System.IDisposable
Inheritance System.Object → RasterSurface
Implements System.IDisposable
Remarks
GridX/GridY place the surface on a pixel grid whose pitch is
PixelsPerUnitX pixels per layout unit and whose origin is the local (page) origin. Keeping
every surface on that one grid is what makes the physical size of the embedded bitmap exact (each pixel
is exactly 1/dpi inch) and lets neighbouring surfaces abut without a seam.
| Constructors | |
|---|---|
| RasterSurface(int, int, int, int, double, double) | Creates a cleared, premultiplied-RGBA8 pixel buffer of width x height pixels. |
| Properties | |
|---|---|
| Bounds | The surface’s pixel rectangle: (0, 0) to (Width, Height). |
| GridX | The surface’s left edge, in whole pixels of the grid. |
| GridY | The surface’s top edge, in whole pixels of the grid. |
| Height | The buffer’s height, in pixels. |
| LayoutRect | The surface’s rectangle in layout units (the rectangle a bitmap of it must be placed at). |
| PixelMemory | The surface’s pixels as a System.Memory<>, premultiplied RGBA8, row-major from the top-left; for a caller that cannot hold a System.Span<> (in a lambda, say). |
| Pixels | The surface’s pixels, premultiplied RGBA8, row-major from the top-left. |
| PixelsPerUnitX | Pixels per layout unit, horizontally. Equal to PixelsPerUnitY except for a tile, whose pitch is stretched by less than a pixel across its whole width so it covers its requested size exactly. |
| PixelsPerUnitY | Pixels per layout unit, vertically. |
| Stride | The number of bytes between the start of one row and the next ( * 4). |
| Width | The buffer’s width, in pixels. |
| Methods | |
|---|---|
| Clear() | Fills every pixel with transparent black. |
| Dispose() | Releases the surface’s backing pixel buffer. |
| Row(int) | The pixels of row y, as a Stride-byte slice of Pixels. |