Bug 58216 - provide picture-shape resize that maintains the aspect ratio
Summary: provide picture-shape resize that maintains the aspect ratio
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 3.13-dev
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Keywords: PatchAvailable
Depends on: 58207
  Show dependency tree
Reported: 2015-08-06 06:04 UTC by mark.o
Modified: 2015-09-21 00:16 UTC (History)
0 users

patch with proposed changes (8.15 KB, patch)
2015-08-06 06:04 UTC, mark.o
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mark.o 2015-08-06 06:04:10 UTC
Created attachment 32974 [details]
patch with proposed changes

This functionality is useful when using placeholder anchor information when placing images.

(pseudo-)code example:

        // content placeholders
        LinkedList<XSLFTextShape> placeContent = ...;

            XSLFShape place = placeContent.poll();
            Rectangle2D anchor = place.getAnchor();

            XSLFPictureShape shape = slide.createPicture

            shape.resize(anchor, RectAlign.TOP_RIGHT);

Depends on #58207
Comment 1 Andreas Beeker 2015-09-21 00:16:05 UTC
Thank you for the patch - applied with r1704206

I've moved the functionality to Common SL, i.e. DrawPictureShape.
As the X/HSLF classes only implement an interface, opposed to abstract base 
classes of X/HSSF, I needed to find a location to place the code.
As resize is kind of drawing related, I though DrawPictureShape is a good 

Apart of that I've reworked the PictureData.getImageDimension() - now the size 
is returned in points, as all other methods return points too.