Introduction

Aspose.Slides FOSS for C++ lets you apply professional-quality visual effects to PowerPoint shapes in native C++, with no Microsoft Office and no API keys required. This guide shows how to use the fill system (solid and gradient), 2D effects (drop shadows and glow), and 3D formatting (bevels, camera presets, and materials) to produce polished presentations entirely in code.

Quick Start

Add the library to your CMake project (see Getting Started below), then apply a solid blue fill to a rounded rectangle and save it as PPTX:

#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/export/save_format.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::ROUND_CORNER_RECTANGLE, 100, 100, 400, 150
    );
    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 30, 80, 180));
    prs.save("out.pptx", SaveFormat::PPTX);
    return 0;
}

The Fill System

Every shape has a fill_format() that controls how its interior is painted. The four fill types demonstrated below cover the core of PowerPoint’s design palette.

Solid Fill

FillType::SOLID paints the shape interior with a flat color at a given opacity. Call solid_fill_color().set_color() with an ARGB value to set the color; the alpha channel controls transparency:

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::ROUND_CORNER_RECTANGLE, 100, 100, 400, 150
    );
    shape.text_frame()->set_text("Solid Fill");

    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 30, 80, 180));

    prs.save("solid.pptx", SaveFormat::PPTX);
    return 0;
}

Linear Gradient Fill

FillType::GRADIENT blends between two or more colors across the shape. Add stops at position 0.0 (start) and 1.0 (end), and set set_linear_gradient_angle() to control the direction:

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/gradient_format.h>
#include <Aspose/Slides/Foss/gradient_shape.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::RECTANGLE, 100, 100, 400, 150
    );

    auto& ff = shape.fill_format();
    ff.set_fill_type(FillType::GRADIENT);
    auto& gf = ff.gradient_format();
    gf.set_gradient_shape(GradientShape::LINEAR);
    gf.set_linear_gradient_angle(90);   // top-to-bottom

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

    prs.save("gradient.pptx", SaveFormat::PPTX);
    return 0;
}

2D Visual Effects

Outer Drop Shadow

Call EffectFormat::enable_outer_shadow_effect() to attach a drop shadow to a shape. Configure set_blur_radius() (softness), set_direction() (angle in degrees), and set_distance() (offset from the shape edge):

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/effect_format.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::ROUND_CORNER_RECTANGLE, 100, 100, 350, 150
    );
    shape.text_frame()->set_text("Drop Shadow");

    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::white);

    auto& ef = shape.effect_format();
    ef.enable_outer_shadow_effect();
    auto* shadow = ef.outer_shadow_effect();
    shadow->set_blur_radius(12);
    shadow->set_direction(315);   // upper-left
    shadow->set_distance(8);
    shadow->shadow_color().set_color(Color::from_argb(100, 0, 0, 0));

    prs.save("shadow.pptx", SaveFormat::PPTX);
    return 0;
}

Glow Effect

Call EffectFormat::enable_glow_effect() to surround a shape with a colored halo. Set set_radius() to control how far the glow extends from the edge (in points), and set the glow color separately from the shape fill:

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/effect_format.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::ELLIPSE, 150, 100, 250, 250
    );
    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 20, 60, 140));

    auto& ef = shape.effect_format();
    ef.enable_glow_effect();
    auto* glow = ef.glow_effect();
    glow->set_radius(20);
    glow->color().set_color(Color::from_argb(200, 0, 180, 255));

    prs.save("glow.pptx", SaveFormat::PPTX);
    return 0;
}

3D Formatting

Bevel and Material

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

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/bevel_preset_type.h>
#include <Aspose/Slides/Foss/camera_preset_type.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/light_rig_preset_type.h>
#include <Aspose/Slides/Foss/lighting_direction.h>
#include <Aspose/Slides/Foss/material_preset_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>
#include <Aspose/Slides/Foss/three_d_format.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::RECTANGLE, 150, 150, 300, 130
    );
    shape.text_frame()->set_text("Metal Button");

    // Blue solid fill
    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 20, 70, 160));

    // 3D bevel + camera + light + material
    auto& tdf = shape.three_d_format();
    tdf.bevel_top().set_bevel_type(BevelPresetType::CIRCLE);
    tdf.bevel_top().set_width(10);
    tdf.bevel_top().set_height(5);
    tdf.camera().set_camera_type(CameraPresetType::PERSPECTIVE_ABOVE);
    tdf.light_rig().set_light_type(LightRigPresetType::BALANCED);
    tdf.light_rig().set_direction(LightingDirection::TOP);
    tdf.set_material(MaterialPresetType::METAL);
    tdf.set_depth(20);

    prs.save("metal-button.pptx", SaveFormat::PPTX);
    return 0;
}

Combining Effects on the Same Shape

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

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/bevel_preset_type.h>
#include <Aspose/Slides/Foss/camera_preset_type.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/effect_format.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/material_preset_type.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>
#include <Aspose/Slides/Foss/three_d_format.h>

using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;

int main() {
    Presentation prs;
    auto& shape = prs.slides()[0].shapes().add_auto_shape(
        ShapeType::ROUND_CORNER_RECTANGLE, 120, 120, 360, 150
    );
    shape.text_frame()->set_text("Premium Card");

    // Fill
    shape.fill_format().set_fill_type(FillType::SOLID);
    shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 30, 80, 180));

    // 3D bevel
    auto& tdf = shape.three_d_format();
    tdf.bevel_top().set_bevel_type(BevelPresetType::CIRCLE);
    tdf.bevel_top().set_width(8);
    tdf.camera().set_camera_type(CameraPresetType::PERSPECTIVE_ABOVE);
    tdf.set_material(MaterialPresetType::PLASTIC);

    // Drop shadow
    auto& ef = shape.effect_format();
    ef.enable_outer_shadow_effect();
    auto* shadow = ef.outer_shadow_effect();
    shadow->set_blur_radius(14);
    shadow->set_direction(270);
    shadow->set_distance(8);
    shadow->shadow_color().set_color(Color::from_argb(70, 0, 0, 0));

    prs.save("premium-card.pptx", SaveFormat::PPTX);
    return 0;
}

Getting Started

Add Aspose.Slides FOSS for C++ to your CMake project using FetchContent. After the FetchContent_MakeAvailable call, link your target against aspose_slides_foss:

include(FetchContent)
FetchContent_Declare(
    aspose_slides_foss
    GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
    GIT_TAG main
)
FetchContent_MakeAvailable(aspose_slides_foss)
target_link_libraries(your_target PRIVATE aspose_slides_foss)

No Microsoft Office installation or license keys are required; all processing runs in the local process with no external dependencies.