Fine-Tuned Picture Tiling
Aspose.Slides for Android via Java 24.8 gives you precise control over tiled picture fills within shapes and backgrounds. The new TileOffsetX
, TileOffsetY
, TileScaleX
, TileScaleY
, TileAlignment
, and TileFlip
properties allow for intricate adjustments. Check out the following code examples, highlighting how to use tiled picture fill in a new rectangle shape and the background, respectively.
Presentation pres = new Presentation();
try {
ISlide firstSlide = pres.getSlides().get_Item(0);
IPPImage ppImage;
IImage newImage = Images.fromFile("image.png");
ppImage = pres.getImages().addImage(newImage);
newImage.dispose();
// Adds the new Rectangle shape
IAutoShape newShape = firstSlide.getShapes().addAutoShape(ShapeType.Rectangle, 0, 0, 350, 350);
// Sets the fill type of the new shape to Picture
newShape.getFillFormat().setFillType(FillType.Picture);
// Sets the shape's fill image
IPictureFillFormat pictureFillFormat = newShape.getFillFormat().getPictureFillFormat();
pictureFillFormat.getPicture().setImage(ppImage);
// Sets the picture fill mode to Tile and changes the properties
pictureFillFormat.setPictureFillMode(PictureFillMode.Tile);
pictureFillFormat.setTileOffsetX(-275);
pictureFillFormat.setTileOffsetY(-247);
pictureFillFormat.setTileScaleX(25);
pictureFillFormat.setTileScaleY(15);
pictureFillFormat.setTileAlignment(RectangleAlignment.BottomRight);
pictureFillFormat.setTileFlip(TileFlip.FlipBoth);
pres.save("Tile.pptx", SaveFormat.Pptx);
} finally {
if (pres != null) pres.dispose();
}
Source*
Presentation pres = new Presentation();
try {
ISlide firstSlide = pres.getSlides().get_Item(0);
IPPImage ppImage;
IImage newImage = Images.fromFile("image.png");
ppImage = pres.getImages().addImage(newImage);
newImage.dispose();
// Gets the background of the first slide
IBackground background = firstSlide.getBackground();
// Sets the type of the background to OwnBackground.
background.setType(BackgroundType.OwnBackground);
// Sets the fill type of the background to Picture
background.getFillFormat().setFillType(FillType.Picture);
// Sets the background fill image
IPictureFillFormat backPictureFillFormat = background.getFillFormat().getPictureFillFormat();
backPictureFillFormat.getPicture().setImage(ppImage);
// Sets the picture fill mode to Tile and changes the properties
backPictureFillFormat.setPictureFillMode(PictureFillMode.Tile);
backPictureFillFormat.setTileOffsetX(15f);
backPictureFillFormat.setTileOffsetY(15f);
backPictureFillFormat.setTileScaleX(46f);
backPictureFillFormat.setTileScaleY(87f);
backPictureFillFormat.setTileAlignment(RectangleAlignment.Center);
backPictureFillFormat.setTileFlip(TileFlip.FlipY);
pres.save("BackgroundTile.pptx", SaveFormat.Pptx);
} finally {
if (pres != null) pres.dispose();
}
Source*
Enhanced Font Management
Developers can leverage the new GetFontBytes
method to extract byte data of fonts used in presentations with this release of the Android presentation manipulation library. The GetFontEmbeddingLevel
method enables you to understand how fonts can be embedded within presentations. The following two code samples illustrate extracting binary font data and font embedding levels from within a presentation, respectively.
Presentation pres = new Presentation ("Presentation.pptx");
try {
// Retrieve all fonts used in the presentation
IFontData[] fonts = pres.getFontsManager().getFonts();
// Get the byte array representing the regular style of the first font in the presentation
byte[] fontBytes = pres.getFontsManager().getFontBytes(fonts[0], FontStyle.Regular);
} finally {
if (pres != null) pres.dispose();
}
Source*
Presentation pres = new Presentation("Presentation.pptx");
try {
// Retrieve all fonts used in the presentation
IFontData[] fontDatas = pres.getFontsManager().getFonts();
// Get the byte array representing the regular style of the first font in the presentation
byte[] bytes = pres.getFontsManager().getFontBytes(fontDatas[0], FontStyle.Regular);
// Determine the embedding level of the font
int embeddingLevel = pres.getFontsManager().getFontEmbeddingLevel(bytes, fontDatas[0].getFontName());
} finally {
if (pres != null) pres.dispose();
}
Source*
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Slides for Android via Java 24.8 Release Notes.