PeachDrawing.Core
PeachDrawing.Core
Image Class
Adapter for platform specific image object - used to render images.
public abstract class Image : System.IDisposable
Inheritance System.Object → Image
Implements System.IDisposable
| Properties | |
|---|---|
| CurrentFrame | The frame a canvas draws, from 0 to FrameCount - 1. Whoever plays the animation (see PeachBrackets.HtmlDocument.AdvanceAnimations) sets it, and every use of the image shows the same frame. Always 0 for a still image, and setting it there does nothing. |
| ExifOrientation | The Exif Orientation (1 to 8, 1 = upright) stored with the image, which its decoded pixels do not apply: the consumer applies it when the document asks for it (CSS image-orientation: from-image). 1 for an image that carries none or is not a decoded raster. |
| FrameCount | How many frames the image has: 1 for a still image, more for an animated one (an animated GIF, WebP or PNG). A canvas that shows animation draws CurrentFrame; one that does not draws the first frame. |
| Height | Get the height, in pixels, of the image. |
| Interpolate | Whether the PDF viewer should smooth this image when it’s drawn at a size other than its native pixel dimensions. Defaults to true (the common case: photos/gradients look better smoothed when scaled). A repeating background-image tile - see Html.Core.Handlers.BackgroundImageDrawHandler - sets this to false while painting: a tiled pattern is drawn many times edge-to-edge, and any softened/blurred edge (from interpolation) leaves visible seams between tiles/layers instead of a crisp, contiguous pattern - most visibly, two intentionally-offset transparent tiles meant to interlock into one solid color (Acid2’s own checkerboard-interlock background trick) never resolve to solid at any rasterization DPI above the image’s tiny native size, since blurred edges from two independently-smoothed layers don’t cancel out the way crisp, hard pixel edges would. |
| LoopCount | How many times an animated image plays through before it stops on its last frame; 0 means forever. 1 for a still image. |
| ResolutionDpiX | The horizontal pixel density the image’s file records, in pixels per inch, or null when it records none, the format has no field for it, or the image is not a decoded raster. Consumed by CSS image-resolution: from-image. |
| ResolutionDpiY | The vertical pixel density the image’s file records, in pixels per inch; see ResolutionDpiX. |
| Width | Get the width, in pixels, of the image. |
| Methods | |
|---|---|
| Dispose() | Releases any native resource this image owns. |
| GetFrameDuration(int) | How long frame index is shown before the next one, or System.TimeSpan.Zero for a still image. |
| GetPixels() | This image’s decoded pixels, or null when it has none to decode (a vector Form XObject tile - see PdfCanvas.CreateTile - has no raster content at all). Lets any Canvas backend sample an image’s actual pixels without knowing which concrete Image decoded them - the backend-agnostic replacement for downcasting to a specific concrete image type and reading its native decoded form directly. |