Aspose.Slides FOSS for Java lets you apply professional-quality visual effects to PowerPoint shapes entirely in Java, with no Microsoft Office and no API keys. This post demonstrates the fill system, 2D effects, and 3D formatting available in the library.


The Fill System

Every shape has a fill format accessed via getFillFormat() that controls how its interior is painted. The five fill types cover the full range of PowerPoint’s design palette.

Solid Fill

The simplest fill, a flat color with optional transparency:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.ROUND_CORNER_RECTANGLE, 100, 100, 400, 150
    );
    shape.addTextFrame("Solid Fill");

    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(new Color(30, 80, 180));

    prs.save("solid.pptx");
}

Linear Gradient Fill

Gradient stops let you blend from one color to another across the shape:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.RECTANGLE, 100, 100, 400, 150
    );

    IFillFormat ff = shape.getFillFormat();
    ff.setFillType(FillType.GRADIENT);
    IGradientFormat gf = ff.getGradientFormat();
    gf.setGradientShape(GradientShape.LINEAR);
    gf.setLinearGradientAngle(90);   // top-to-bottom

    gf.getGradientStops().add(0.0f, new Color(30, 80, 180));   // top: blue
    gf.getGradientStops().add(1.0f, new Color(0, 200, 160));   // bottom: teal

    prs.save("gradient.pptx");
}

2D Visual Effects

Outer Drop Shadow

Attach a semi-transparent drop shadow to any shape:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.ROUND_CORNER_RECTANGLE, 100, 100, 350, 150
    );
    shape.addTextFrame("Drop Shadow");

    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(Color.WHITE);

    IEffectFormat ef = shape.getEffectFormat();
    ef.enableOuterShadowEffect();
    ef.getOuterShadowEffect().setBlurRadius(12);
    ef.getOuterShadowEffect().setDirection(315);   // upper-left
    ef.getOuterShadowEffect().setDistance(8);
    ef.getOuterShadowEffect().getShadowColor().setColor(new Color(0, 0, 0, 100));

    prs.save("shadow.pptx");
}

Glow Effect

A colored halo around the shape edge:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.ELLIPSE, 150, 100, 250, 250
    );
    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(new Color(20, 60, 140));

    IEffectFormat ef = shape.getEffectFormat();
    ef.enableGlowEffect();
    ef.getGlowEffect().setRadius(20);
    ef.getGlowEffect().getColor().setColor(new Color(0, 180, 255, 200));

    prs.save("glow.pptx");
}

3D Formatting

Bevel and Material

The getThreeDFormat() method gives any flat shape a three-dimensional appearance. Combine a bevel with a camera preset and a material for the richest result:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.RECTANGLE, 150, 150, 300, 130
    );
    shape.addTextFrame("Metal Button");

    // Blue solid fill
    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(new Color(20, 70, 160));

    // 3D bevel + camera + light + material
    IThreeDFormat tdf = shape.getThreeDFormat();
    tdf.getBevelTop().setBevelType(BevelPresetType.CIRCLE);
    tdf.getBevelTop().setWidth(10);
    tdf.getBevelTop().setHeight(5);
    tdf.getCamera().setCameraType(CameraPresetType.PERSPECTIVE_ABOVE);
    tdf.getLightRig().setLightType(LightRigPresetType.BALANCED);
    tdf.getLightRig().setDirection(LightingDirection.TOP);
    tdf.setMaterial(MaterialPresetType.METAL);
    tdf.setDepth(20);

    prs.save("metal-button.pptx");
}

Combining Effects on the Same Shape

Shadow and 3D formatting can coexist on a single shape, enabling polished “card” designs:

import org.aspose.slides.foss.*;

try (Presentation prs = new Presentation()) {
    IAutoShape shape = prs.getSlides().get(0).getShapes().addAutoShape(
        ShapeType.ROUND_CORNER_RECTANGLE, 120, 120, 360, 150
    );
    shape.addTextFrame("Premium Card");

    // Fill
    shape.getFillFormat().setFillType(FillType.SOLID);
    shape.getFillFormat().getSolidFillColor().setColor(new Color(30, 80, 180));

    // 3D bevel
    IThreeDFormat tdf = shape.getThreeDFormat();
    tdf.getBevelTop().setBevelType(BevelPresetType.CIRCLE);
    tdf.getBevelTop().setWidth(8);
    tdf.getCamera().setCameraType(CameraPresetType.PERSPECTIVE_ABOVE);
    tdf.setMaterial(MaterialPresetType.PLASTIC);

    // Drop shadow
    IEffectFormat ef = shape.getEffectFormat();
    ef.enableOuterShadowEffect();
    ef.getOuterShadowEffect().setBlurRadius(14);
    ef.getOuterShadowEffect().setDirection(270);
    ef.getOuterShadowEffect().setDistance(8);
    ef.getOuterShadowEffect().getShadowColor().setColor(new Color(0, 0, 0, 70));

    prs.save("premium-card.pptx");
}

Installation

<dependency>
    <groupId>org.aspose.slides.foss</groupId>
    <artifactId>aspose-slides-foss</artifactId>
    <version>1.0.0</version>
</dependency>

No Office installation, no license keys, no network calls; all processing happens locally.