Fill class

Fill class

Represents fill formatting for an object. To learn more, visit the Working with Graphic Elements documentation article.

Remarks

Use the ShapeBase.fill or Font.fill property to access fill properties of an object. You do not create instances of the Fill class directly.

Properties

NameDescription
back_colorGets or sets a Color object that represents the background color for the fill.
back_theme_colorGets or sets a ThemeColor object that represents the background color for the fill.
back_tint_and_shadeGets or sets a double value that lightens or darkens the background color.
base_fore_colorGets a Color object that represents the base foreground color for the fill without any modifiers.
colorGets or sets a Color object that represents the foreground color for the fill.
fill_typeGets a fill type.
fore_colorGets or sets a Color object that represents the foreground color for the fill.
fore_theme_colorGets or sets a ThemeColor object that represents the foreground color for the fill.
fore_tint_and_shadeGets or sets a double value that lightens or darkens the foreground color.
gradient_angleGets or sets the angle of the gradient fill.
gradient_stopsGets a collection of GradientStop objects for the fill.
gradient_styleGets the gradient style GradientStyle for the fill.
gradient_variantGets the gradient variant GradientVariant for the fill.
image_bytesGets the raw bytes of the fill texture or pattern.
opacityGets or sets the degree of opacity of the specified fill as a value between 0.0 (clear) and 1.0 (opaque).
patternGets a PatternType for the fill.
preset_textureGets a PresetTexture for the fill.
rotate_with_objectGets or sets whether the fill rotates with the specified object.
texture_alignmentGets or sets the alignment for tile texture fill.
transparencyGets or sets the degree of transparency of the specified fill as a value between 0.0 (opaque) and 1.0 (clear).
visibleGets or sets value that is True if the formatting applied to this instance, is visible.

Methods

NameDescription
one_color_gradient(style, variant, degree)Sets the specified fill to a one-color gradient.
one_color_gradient(color, style, variant, degree)Sets the specified fill to a one-color gradient using the specified color.
patterned(pattern_type)Sets the specified fill to a pattern.
patterned(pattern_type, fore_color, back_color)Sets the specified fill to a pattern.
preset_textured(preset_texture)Sets the fill to a preset texture.
set_image(file_name)Changes the fill type to single image.
set_image(stream)Changes the fill type to single image.
set_image(image_bytes)Changes the fill type to single image.
solid()Sets the fill to a uniform color.
solid(color)Sets the fill to a specified uniform color.
two_color_gradient(style, variant)Sets the specified fill to a two-color gradient.
two_color_gradient(color1, color2, style, variant)Sets the specified fill to a two-color gradient.

Examples

Shows how to fill a shape with a solid color.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
# Write some text, and then cover it with a floating shape.
builder.font.size = 32
builder.writeln('Hello world!')
shape = builder.insert_shape(aw.drawing.ShapeType.CLOUD_CALLOUT, aw.drawing.RelativeHorizontalPosition.LEFT_MARGIN, 25, aw.drawing.RelativeVerticalPosition.TOP_MARGIN, 25, 250, 150, aw.drawing.WrapType.NONE)
# Use the "stroke_color" property to set the color of the outline of the shape.
shape.stroke_color = aspose.pydrawing.Color.cadet_blue
# Use the "fill_color" property to set the color of the inside area of the shape.
shape.fill_color = aspose.pydrawing.Color.light_blue
# The "opacity" property determines how transparent the color is on a 0-1 scale,
# with 1 being fully opaque, and 0 being invisible.
# The shape fill by default is fully opaque, so we cannot see the text that this shape is on top of.
self.assertEqual(1.0, shape.fill.opacity)
# Set the shape fill color's opacity to a lower value so that we can see the text underneath it.
shape.fill.opacity = 0.3
doc.save(ARTIFACTS_DIR + 'Shape.fill.docx')

See Also