Table of Contents

Class Document

Namespace
PaintDotNet
Assembly
PaintDotNet.Data.dll
public sealed class Document : IIsDisposed, IDisposable, IDeserializationCallback, ICloneable, ISerializable
Inheritance
Document
Implements
Inherited Members
Extension Methods

Constructors

Document(SizeInt32)
Document(Size)
Document(int, int)

Constructs a blank document (zero layers) of the given width and height.

Fields

CmPerInch
MaximumDpu
MinimumDpu

Properties

Bounds
CustomHeaders
DefaultDpcm
DefaultDpi
DefaultDpuUnit
DefaultResolution
Dirty

Keeps track of whether the document has changed at all since it was last opened or saved. This is something that is not reset to true by any method in the Document class, but is set to false anytime anything is changed. This way we can prompt the user to save a changed document when they go to quit.

DpuUnit

Gets or sets the units that are used for measuring the document's physical (printed) size.

DpuX

Gets or sets the Document's dots-per-unit scale in the X direction.

DpuY

Gets or sets the Document's dots-per-unit scale in the Y direction.

Header
Height

Height of the document, in pixels. All contained layers must be this tall as well.

IsDisposed
Layers

Exposes a collection for access to the layers, and for manipulation of the way the document contains the layers (add/remove/move).

MagicBytes
Metadata
PhysicalHeight

Gets the Document's measured physical height based on the DpuUnit and DpuY properties.

PhysicalWidth

Gets the Document's measured physical width based on the DpuUnit and DpuX properties.

Resolution
SavedWithVersion

Reports the version of paint.net that this file was saved with. This is reset when SaveToStream is used. This can be used to determine file format compatibility if necessary.

Size

The size of the document, in pixels. This is a convenience property that wraps up the Width and Height properties in one Size structure.

Width

Width of the document, in pixels. All contained layers must be this wide as well.

Methods

CentimetersToInches(double)
Clone()
ConvertMeasurement(double, MeasurementUnit, MeasurementUnit, double, MeasurementUnit)
CreateRenderer()
Dispose()
DotsPerCmToDotsPerInch(double)
DotsPerInchToDotsPerCm(double)
Flatten()

Returns a new Document that is a flattened version of this one "Flattened" means it is one layer that is simply a bitmap of the compositied image.

Flatten(Surface)
FromGdipImage(Image, bool)

Creates a document that consists of one BitmapLayer.

FromImage(Image)

Calls FromGdipImage(image, false).

FromStream(Stream)

Deserializes a Document from a stream.

GetDefaultDpu(MeasurementUnit)
InchesToCentimeters(double)
Invalidate()

Causes the whole document to be invalidated, forcing a full rerender on the next call to Update.

Invalidate(RectInt32)
Invalidate(Rectangle)

Invalidates a portion of the document. The given region is then tagged for rerendering during the next call to Update.

PixelAreaToPhysicalArea(double, MeasurementUnit)
PixelToPhysical(double, MeasurementUnit, MeasurementUnit, double)
PixelToPhysicalX(double, MeasurementUnit)
PixelToPhysicalY(double, MeasurementUnit)
ReplaceMetadataFrom(Document)
SaveToStream(Stream)

Saves the Document to the given Stream with only the default headers and no IO completion callback.

SaveToStream(Stream, IOEventHandler?)

Saves the Document to the given Stream with the default and given headers, and using the given IO completion callback.