public final class XpsDocument extends Document
Class incapsulating the main entity of XPS document that provides manipulation methods for any XPS element.
Constructor and Description |
---|
XpsDocument()
Creates empty XPS document with default page size.
|
XpsDocument(InputStream stream,
LoadOptions options)
Loads an existing document stored in the
stream as XPS document. |
XpsDocument(String path)
Opens an existing XPS document located at the
path . |
Modifier and Type | Method and Description |
---|---|
XpsCanvas |
add(XpsCanvas canvas)
Adds a canvas to the active page.
|
XpsGlyphs |
add(XpsGlyphs glyphs)
Adds glyphs to the active page.
|
XpsPath |
add(XpsPath path)
Adds a path to the active page.
|
XpsCanvas |
addCanvas()
Adds a new canvas to the active page.
|
void |
addDocument()
Adds an empty document with default page size and selects added document as active.
|
void |
addDocument(boolean activate)
Adds an empty document with default page size.
|
void |
addDocument(float width,
float height)
Adds an empty document with the first page dimensions
width and height and selects added document as active. |
void |
addDocument(float width,
float height,
boolean activate)
Adds an empty document with the first page dimensions
width and height . |
XpsGlyphs |
addGlyphs(String fontFamily,
float fontRenderingEmSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Adds new glyphs to the active page.
|
XpsGlyphs |
addGlyphs(XpsFont font,
float fontRenderingEmSize,
float originX,
float originY,
String unicodeString)
Adds new glyphs to the active page.
|
void |
addOutlineEntry(String description,
int outlineLevel,
XpsHyperlinkTarget target)
Adds an outline entry to the document.
|
XpsPage |
addPage()
Adds an empty page to the document with default page size.
|
XpsPage |
addPage(boolean activate)
Adds an empty page to the document with default page size.
|
XpsPage |
addPage(float width,
float height)
Adds an empty page to the document with specified
width and height . |
XpsPage |
addPage(float width,
float height,
boolean activate)
Adds an empty page to the document with specified
width and height . |
XpsPage |
addPage(XpsPage page)
Adds a page to the document and selects added page as active.
|
XpsPage |
addPage(XpsPage page,
boolean activate)
Adds a page to the document.
|
XpsPath |
addPath(XpsPathGeometry data)
Adds a new path to the active page.
|
XpsArcSegment |
createArcSegment(Point2D point,
Dimension2D size,
float rotationAngle,
boolean isLargeArc,
XpsSweepDirection sweepDirection)
Creates a new stroked elliptical arc segment.
|
XpsArcSegment |
createArcSegment(Point2D point,
Dimension2D size,
float rotationAngle,
boolean isLargeArc,
XpsSweepDirection sweepDirection,
boolean isStroked)
Creates a new elliptical arc segment.
|
XpsCanvas |
createCanvas()
Creates a new canvas.
|
XpsColor |
createColor(Color color)
Creates a new color.
|
XpsColor |
createColor(float r,
float g,
float b)
Creates a new color in scRGB color space.
|
XpsColor |
createColor(float a,
float r,
float g,
float b)
Creates a new color in scRGB color space.
|
XpsColor |
createColor(int r,
int g,
int b)
Creates a new color in sRGB color space.
|
XpsColor |
createColor(int a,
int r,
int g,
int b)
Creates a new color in sRGB color space.
|
XpsColor |
createColor(String path,
float... components)
Creates a new color in ICC based color space.
|
XpsColor |
createColor(XpsIccProfile iccProfile,
float... components)
Creates a new color in ICC based color space.
|
XpsFont |
createFont(InputStream stream)
Creates a new TrueType font resource out of stream.
|
XpsFont |
createFont(String fontFamily,
XpsFontStyle fontStyle)
Creates a new TrueType font resource.
|
XpsGlyphs |
createGlyphs(String fontFamily,
float fontRenderingEmSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Creates new glyphs.
|
XpsGlyphs |
createGlyphs(XpsFont font,
float fontRenderingEmSize,
float originX,
float originY,
String unicodeString)
Creates new glyphs.
|
XpsGradientStop |
createGradientStop(Color color,
float offset)
Creates a new gradient stop.
|
XpsGradientStop |
createGradientStop(XpsColor color,
float offset)
Creates a new gradient stop.
|
XpsIccProfile |
createIccProfile(InputStream stream)
Creates a new ICC profile resource out of
stream . |
XpsIccProfile |
createIccProfile(String iccProfilePath)
Creates a new ICC profile resource out of ICC profile file located at the
iccProfilePath . |
XpsImage |
createImage(InputStream stream)
Creates a new image resource out of
stream . |
XpsImage |
createImage(String imagePath)
Creates a new image resource out of image file located at the
imagePath . |
XpsImageBrush |
createImageBrush(String imagePath,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new image brush.
|
XpsImageBrush |
createImageBrush(XpsImage image,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new image brush.
|
XpsLinearGradientBrush |
createLinearGradientBrush(List<XpsGradientStop> gradientStops,
Point2D startPoint,
Point2D endPoint)
Creates a new linear gradient brush.
|
XpsLinearGradientBrush |
createLinearGradientBrush(Point2D startPoint,
Point2D endPoint)
Creates a new linear gradient brush.
|
XpsMatrix |
createMatrix(float m11,
float m12,
float m21,
float m22,
float m31,
float m32)
Creates a new affine transformation matrix.
|
XpsPath |
createPath(XpsPathGeometry data)
Creates a new path.
|
XpsPathFigure |
createPathFigure(Point2D startPoint)
Creates a new open path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
boolean isClosed)
Creates a new path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
XpsList<XpsPathSegment> segments)
Creates a new open path figure.
|
XpsPathFigure |
createPathFigure(Point2D startPoint,
XpsList<XpsPathSegment> segments,
boolean isClosed)
Creates a new path figure.
|
XpsPathGeometry |
createPathGeometry()
Creates a new path geometry.
|
XpsPathGeometry |
createPathGeometry(String abbreviatedGeometry)
Creates a new path geometry specified with abbreviated form.
|
XpsPathGeometry |
createPathGeometry(XpsList<XpsPathFigure> pathFigures)
Creates a new path geometry with specified list of path figures.
|
XpsPolyBezierSegment |
createPolyBezierSegment(Point2D[] points)
Creates a new set of stroked cubic Bézier curves.
|
XpsPolyBezierSegment |
createPolyBezierSegment(Point2D[] points,
boolean isStroked)
Creates a new set of cubic Bézier curves.
|
XpsPolyLineSegment |
createPolyLineSegment(Point2D[] points)
Creates a new stroked polygonal drawing containing an arbitrary number of individual vertices.
|
XpsPolyLineSegment |
createPolyLineSegment(Point2D[] points,
boolean isStroked)
Creates a new polygonal drawing containing an arbitrary number of individual vertices.
|
XpsPolyQuadraticBezierSegment |
createPolyQuadraticBezierSegment(Point2D[] points)
Creates a new set of stroked quadratic Bézier curves from the previous point in the path figure through a set
of vertices, using specified control points.
|
XpsPolyQuadraticBezierSegment |
createPolyQuadraticBezierSegment(Point2D[] points,
boolean isStroked)
Creates a new set of quadratic Bézier curves from the previous point in the path figure through a set
of vertices, using specified control points.
|
XpsRadialGradientBrush |
createRadialGradientBrush(List<XpsGradientStop> gradientStops,
Point2D center,
Point2D gradientOrigin,
float radiusX,
float radiusY)
Creates a new radial gradient brush.
|
XpsRadialGradientBrush |
createRadialGradientBrush(Point2D center,
Point2D gradientOrigin,
float radiusX,
float radiusY)
Creates a new radial gradient brush.
|
XpsSolidColorBrush |
createSolidColorBrush(Color color)
Creates a new solid color brush.
|
XpsSolidColorBrush |
createSolidColorBrush(XpsColor color)
Creates a new solid color brush.
|
XpsVisualBrush |
createVisualBrush(XpsCanvas canvas,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new visual brush.
|
XpsVisualBrush |
createVisualBrush(XpsGlyphs glyphs,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new visual brush.
|
XpsVisualBrush |
createVisualBrush(XpsPath path,
Rectangle2D viewbox,
Rectangle2D viewport)
Creates a new visual brush.
|
int |
getActiveDocument()
Returns the active document number.
|
int |
getActivePage()
Returns the active page number within the active document.
|
int |
getDocumentCount()
Returns the number of documents inside the XPS package.
|
DocumentPrintTicket |
getDocumentPrintTicket(int documentIndex)
Gets the print ticket of the document indexed by
documentIndex . |
JobPrintTicket |
getJobPrintTicket()
Returns the document's job print ticket.
|
XpsPage |
getPage()
Returns the
XpsPage instance for active page. |
int |
getPageCount()
Returns the number of pages in the active document.
|
PagePrintTicket |
getPagePrintTicket(int documentIndex,
int pageIndex)
Gets the print ticket of the page indexed by
pageIndex
in the document indexed by documentIndex . |
int |
getTotalPageCount()
Returns the total number of pages in all documents inside XPS document.
|
XpsCanvas |
insert(int index,
XpsCanvas canvas)
Inserts a canvas to the active page at
index position. |
XpsGlyphs |
insert(int index,
XpsGlyphs glyphs)
Inserts glyphs to the active page at
index position. |
XpsPath |
insert(int index,
XpsPath path)
Inserts a path to the active page at
index position. |
XpsCanvas |
insertCanvas(int index)
Inserts a new canvas to the active page at
index position. |
void |
insertDocument(int index)
Inserts an empty document with default page size
at
index position and selects inserted document as active. |
void |
insertDocument(int index,
boolean activate)
Inserts an empty document with default page size
at
index position. |
void |
insertDocument(int index,
float width,
float height)
Inserts an empty document with the first page dimensions
width and height at index position and
selects inserted document as active. |
void |
insertDocument(int index,
float width,
float height,
boolean activate)
Inserts an empty document with the first page dimensions
width and height at index position. |
XpsGlyphs |
insertGlyphs(int index,
String fontFamily,
float fontSize,
XpsFontStyle fontStyle,
float originX,
float originY,
String unicodeString)
Inserts new glyphs to the active page at
index position. |
XpsGlyphs |
insertGlyphs(int index,
XpsFont font,
float fontSize,
float originX,
float originY,
String unicodeString)
Inserts new glyphs to the active page at
index position. |
XpsPage |
insertPage(int index)
Inserts an empty page to the document with default page size
at
index position and select inserted page as active. |
XpsPage |
insertPage(int index,
boolean activate)
Inserts an empty page to the document with default page size
at
index position. |
XpsPage |
insertPage(int index,
float width,
float height)
Inserts an empty page to the document with specified
width and height at index position and
selects inserted page as active. |
XpsPage |
insertPage(int index,
float width,
float height,
boolean activate)
Inserts an empty page to the document with specified
width and height at index position. |
XpsPage |
insertPage(int index,
XpsPage page)
Inserts a page to the document at
index position and
selects inserted page as active. |
XpsPage |
insertPage(int index,
XpsPage page,
boolean activate)
Inserts a page to the document at
index position. |
XpsPath |
insertPath(int index,
XpsPathGeometry data)
Inserts a new path to the active page at
index position. |
XpsElement |
remove(XpsElement element)
Removes an element from the active page.
|
XpsElement |
removeAt(int index)
Removes an element at
index position from the active page. |
void |
removeDocumentAt(int index)
Removes a document at
index position. |
XpsPage |
removePage(XpsPage page)
Removes a page from the document.
|
XpsPage |
removePageAt(int index)
Removes a page from the document at
index position. |
void |
save(Device device,
SaveOptions options)
Saves the document using the
Device instance. |
void |
save(OutputStream stream)
Saves XPS document to stream.
|
void |
save(String path)
Saves XPS document to the XPS file located at the
path . |
void |
selectActiveDocument(int documentNumber)
Selects an active document for editing.
|
XpsPage |
selectActivePage(int pageNumber)
Selects an active document page for editing.
|
void |
setDocumentPrintTicket(int documentIndex,
DocumentPrintTicket printTicket)
Links the
printTicket to the document indexed by documentIndex . |
void |
setJobPrintTicket(JobPrintTicket value)
Sets the document's job print ticket.
|
void |
setPagePrintTicket(int documentIndex,
int pageIndex,
PagePrintTicket printTicket)
Links the
printTicket to the page indexed by pageIndex
in the document indexed by documentIndex . |
isLicensed
public XpsDocument()
Creates empty XPS document with default page size.
public XpsDocument(String path) throws FileNotFoundException
Opens an existing XPS document located at the path
.
path
- Location of the document.FileNotFoundException
- if the file does not exist, is a directory rather than a regular file,
or for some other reason cannot be opened for reading.public XpsDocument(InputStream stream, LoadOptions options)
Loads an existing document stored in the stream
as XPS document.
stream
- Document stream.options
- Document loading options.public void selectActiveDocument(int documentNumber)
Selects an active document for editing.
documentNumber
- A document number.IllegalArgumentException
- Thrown when
documentNumber
is out of bounds.public XpsPage selectActivePage(int pageNumber)
Selects an active document page for editing.
pageNumber
- A page number.XpsPage
instance for active page.IllegalArgumentException
- Thrown when
pageNumber
is out of bounds.public int getActiveDocument()
public int getActivePage()
public XpsPage getPage()
Returns the XpsPage
instance for active page.
XpsPage
instance for active page.public void save(String path) throws FileNotFoundException
Saves XPS document to the XPS file located at the path
.
path
- Location of the document.FileNotFoundException
- if the file exists but is a directory rather than a regular file,
does not exist but cannot be created, or cannot be opened for any other reason.public void save(OutputStream stream)
Saves XPS document to stream.
stream
- Stream XPS document to be saved into.public void save(Device device, SaveOptions options)
Saves the document using the Device
instance.
public int getDocumentCount()
Returns the number of documents inside the XPS package.
public int getTotalPageCount()
Returns the total number of pages in all documents inside XPS document.
public int getPageCount()
Returns the number of pages in the active document.
public JobPrintTicket getJobPrintTicket()
Returns the document's job print ticket.
public void setJobPrintTicket(JobPrintTicket value)
Sets the document's job print ticket.
value
- The document's job print ticket.public DocumentPrintTicket getDocumentPrintTicket(int documentIndex)
Gets the print ticket of the document indexed by documentIndex
.
documentIndex
- Index of the document whose print ticket to return.public void setDocumentPrintTicket(int documentIndex, DocumentPrintTicket printTicket)
Links the printTicket
to the document indexed by documentIndex
.
documentIndex
- Index of the document to link the print ticket to.printTicket
- The print ticket to link.public PagePrintTicket getPagePrintTicket(int documentIndex, int pageIndex)
Gets the print ticket of the page indexed by pageIndex
in the document indexed by documentIndex
.
documentIndex
- Index of the document.pageIndex
- Index of the page whose print ticket to return.public void setPagePrintTicket(int documentIndex, int pageIndex, PagePrintTicket printTicket)
Links the printTicket
to the page indexed by pageIndex
in the document indexed by documentIndex
.
documentIndex
- Index of the document.pageIndex
- Index of the page to link the print ticket to.printTicket
- The print ticket to link.public XpsCanvas add(XpsCanvas canvas)
Adds a canvas to the active page.
canvas
- Canvas to be added.public XpsPath add(XpsPath path)
Adds a path to the active page.
path
- Path to be added.public XpsGlyphs add(XpsGlyphs glyphs)
Adds glyphs to the active page.
glyphs
- Glyphs to be added.public XpsCanvas insert(int index, XpsCanvas canvas)
Inserts a canvas to the active page at index
position.
index
- Position at which a canvas
should be inserted.canvas
- Canvas to be inserted.public XpsPath insert(int index, XpsPath path)
Inserts a path to the active page at index
position.
index
- Position at which a path
should be inserted.path
- Path to be inserted.public XpsGlyphs insert(int index, XpsGlyphs glyphs)
Inserts glyphs to the active page at index
position.
index
- Position at which glyphs
should be inserted.glyphs
- Glyphs to be inserted.XpsGlyphs
instance.public XpsElement remove(XpsElement element)
Removes an element from the active page.
element
- An element to be removed.public XpsElement removeAt(int index)
Removes an element at index
position from the active page.
index
- Position at which an element should be removed.public void addDocument()
Adds an empty document with default page size and selects added document as active.
public void addDocument(boolean activate)
Adds an empty document with default page size.
activate
- Flag indicating whether to select added document as active.public void addDocument(float width, float height)
Adds an empty document with the first page dimensions
width
and height
and selects added document as active.
width
- Width of the first page.height
- Height of the first page.public void addDocument(float width, float height, boolean activate)
Adds an empty document with the first page dimensions
width
and height
.
width
- Width of the first page.height
- Height of the first page.activate
- Flag indicating whether to select added document as active.public void insertDocument(int index)
Inserts an empty document with default page size
at index
position and selects inserted document as active.
index
- Position at which a document should be inserted.public void insertDocument(int index, boolean activate)
Inserts an empty document with default page size
at index
position.
index
- Position at which a document should be inserted.activate
- Flag indicating whether to select inserted document as active.public void insertDocument(int index, float width, float height)
Inserts an empty document with the first page dimensions
width
and height
at index
position and
selects inserted document as active.
index
- Position at which a document should be inserted.width
- Width of the first page.height
- Height of the first page.public void insertDocument(int index, float width, float height, boolean activate)
Inserts an empty document with the first page dimensions
width
and height
at index
position.
index
- Position at which a document should be inserted.width
- Width of the first page.height
- Height of the first page.activate
- Flag indicating whether to select inserted document as active.public void removeDocumentAt(int index)
Removes a document at index
position.
index
- Position at which a document should be removed.public XpsPage addPage()
Adds an empty page to the document with default page size.
public XpsPage addPage(boolean activate)
Adds an empty page to the document with default page size.
activate
- Flag indicating whether to select added page as active.public XpsPage addPage(float width, float height)
Adds an empty page to the document with specified
width
and height
.
width
- Width of a new page.height
- Height of a new page.public XpsPage addPage(float width, float height, boolean activate)
Adds an empty page to the document with specified
width
and height
.
width
- Width of a new page.height
- Height of a new page.activate
- Flag indicating whether to select added page as active.public XpsPage addPage(XpsPage page)
Adds a page to the document and selects added page as active.
page
- Page to be added.public XpsPage addPage(XpsPage page, boolean activate)
Adds a page to the document.
page
- Page to be added.activate
- Flag indicating whether to select added page as active.public XpsPage removePage(XpsPage page)
Removes a page from the document.
page
- Page to be removed.public XpsPage insertPage(int index)
Inserts an empty page to the document with default page size
at index
position and select inserted page as active.
index
- Position at which a page should be inserted.public XpsPage insertPage(int index, boolean activate)
Inserts an empty page to the document with default page size
at index
position.
index
- Position at which a page should be inserted.activate
- Flag indicating whether to select inserted page as active.public XpsPage insertPage(int index, float width, float height)
Inserts an empty page to the document with specified
width
and height
at index
position and
selects inserted page as active.
index
- Position at which a page should be inserted.width
- Width of a new page.height
- Height of a new page.public XpsPage insertPage(int index, float width, float height, boolean activate)
Inserts an empty page to the document with specified
width
and height
at index
position.
index
- Position at which a page should be inserted.width
- Width of a new page.height
- Height of a new page.activate
- Flag indicating whether to select inserted page as active.public XpsPage insertPage(int index, XpsPage page)
Inserts a page to the document at index
position and
selects inserted page as active.
index
- Position at which a page should be added.page
- Page to be inserted.public XpsPage insertPage(int index, XpsPage page, boolean activate)
Inserts a page to the document at index
position.
index
- Position at which a page should be added.page
- Page to be inserted.activate
- Flag indicating whether to select inserted page as active.public XpsPage removePageAt(int index)
Removes a page from the document at index
position.
index
- Position at which a page should be removed.public XpsCanvas createCanvas()
Creates a new canvas.
public XpsCanvas addCanvas()
Adds a new canvas to the active page.
public XpsCanvas insertCanvas(int index)
Inserts a new canvas to the active page at index
position.
index
- Position at which a new canvas should be inserted.public XpsPath createPath(XpsPathGeometry data)
Creates a new path.
data
- The geometry of the path.public XpsPath addPath(XpsPathGeometry data)
Adds a new path to the active page.
data
- The geometry of the path.public XpsPath insertPath(int index, XpsPathGeometry data)
Inserts a new path to the active page at index
position.
index
- Position at which a new path should be inserted.data
- The geometry of the path.public XpsGlyphs createGlyphs(String fontFamily, float fontRenderingEmSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Creates new glyphs.
fontFamily
- Font family.fontRenderingEmSize
- Font size.fontStyle
- Font style.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsGlyphs createGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, String unicodeString)
Creates new glyphs.
font
- Font resource.fontRenderingEmSize
- Font size.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsGlyphs addGlyphs(String fontFamily, float fontRenderingEmSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Adds new glyphs to the active page.
fontFamily
- Font family.fontRenderingEmSize
- Font size.fontStyle
- Font style.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsGlyphs insertGlyphs(int index, String fontFamily, float fontSize, XpsFontStyle fontStyle, float originX, float originY, String unicodeString)
Inserts new glyphs to the active page at index
position.
index
- Position at which new glyphs should be inserted.fontFamily
- Font family.fontSize
- Font size.fontStyle
- Font style.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsGlyphs addGlyphs(XpsFont font, float fontRenderingEmSize, float originX, float originY, String unicodeString)
Adds new glyphs to the active page.
font
- Font resource.fontRenderingEmSize
- Font size.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsGlyphs insertGlyphs(int index, XpsFont font, float fontSize, float originX, float originY, String unicodeString)
Inserts new glyphs to the active page at index
position.
index
- Position at which new glyphs should be inserted.font
- Font resource.fontSize
- Font size.originX
- Glyphs origin X coordinate.originY
- Glyphs origin Y coordinate.unicodeString
- String to be printed.public XpsMatrix createMatrix(float m11, float m12, float m21, float m22, float m31, float m32)
Creates a new affine transformation matrix.
m11
- Element 11.m12
- Element 12.m21
- Element 21.m22
- Element 22.m31
- Element 31.m32
- Element 32.public XpsPathGeometry createPathGeometry()
Creates a new path geometry.
public XpsPathGeometry createPathGeometry(XpsList<XpsPathFigure> pathFigures)
Creates a new path geometry with specified list of path figures.
pathFigures
- List of path figures.public XpsPathGeometry createPathGeometry(String abbreviatedGeometry)
Creates a new path geometry specified with abbreviated form.
abbreviatedGeometry
- Abbreviated form of path geometry.public XpsPathFigure createPathFigure(Point2D startPoint)
Creates a new open path figure.
startPoint
- The starting point for the first segment of the path figure.public XpsPathFigure createPathFigure(Point2D startPoint, boolean isClosed)
Creates a new path figure.
startPoint
- The starting point for the first segment of the path figure.isClosed
- Specifies whether the path is closed. If set to true, the stroke is drawn
"closed," that is, the last point in the last segment of the path figure is connected with
the point specified in the StartPoint attribute, otherwise the stroke is drawn "open," and
the last point is not connected to the start point. Only applicable if the path figure is
used in a {Path} element that specifies a stroke.public XpsPathFigure createPathFigure(Point2D startPoint, XpsList<XpsPathSegment> segments)
Creates a new open path figure.
startPoint
- The starting point for the first segment of the path figure.segments
- List of path segments.public XpsPathFigure createPathFigure(Point2D startPoint, XpsList<XpsPathSegment> segments, boolean isClosed)
Creates a new path figure.
startPoint
- The starting point for the first segment of the path figure.segments
- List of path segments.isClosed
- Specifies whether the path is closed. If set to true, the stroke is drawn
"closed," that is, the last point in the last segment of the path figure is connected with
the point specified in the StartPoint attribute, otherwise the stroke is drawn "open," and
the last point is not connected to the start point. Only applicable if the path figure is
used in a {Path} element that specifies a stroke.public XpsArcSegment createArcSegment(Point2D point, Dimension2D size, float rotationAngle, boolean isLargeArc, XpsSweepDirection sweepDirection)
Creates a new stroked elliptical arc segment.
point
- The end point of the elliptical arc.size
- The x and y radius of the elliptical arc as an x,y pair.rotationAngle
- Indicates how the ellipse is rotated relative to the current coordinate system.isLargeArc
- Determines whether the arc is drawn with a sweep of 180 or greater.sweepDirection
- The direction in which the arc is drawn.public XpsArcSegment createArcSegment(Point2D point, Dimension2D size, float rotationAngle, boolean isLargeArc, XpsSweepDirection sweepDirection, boolean isStroked)
Creates a new elliptical arc segment.
point
- The end point of the elliptical arc.size
- The x and y radius of the elliptical arc as an x,y pair.rotationAngle
- Indicates how the ellipse is rotated relative to the current coordinate system.isLargeArc
- Determines whether the arc is drawn with a sweep of 180 or greater.sweepDirection
- The direction in which the arc is drawn.isStroked
- Specifies whether the stroke for this segment of the path is drawn.public XpsPolyLineSegment createPolyLineSegment(Point2D[] points)
Creates a new stroked polygonal drawing containing an arbitrary number of individual vertices.
points
- A set of coordinates for the multiple segments that define the poly line segment.public XpsPolyLineSegment createPolyLineSegment(Point2D[] points, boolean isStroked)
Creates a new polygonal drawing containing an arbitrary number of individual vertices.
points
- A set of coordinates for the multiple segments that define the poly line segment.isStroked
- Specifies whether the stroke for this segment of the path is drawn.public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points)
Creates a new set of stroked cubic Bézier curves.
points
- Control points for multiple Bézier segments.public XpsPolyBezierSegment createPolyBezierSegment(Point2D[] points, boolean isStroked)
Creates a new set of cubic Bézier curves.
points
- Control points for multiple Bézier segments.isStroked
- Specifies whether the stroke for this segment of the path is drawn.public XpsPolyQuadraticBezierSegment createPolyQuadraticBezierSegment(Point2D[] points)
Creates a new set of stroked quadratic Bézier curves from the previous point in the path figure through a set of vertices, using specified control points.
points
- Control points for multiple quadratic Bézier segments.public XpsPolyQuadraticBezierSegment createPolyQuadraticBezierSegment(Point2D[] points, boolean isStroked)
Creates a new set of quadratic Bézier curves from the previous point in the path figure through a set of vertices, using specified control points.
points
- Control points for multiple quadratic Bézier segments.isStroked
- Specifies whether the stroke for this segment of the path is drawn.public XpsSolidColorBrush createSolidColorBrush(XpsColor color)
Creates a new solid color brush.
color
- The color for filled elements.public XpsSolidColorBrush createSolidColorBrush(Color color)
Creates a new solid color brush.
color
- The color for filled elements.public XpsGradientStop createGradientStop(XpsColor color, float offset)
Creates a new gradient stop.
color
- The gradient stop color.offset
- The gradient offset.public XpsGradientStop createGradientStop(Color color, float offset)
Creates a new gradient stop.
color
- The gradient stop color.offset
- The gradient offset.public XpsLinearGradientBrush createLinearGradientBrush(List<XpsGradientStop> gradientStops, Point2D startPoint, Point2D endPoint)
Creates a new linear gradient brush.
gradientStops
- The list of gradient stops.startPoint
- The starting point of the linear gradient.endPoint
- The end point of the linear gradient.public XpsLinearGradientBrush createLinearGradientBrush(Point2D startPoint, Point2D endPoint)
Creates a new linear gradient brush.
startPoint
- The starting point of the linear gradient.endPoint
- The end point of the linear gradient.public XpsRadialGradientBrush createRadialGradientBrush(List<XpsGradientStop> gradientStops, Point2D center, Point2D gradientOrigin, float radiusX, float radiusY)
Creates a new radial gradient brush.
gradientStops
- The list of gradient stops.center
- The center point of the radial gradient (that is, the center of the ellipse).gradientOrigin
- The origin point of the radial gradient.radiusX
- The radius in the x dimension of the ellipse which defines the radial gradient.radiusY
- The radius in the y dimension of the ellipse which defines the radial gradient.public XpsRadialGradientBrush createRadialGradientBrush(Point2D center, Point2D gradientOrigin, float radiusX, float radiusY)
Creates a new radial gradient brush.
center
- The center point of the radial gradient (that is, the center of the ellipse).gradientOrigin
- The origin point of the radial gradient.radiusX
- The radius in the x dimension of the ellipse which defines the radial gradient.radiusY
- The radius in the y dimension of the ellipse which defines the radial gradient.public XpsVisualBrush createVisualBrush(XpsCanvas canvas, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new visual brush.
canvas
- The canvas for Visual element.viewbox
- The position and dimensions of the brush's source content.viewport
- The region in the containing coordinate space of the prime brush
tile that is (possibly repeatedly) applied to fill the region to which the brush is appliedpublic XpsVisualBrush createVisualBrush(XpsPath path, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new visual brush.
path
- The path for Visual element.viewbox
- The position and dimensions of the brush's source content.viewport
- The region in the containing coordinate space of the prime brush
tile that is (possibly repeatedly) applied to fill the region to which the brush is appliedpublic XpsVisualBrush createVisualBrush(XpsGlyphs glyphs, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new visual brush.
glyphs
- The glyphs for Visual element.viewbox
- The position and dimensions of the brush's source content.viewport
- The region in the containing coordinate space of the prime brush
tile that is (possibly repeatedly) applied to fill the region to which the brush is appliedpublic XpsImageBrush createImageBrush(XpsImage image, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new image brush.
image
- An image resource.viewbox
- The position and dimensions of the brush's source content.viewport
- The region in the containing coordinate space of the prime brush
tile that is (possibly repeatedly) applied to fill the region to which the brush is appliedpublic XpsImageBrush createImageBrush(String imagePath, Rectangle2D viewbox, Rectangle2D viewport)
Creates a new image brush.
imagePath
- The path to the image to take as a brush tile.viewbox
- The position and dimensions of the brush's source content.viewport
- The region in the containing coordinate space of the prime brush
tile that is (possibly repeatedly) applied to fill the region to which the brush is appliedpublic XpsColor createColor(Color color)
Creates a new color.
color
- A native color instance for RGB color.public XpsColor createColor(int a, int r, int g, int b)
Creates a new color in sRGB color space.
a
- The alpha color component.r
- The red color component.g
- The green color component.b
- The blue color component.public XpsColor createColor(int r, int g, int b)
Creates a new color in sRGB color space.
r
- The red color component.g
- The green color component.b
- The blue color component.public XpsColor createColor(float a, float r, float g, float b)
Creates a new color in scRGB color space.
a
- The alpha color component.r
- The red color component.g
- The green color component.b
- The blue color component.public XpsColor createColor(float r, float g, float b)
Creates a new color in scRGB color space.
r
- The red color component.g
- The green color component.b
- The blue color component.public XpsColor createColor(String path, float... components)
Creates a new color in ICC based color space.
path
- The path to the ICC profile.components
- Color components.public XpsColor createColor(XpsIccProfile iccProfile, float... components)
Creates a new color in ICC based color space.
iccProfile
- The ICC profile resource.components
- Color components.public XpsImage createImage(String imagePath)
Creates a new image resource out of image file located at the imagePath
.
imagePath
- The path to the image to take as a resource.public XpsImage createImage(InputStream stream)
Creates a new image resource out of stream
.
stream
- The stream containing the image to take as a resource.public XpsIccProfile createIccProfile(String iccProfilePath)
Creates a new ICC profile resource out of ICC profile file located at the
iccProfilePath
.
iccProfilePath
- The path to the ICC profile to take as a resource.public XpsIccProfile createIccProfile(InputStream stream)
Creates a new ICC profile resource out of stream
.
stream
- The stream containing the ICC profile to take as a resource.public XpsFont createFont(String fontFamily, XpsFontStyle fontStyle)
Creates a new TrueType font resource.
fontFamily
- The font family.fontStyle
- The font style. See XpsFont
class constants
(which are bit flags) for values available to combine.public XpsFont createFont(InputStream stream)
Creates a new TrueType font resource out of stream.
stream
- The stream containing the ICC profile to take as a resource.public void addOutlineEntry(String description, int outlineLevel, XpsHyperlinkTarget target)
Adds an outline entry to the document.
description
- The entry description.outlineLevel
- The outline level.target
- The entry target.