GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PictureFillBrush Class

    Namespace:
    GemBox.Document.Drawing
    Assembly:
    GemBox.Document.dll

    Represents a fill with a picture that can either be tiled (as a texture) or stretched to fill the available area. This fill is not supported for outlines, borders and underlines.

    • C#
    • VB.NET
    public sealed class PictureFillBrush : Brush
    Public NotInheritable Class PictureFillBrush
        Inherits Brush
    Inheritance:
    System.Object
    Brush
    PictureFillBrush

    Properties

    CropBottom

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the bottom edge of the picture PictureContent specified as a relative value (percentage of the picture data height, value of 1 is equal to 100% of the picture data height).

    • C#
    • VB.NET
    public double CropBottom { get; set; }
    Public Property CropBottom As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of bottom top edge of the picture PictureContent.

    Remarks

    To reverse the effect of extra stretching caused because cropped picture data is stretched, increment the StretchBottom by the CropBottom.

    To inset the stretched picture data into the filling area you can either set the StretchBottom to a positive value or CropBottom to a negative value depending on which size you choose to use as a basis (StretchBottom uses filling area height as a basis and CropBottom uses picture data height as a basis).

    To outset the stretched picture data outside of the filling area you can either set the StretchBottom to a negative value or CropBottom to a positive value depending on which size you choose to use as a basis (StretchBottom uses filling area height as a basis and CropBottom uses picture data height as a basis).

    If the picture is tiled (TileAsTexture is true), then cropped parts of the picture data are covered by the adjacent tiles and all tiles consist of the non-cropped part of the picture data.

    CropLeft

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the left edge of the picture PictureContent specified as a relative value (percentage of the picture data width, value of 1 is equal to 100% of the picture data width).

    • C#
    • VB.NET
    public double CropLeft { get; set; }
    Public Property CropLeft As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the left edge of the picture PictureContent.

    Remarks

    To reverse the effect of extra stretching caused because cropped picture data is stretched, increment the StretchLeft by the CropLeft.

    To inset the stretched picture data into the filling area you can either set the StretchLeft to a positive value or CropLeft to a negative value depending on which size you choose to use as a basis (StretchLeft uses filling area width as a basis and CropLeft uses picture data width as a basis).

    To outset the stretched picture data outside of the filling area you can either set the StretchLeft to a negative value or CropLeft to a positive value depending on which size you choose to use as a basis (StretchLeft uses filling area width as a basis and CropLeft uses picture data width as a basis).

    If the picture is tiled (TileAsTexture is true), then cropped parts of the picture data are covered by the adjacent tiles and all tiles consist of the non-cropped part of the picture data.

    CropRight

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the right edge of the picture PictureContent specified as a relative value (percentage of the picture data width, value of 1 is equal to 100% of the picture data width).

    • C#
    • VB.NET
    public double CropRight { get; set; }
    Public Property CropRight As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the right edge of the picture PictureContent.

    Remarks

    To reverse the effect of extra stretching caused because cropped picture data is stretched, increment the StretchRight by the CropRight.

    To inset the stretched picture data into the filling area you can either set the StretchRight to a positive value or CropRight to a negative value depending on which size you choose to use as a basis (StretchRight uses filling area width as a basis and CropRight uses picture data width as a basis).

    To outset the stretched picture data outside of the filling area you can either set the StretchRight to a negative value or CropRight to a positive value depending on which size you choose to use as a basis (StretchRight uses filling area width as a basis and CropRight uses picture data width as a basis).

    If the picture is tiled (TileAsTexture is true), then cropped parts of the picture data are covered by the adjacent tiles and all tiles consist of the non-cropped part of the picture data.

    CropTop

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the top edge of the picture PictureContent specified as a relative value (percentage of the picture data height, value of 1 is equal to 100% of the picture data height).

    • C#
    • VB.NET
    public double CropTop { get; set; }
    Public Property CropTop As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the top edge of the picture PictureContent.

    Remarks

    To reverse the effect of extra stretching caused because cropped picture data is stretched, increment the StretchTop by the CropTop.

    To inset the stretched picture data into the filling area you can either set the StretchTop to a positive value or CropTop to a negative value depending on which size you choose to use as a basis (StretchTop uses filling area height as a basis and CropTop uses picture data height as a basis).

    To outset the stretched picture data outside of the filling area you can either set the StretchTop to a negative value or CropTop to a positive value depending on which size you choose to use as a basis (StretchTop uses filling area height as a basis and CropTop uses picture data height as a basis).

    If the picture is tiled (TileAsTexture is true), then cropped parts of the picture data are covered by the adjacent tiles and all tiles consist of the non-cropped part of the picture data.

    PictureContent

    Gets the picture data that has an associated content that is either embedded in or linked to the document file.

    • C#
    • VB.NET
    public PictureContent PictureContent { get; }
    Public ReadOnly Property PictureContent As PictureContent
    Property Value
    PictureContent

    The picture data that has an associated content that is either embedded in or linked to the document file.

    RotateWithShape

    Gets or sets a value indicating whether the fill should rotate with the shape.

    Default value: true.

    • C#
    • VB.NET
    public bool RotateWithShape { get; set; }
    Public Property RotateWithShape As Boolean
    Property Value
    System.Boolean

    true if fill should rotate with the shape; otherwise, false.

    Remarks

    If set to true and a shape that has been filled with a picture is transformed with a rotation, then the fill will be transformed with the same rotation.

    StretchBottom

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the bottom edge of the stretched picture fill from the bottom edge of the filling area specified as a relative value (percentage of the filling area height, value of 1 is equal to 100% of the filling area height).

    • C#
    • VB.NET
    public double StretchBottom { get; set; }
    Public Property StretchBottom As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the bottom edge of the stretched picture fill from the bottom edge of the filling area.

    StretchLeft

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the left edge of the stretched picture fill from the left edge of the filling area specified as a relative value (percentage of the filling area width, value of 1 is equal to 100% of the filling area width).

    • C#
    • VB.NET
    public double StretchLeft { get; set; }
    Public Property StretchLeft As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the left edge of the stretched picture fill from the left edge of the filling area.

    StretchRight

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the right edge of the stretched picture fill from the right edge of the filling area specified as a relative value (percentage of the filling area width, value of 1 is equal to 100% of the filling area width).

    • C#
    • VB.NET
    public double StretchRight { get; set; }
    Public Property StretchRight As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the right edge of the stretched picture fill from the right edge of the filling area.

    StretchTop

    Gets or sets the offset (inset if the value is positive or outset if the value is negative) of the top edge of the stretched picture fill from the top edge of the filling area specified as a relative value (percentage of the filling area height, value of 1 is equal to 100% of the filling area height).

    • C#
    • VB.NET
    public double StretchTop { get; set; }
    Public Property StretchTop As Double
    Property Value
    System.Double

    The offset (inset if the value is positive or outset if the value is negative) of the top edge of the stretched picture fill from the top edge of the filling area.

    TileAsTexture

    Gets or sets a value indicating whether the fill should tile as a texture or stretch over the filling area.

    • C#
    • VB.NET
    public bool TileAsTexture { get; set; }
    Public Property TileAsTexture As Boolean
    Property Value
    System.Boolean

    true if fill should tile as a texture; otherwise, false to stretch it over the filling area.

    TilingAlignment

    Gets or sets a value indicating where to align the first tile with respect to the filling area.

    Alignment happens after the scaling, but before the additional offset.

    • C#
    • VB.NET
    public RectangleAlignment TilingAlignment { get; set; }
    Public Property TilingAlignment As RectangleAlignment
    Property Value
    RectangleAlignment

    A value indicating where to align the first tile with respect to the filling area.

    TilingMirrorType

    Specifies the direction(s) in which to flip the source image while tiling.

    Images may be flipped horizontally, vertically, or in both directions to fill the entire region.

    • C#
    • VB.NET
    public TileMirrorTypes TilingMirrorType { get; set; }
    Public Property TilingMirrorType As TileMirrorTypes
    Property Value
    TileMirrorTypes

    The direction(s) in which to flip the source image while tiling.

    TilingOffsetX

    Gets or sets the additional horizontal offset after tiling alignment.

    • C#
    • VB.NET
    public double TilingOffsetX { get; set; }
    Public Property TilingOffsetX As Double
    Property Value
    System.Double

    The additional horizontal offset after tiling alignment.

    TilingOffsetY

    Gets or sets the additional vertical offset after tiling alignment.

    • C#
    • VB.NET
    public double TilingOffsetY { get; set; }
    Public Property TilingOffsetY As Double
    Property Value
    System.Double

    The additional vertical offset after tiling alignment.

    TilingScaleX

    Gets or sets the horizontal tiling scale in range from 0 = 0% to 1 = 100%.

    • C#
    • VB.NET
    public double TilingScaleX { get; set; }
    Public Property TilingScaleX As Double
    Property Value
    System.Double

    The horizontal tiling scale.

    TilingScaleY

    Gets or sets the vertical tiling scale in range from 0 = 0% to 1 = 100%.

    • C#
    • VB.NET
    public double TilingScaleY { get; set; }
    Public Property TilingScaleY As Double
    Property Value
    System.Double

    The vertical tiling scale.

    Methods

    SetData(Content)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(Content content)
    Public Function SetData(content As Content) As PictureContent
    Parameters
    content
    Content

    The picture content that should be set.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload if multiple PatternFillBrushs should share the same picture data.

    Exceptions
    System.ArgumentNullException

    content is null.

    SetData(Content, PictureCompressionType)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(Content content, PictureCompressionType compressionType)
    Public Function SetData(content As Content, compressionType As PictureCompressionType) As PictureContent
    Parameters
    content
    Content

    The picture content that should be set.

    compressionType
    PictureCompressionType

    Compression level that the generating application can use as a guidance when optimizing picture data size.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload if multiple PatternFillBrushs should share the same picture data but with different compression levels.

    Exceptions
    System.ArgumentNullException

    content is null.

    SetData(Stream)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(Stream stream)
    Public Function SetData(stream As Stream) As PictureContent
    Parameters
    stream
    System.IO.Stream

    Stream containing the picture data.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to automatically detect the picture content type from the decoded picture stream.

    Exceptions
    System.ArgumentNullException

    stream is null.

    System.ArgumentException

    Picture stream encoding format is not supported.

    SetData(Stream, PictureContentType)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(Stream stream, PictureContentType contentType)
    Public Function SetData(stream As Stream, contentType As PictureContentType) As PictureContent
    Parameters
    stream
    System.IO.Stream

    The picture data stream.

    contentType
    PictureContentType

    Image file format of the picture data.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to explicitly specify image file format so that the picture stream doesn't have to be decoded to detect the picture content type.

    Exceptions
    System.ArgumentNullException

    stream is null.

    SetData(Stream, String)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(Stream stream, string contentType)
    Public Function SetData(stream As Stream, contentType As String) As PictureContent
    Parameters
    stream
    System.IO.Stream

    The picture data stream.

    contentType
    System.String

    Content type (MIME type) of the picture data.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.

    Exceptions
    System.ArgumentNullException

    stream is null.

    System.ArgumentException

    contentType is null or System.String.Empty.

    SetData(String, PictureContentType)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(string picturePath, PictureContentType contentType)
    Public Function SetData(picturePath As String, contentType As PictureContentType) As PictureContent
    Parameters
    picturePath
    System.String

    Path to a picture data.

    contentType
    PictureContentType

    Image file format of the picture data.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to explicitly specify image file format (for example, if picturePath doesn't specify a file extension).

    Exceptions
    System.ArgumentException

    picturePath is null or System.String.Empty.

    SetData(String, Boolean)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(string picturePath, bool isLink = false)
    Public Function SetData(picturePath As String, isLink As Boolean = False) As PictureContent
    Parameters
    picturePath
    System.String

    Path or link to a picture data.

    isLink
    System.Boolean

    true if the picture is linked to the file in which DocumentModel instance is saved; otherwise, false.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to automatically detect the picture content type from the picturePath extension.

    Parameter picturePath must contain supported extension (for example, ".png") if isLink is false, otherwise exception is thrown.

    Exceptions
    System.ArgumentException

    picturePath is null or System.String.Empty or picturePath doesn't contain extension or extension is not supported.

    SetData(String, String)

    Sets the picture data.

    • C#
    • VB.NET
    public PictureContent SetData(string picturePath, string contentType)
    Public Function SetData(picturePath As String, contentType As String) As PictureContent
    Parameters
    picturePath
    System.String

    Path to a picture data.

    contentType
    System.String

    Content type (MIME type) of the picture data.

    Returns
    PictureContent

    An instance of a PictureContent class that represents the picture data that has been set.

    Remarks

    Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.

    Exceptions
    System.ArgumentException

    picturePath or contentType is null or System.String.Empty.

    Inherited Properties

    IsEmpty

    Gets a value indicating whether the parent element is filled.

    (Inherited from Brush)

    Inherited Methods

    SetDefault()

    Sets a default fill on the parent element (element will be filled based on the default settings).

    (Inherited from Brush)

    SetEmpty()

    Sets an empty fill on the parent element (element won't be filled).

    (Inherited from Brush)

    SetGradient(GradientFillType)

    Sets a gradient fill on the parent element.

    (Inherited from Brush)

    SetPattern(PatternFillType, Color, Color)

    Sets a pattern fill on the parent element.

    (Inherited from Brush)

    SetPicture(Content)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.IO.Stream)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.IO.Stream, PictureContentType)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.IO.Stream, System.String)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.String, System.Boolean)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.String, PictureContentType)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetPicture(System.String, System.String)

    Sets the fill to the picture fill.

    This method is not applicable on Fill property.

    (Inherited from Brush)

    SetSolid(Color)

    Sets a solid color fill on the parent element.

    (Inherited from Brush)

    SetSolid(Color, System.Byte)

    Sets a solid color fill on the parent element.

    (Inherited from Brush)

    ToString()

    Returns a System.String that represents this Brush instance.

    (Inherited from Brush)

    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.