ThreeDFormat

Inheritance: java.lang.Object, com.aspose.slides.PVIObject

All Implemented Interfaces: com.aspose.slides.IThreeDFormat, com.aspose.slides.IThreeDParamSource

public final class ThreeDFormat extends PVIObject implements IThreeDFormat, IThreeDParamSource

Represents 3-D properties.


The following example shows how to add 3D shape in PowerPoint Presentation.
 
 // Create an instance of Presentation class.
 Presentation pres = new Presentation();
 try {
     // Add a shape using AddAutoShape method
     IAutoShape shape = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 200, 200);
     // Define TextFrame and its properties
     shape.getTextFrame().setText("3D");
     shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(64);
     // Define ThreeDFormat Properties
     shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront);
     shape.getThreeDFormat().getCamera().setRotation(20, 30, 40);
     shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat);
     shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top);
     shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat);
     shape.getThreeDFormat().setExtrusionHeight(100);
     shape.getThreeDFormat().getExtrusionColor().setColor(Color.BLUE);
     // Save the Presentation file
     pres.save("sandbox_3d.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }
 
 The following example shows how to apply Gradient affect to 3D shape in PowerPoint Presentation.
 
 // Create an instance of Presentation class.
 Presentation pres = new Presentation();
 try {
     // Add a shape using AddAutoShape method
     IAutoShape shape = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
     // Define TextFrame and its properties
     shape.getTextFrame().setText("3D Gradient");
     shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(64);
     // Configure FillFormat.FillType as FillType.Gradient and define gradient properties
     shape.getFillFormat().setFillType(FillType.Gradient);
     shape.getFillFormat().getGradientFormat().getGradientStops().add(0, Color.BLUE);
     shape.getFillFormat().getGradientFormat().getGradientStops().add(100, Color.ORANGE);
     // Define ThreeDFormat Properties
     shape.getThreeDFormat().getCamera().setCameraType(CameraPresetType.OrthographicFront);
     shape.getThreeDFormat().getCamera().setRotation(20, 30, 40);
     shape.getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Flat);
     shape.getThreeDFormat().getLightRig().setDirection(LightingDirection.Top);
     shape.getThreeDFormat().setMaterial(MaterialPresetType.Flat);
     shape.getThreeDFormat().setExtrusionHeight(100);
     shape.getThreeDFormat().getExtrusionColor().setColor(Color.BLUE);
     // Save the Presentation file
     pres.save("sandbox_3d.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }
 
 The following example shows how to apply 3D effect on text. For creating a 3D text its possible to use WordArt transform effect.
 
 // Create an instance of Presentation class.
 Presentation pres = new Presentation();
 try {
     // Add a shape using AddAutoShape method
      IAutoShape shape = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
     // Define TextFrame and its properties
     shape.getTextFrame().setText("3D Text");
     // Configure FillFormat.FillType as FillType.NoFill
     shape.getFillFormat().setFillType(FillType.NoFill);
     shape.getLineFormat().getFillFormat().setFillType(FillType.NoFill);
     // Configure Portion of TextFrame and configure properties of PortionFormat
     Portion portion = (Portion)shape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0);
     portion.getPortionFormat().getFillFormat().setFillType(FillType.Pattern);
     portion.getPortionFormat().getFillFormat().getPatternFormat().getForeColor().setColor(Color.ORANGE);
     portion.getPortionFormat().getFillFormat().getPatternFormat().getBackColor().setColor(Color.WHITE);
     portion.getPortionFormat().getFillFormat().getPatternFormat().setPatternStyle(PatternStyle.LargeGrid);
     shape.getTextFrame().getParagraphs().get_Item(0).getParagraphFormat().getDefaultPortionFormat().setFontHeight(128);
     ITextFrame textFrame = shape.getTextFrame();
     // setup "Arch Up" WordArt transform effect
     textFrame.getTextFrameFormat().setTransform(TextShapeType.ArchUp);
     // Define ThreeDFormat Properties of ITextFrame
     textFrame.getTextFrameFormat().getThreeDFormat().setExtrusionHeight(3.5f);
     textFrame.getTextFrameFormat().getThreeDFormat().setDepth(3);
     textFrame.getTextFrameFormat().getThreeDFormat().setMaterial(MaterialPresetType.Plastic);
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setDirection(LightingDirection.Top);
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setLightType(LightRigPresetType.Balanced);
     textFrame.getTextFrameFormat().getThreeDFormat().getLightRig().setRotation(0, 0, 40);
     textFrame.getTextFrameFormat().getThreeDFormat().getCamera().setCameraType(CameraPresetType.PerspectiveContrastingRightFacing);
     // Save the Presentation file
     pres.save("text3d.pptx", SaveFormat.Pptx);
 } finally {
     if (pres != null) pres.dispose();
 }

Methods

MethodDescription
getVersion()
getContourWidth()Returns or sets the width of a 3D contour.
setContourWidth(double value)Returns or sets the width of a 3D contour.
getExtrusionHeight()Returns or sets the height of an extrusion effect.
setExtrusionHeight(double value)Returns or sets the height of an extrusion effect.
getDepth()Returns or sets the depth of a 3D shape.
setDepth(double value)Returns or sets the depth of a 3D shape.
getBevelTop()Returns or sets the type of a top 3D bevel.
getBevelBottom()Returns or sets the type of a bottom 3D bevel.
getContourColor()Returns or sets the color of a contour.
getExtrusionColor()Returns or sets the color of an extrusion.
getCamera()Returns or sets the settings of a camera.
getLightRig()Returns or sets the type of a light.
getMaterial()Returns or sets the type of a material.
setMaterial(int value)Returns or sets the type of a material.
getEffective()Gets effective 3-D formatting data with the inheritance applied.

getVersion()

public long getVersion()

Version. Read-only long.

Returns: long

getContourWidth()

public final double getContourWidth()

Returns or sets the width of a 3D contour. Read/write double.

Returns: double

setContourWidth(double value)

public final void setContourWidth(double value)

Returns or sets the width of a 3D contour. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getExtrusionHeight()

public final double getExtrusionHeight()

Returns or sets the height of an extrusion effect. Read/write double.

Returns: double

setExtrusionHeight(double value)

public final void setExtrusionHeight(double value)

Returns or sets the height of an extrusion effect. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getDepth()

public final double getDepth()

Returns or sets the depth of a 3D shape. Read/write double.

Returns: double

setDepth(double value)

public final void setDepth(double value)

Returns or sets the depth of a 3D shape. Read/write double.

Parameters:

ParameterTypeDescription
valuedouble

getBevelTop()

public final IShapeBevel getBevelTop()

Returns or sets the type of a top 3D bevel. Read-only IShapeBevel.

Returns: IShapeBevel

getBevelBottom()

public final IShapeBevel getBevelBottom()

Returns or sets the type of a bottom 3D bevel. Read-only IShapeBevel.

Returns: IShapeBevel

getContourColor()

public final IColorFormat getContourColor()

Returns or sets the color of a contour. Read-only IColorFormat.

Returns: IColorFormat

getExtrusionColor()

public final IColorFormat getExtrusionColor()

Returns or sets the color of an extrusion. Read-only IColorFormat.

Returns: IColorFormat

getCamera()

public final ICamera getCamera()

Returns or sets the settings of a camera. Read-only ICamera.

Returns: ICamera

getLightRig()

public final ILightRig getLightRig()

Returns or sets the type of a light. Read-only ILightRig.

Returns: ILightRig

getMaterial()

public final int getMaterial()

Returns or sets the type of a material. Read/write MaterialPresetType.

Returns: int

setMaterial(int value)

public final void setMaterial(int value)

Returns or sets the type of a material. Read/write MaterialPresetType.

Parameters:

ParameterTypeDescription
valueint

getEffective()

public final IThreeDFormatEffectiveData getEffective()

Gets effective 3-D formatting data with the inheritance applied.


This example demonstrates how to get effective properties for camera, light rig and shape's top bevel.
 
 Presentation pres = new Presentation("MyPresentation.pptx");
 try 
 {
     IThreeDFormatEffectiveData threeDEffectiveData = pres.getSlides().get_Item(0).getShapes().get_Item(0).getThreeDFormat().getEffective();
     System.out.println("= Effective camera properties =");
     System.out.println("Type: " + threeDEffectiveData.getCamera().getCameraType());
     System.out.println("Field of view: " + threeDEffectiveData.getCamera().getFieldOfViewAngle());
     System.out.println("Zoom: " + threeDEffectiveData.getCamera().getZoom());
     System.out.println("= Effective light rig properties =");
     System.out.println("Type: " + threeDEffectiveData.getLightRig().getLightType());
     System.out.println("Direction: " + threeDEffectiveData.getLightRig().getDirection());
     System.out.println("= Effective shape's top face relief properties =");
     System.out.println("Type: " + threeDEffectiveData.getBevelTop().getBevelType());
     System.out.println("Width: " + threeDEffectiveData.getBevelTop().getWidth());
     System.out.println("Height: " + threeDEffectiveData.getBevelTop().getHeight());
 } finally {
  if (pres != null) pres.dispose();
 }

Returns: IThreeDFormatEffectiveData - A IThreeDFormatEffectiveData.