Examples of AFPUnitConverter


Examples of org.apache.fop.afp.AFPUnitConverter

        super.processNode(elementName, locator, attlist, propertyList);
        AFPPageOverlay pageOverlay = getPageSetupAttachment();
        if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(elementName)) {
            // convert user specific units to mpts and set the coordinates for the page overlay
            AFPPaintingState paintingState = new AFPPaintingState();
            AFPUnitConverter unitConverter = new AFPUnitConverter(paintingState);
            int x = (int)unitConverter.mpt2units(UnitConv.convert(attlist.getValue(ATT_X)));
            int y = (int)unitConverter.mpt2units(UnitConv.convert(attlist.getValue(ATT_Y)));
            pageOverlay.setX(x);
            pageOverlay.setY(y);
        }
    }
View Full Code Here

Examples of org.apache.fop.afp.AFPUnitConverter

     * @return the newly created object area info instance
     */
    public static AFPObjectAreaInfo createObjectAreaInfo(AFPPaintingState paintingState,
            Rectangle targetRect) {
        AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo();
        AFPUnitConverter unitConv = paintingState.getUnitConverter();

        int[] coords = unitConv.mpts2units(new float[] {targetRect.x, targetRect.y});
        objectAreaInfo.setX(coords[X]);
        objectAreaInfo.setY(coords[Y]);

        int width = Math.round(unitConv.mpt2units(targetRect.width));
        objectAreaInfo.setWidth(width);

        int height = Math.round(unitConv.mpt2units(targetRect.height));
        objectAreaInfo.setHeight(height);

        int resolution = paintingState.getResolution();
        objectAreaInfo.setHeightRes(resolution);
        objectAreaInfo.setWidthRes(resolution);
View Full Code Here

Examples of org.apache.fop.afp.AFPUnitConverter

     * @param targetRect the target rectangle in which to place the image (coordinates in mpt)
     * @return the newly created object area info instance
     */
    public static AFPObjectAreaInfo createObjectAreaInfo(AFPPaintingState paintingState,
            Rectangle targetRect) {
        AFPUnitConverter unitConv = paintingState.getUnitConverter();

        int[] coords = unitConv.mpts2units(new float[] {targetRect.x, targetRect.y});

        int width = Math.round(unitConv.mpt2units(targetRect.width));

        int height = Math.round(unitConv.mpt2units(targetRect.height));

        int resolution = paintingState.getResolution();
        AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(coords[X], coords[Y], width,
                height, resolution, paintingState.getRotation());
        return objectAreaInfo;
View Full Code Here

Examples of org.apache.fop.afp.AFPUnitConverter

            int x, int y, int width, int height, int resolution) {
        // set the data object parameters

        AffineTransform at = paintingState.getData().getTransform();
        at.translate(x, y);
        AFPUnitConverter unitConv = paintingState.getUnitConverter();

        int rotation = paintingState.getRotation();
        int objX = (int) Math.round(at.getTranslateX());
        int objY = (int) Math.round(at.getTranslateY());
        int objWidth = Math.round(unitConv.mpt2units(width));
        int objHeight = Math.round(unitConv.mpt2units(height));
        AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(objX, objY, objWidth, objHeight,
                resolution, rotation);
        return objectAreaInfo;
    }
View Full Code Here

Examples of org.apache.fop.afp.AFPUnitConverter

        super.processNode(elementName, locator, attlist, propertyList);
        AFPPageOverlay pageOverlay = getPageSetupAttachment();
        if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(elementName)) {
            // convert user specific units to mpts and set the coordinates for the page overlay
            AFPPaintingState paintingState = new AFPPaintingState();
            AFPUnitConverter unitConverter = new AFPUnitConverter(paintingState);
            int x = (int)unitConverter.mpt2units(UnitConv.convert(attlist.getValue(ATT_X)));
            int y = (int)unitConverter.mpt2units(UnitConv.convert(attlist.getValue(ATT_Y)));
            pageOverlay.setX(x);
            pageOverlay.setY(y);
        }
    }
View Full Code Here

Examples of org.apache.fop.afp.AFPUnitConverter

        objectAreaInfo.setY((int)Math.round(at.getTranslateY()));

        objectAreaInfo.setWidthRes(resolution);
        objectAreaInfo.setHeightRes(resolution);

        AFPUnitConverter unitConv = paintingState.getUnitConverter();
        objectAreaInfo.setWidth(Math.round(unitConv.mpt2units(width)));
        objectAreaInfo.setHeight(Math.round(unitConv.mpt2units(height)));

        int rotation = paintingState.getRotation();
        objectAreaInfo.setRotation(rotation);

        return objectAreaInfo;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.