com.aspose.words
Class Fill

java.lang.Object
    extended by com.aspose.words.Fill

public class Fill 
extends java.lang.Object

Defines a fill for a shape.

Use the Shape.Fill property to access fill properties of a shape. You do not create instances of the Fill class directly.

Although the Fill class provides properties to specify solid color fill only, all of the more complex fill types, including as gradient, pattern and texture are fully preserved during document open-save cycles.

Example:

Demonstrates how to create shapes with fill.
DocumentBuilder builder = new DocumentBuilder();

builder.writeln();
builder.writeln();
builder.writeln();
builder.write("Some text under the shape.");

// Create a red balloon, semitransparent.
// The shape is floating and its coordinates are (0,0) by default, relative to the current paragraph.
Shape shape = new Shape(builder.getDocument(), ShapeType.BALLOON);
shape.setFillColor(Color.RED);
shape.getFill().setOpacity(0.3);
shape.setWidth(100);
shape.setHeight(100);
shape.setTop(-100);
builder.insertNode(shape);

builder.getDocument().save(getMyDir() + "Shape.Fill Out.doc");
See Also:
Shape.Fill

Property Getters/Setters Summary
java.awt.ColorgetColor()
voidsetColor(java.awt.Color value)
           Defines the color of a fill.
byte[]getImageBytes()
           Gets the raw bytes of the fill texture or pattern.
booleangetOn()
voidsetOn(boolean value)
           Determines whether the shape will be filled.
doublegetOpacity()
voidsetOpacity(double value)
           Defines the transparency of a fill. Valid range from 0 to 1, where 0 is fully transparent and 1 is fully opaque.
 

Property Getters/Setters Detail

getColor/setColor

public java.awt.Color getColor() / public void setColor(java.awt.Color value)
Defines the color of a fill.

The default value is java.awt.Color.WHITE.


getImageBytes

public byte[] getImageBytes()
Gets the raw bytes of the fill texture or pattern.

The default value is null.


getOn/setOn

public boolean getOn() / public void setOn(boolean value)
Determines whether the shape will be filled.

The default value is true.


getOpacity/setOpacity

public double getOpacity() / public void setOpacity(double value)
Defines the transparency of a fill. Valid range from 0 to 1, where 0 is fully transparent and 1 is fully opaque.

The default value is 1.

Example:

Demonstrates how to create shapes with fill.
DocumentBuilder builder = new DocumentBuilder();

builder.writeln();
builder.writeln();
builder.writeln();
builder.write("Some text under the shape.");

// Create a red balloon, semitransparent.
// The shape is floating and its coordinates are (0,0) by default, relative to the current paragraph.
Shape shape = new Shape(builder.getDocument(), ShapeType.BALLOON);
shape.setFillColor(Color.RED);
shape.getFill().setOpacity(0.3);
shape.setWidth(100);
shape.setHeight(100);
shape.setTop(-100);
builder.insertNode(shape);

builder.getDocument().save(getMyDir() + "Shape.Fill Out.doc");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.