Bug 58216

Summary: provide picture-shape resize that maintains the aspect ratio
Product: POI Reporter: mark.o <Mark.Olesen>
Component: XSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: PatchAvailable
Priority: P2    
Version: 3.13-dev   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Bug Depends on: 58207    
Bug Blocks:    
Attachments: patch with proposed changes

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 = ...;

        LOOP:
        {
            XSLFShape place = placeContent.poll();
            Rectangle2D anchor = place.getAnchor();
            slide.removeShape(place);

            XSLFPictureShape shape = slide.createPicture
            (
                slide.getSlideShow().addPicture
                (
                    ...
                )
            );

            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 
place.

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