Examples of AFPGraphicsObjectInfo


Examples of org.apache.fop.afp.AFPGraphicsObjectInfo

                throws IOException {
        AFPRenderingContext afpContext = (AFPRenderingContext)context;
        ImageXMLDOM imageSVG = (ImageXMLDOM)image;
        FOUserAgent userAgent = afpContext.getUserAgent();

        AFPGraphicsObjectInfo graphicsObjectInfo = (AFPGraphicsObjectInfo)createDataObjectInfo();
        AFPResourceInfo resourceInfo = graphicsObjectInfo.getResourceInfo();
        setDefaultToInlineResourceLevel(graphicsObjectInfo);

        // Create a new AFPGraphics2D
        AFPPaintingState paintingState = afpContext.getPaintingState();
        final boolean textAsShapes = paintingState.isStrokeGOCAText();
        AFPGraphics2D g2d = new AFPGraphics2D(
                textAsShapes,
                afpContext.getPaintingState(),
                afpContext.getResourceManager(),
                resourceInfo,
                (textAsShapes ? null : afpContext.getFontInfo()));
        g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());

        paintingState.setImageUri(image.getInfo().getOriginalURI());

        // Create an AFPBridgeContext
        BridgeContext bridgeContext = AFPSVGHandler.createBridgeContext(userAgent, g2d);

        // Cloning SVG DOM as Batik attaches non-thread-safe facilities (like the CSS engine)
        // to it.
        Document clonedDoc = BatikUtil.cloneSVGDocument(imageSVG.getDocument());

        // Build the SVG DOM and provide the painter with it
        GraphicsNode root;
        try {
            GVTBuilder builder = new GVTBuilder();
            root = builder.build(bridgeContext, clonedDoc);
        } catch (Exception e) {
            SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
                    context.getUserAgent().getEventBroadcaster());
            eventProducer.svgNotBuilt(this, e, image.getInfo().getOriginalURI());
            return;
        }

        // Image positioning
        AFPObjectAreaInfo objectAreaInfo = AFPImageHandler.createObjectAreaInfo(paintingState, pos);
        graphicsObjectInfo.setObjectAreaInfo(objectAreaInfo);

        paintingState.save(); // save
        AffineTransform placement = new AffineTransform();
        placement.translate(pos.x, pos.y);
        paintingState.concatenate(placement);

        //Set up painter and target
        graphicsObjectInfo.setGraphics2D(g2d);
        // Create Graphics2DImagePainter
        Dimension imageSize = image.getSize().getDimensionMpt();
        Graphics2DImagePainter painter = new Graphics2DImagePainterImpl(
                root, bridgeContext, imageSize);
        graphicsObjectInfo.setPainter(painter);

        // Create the GOCA GraphicsObject in the DataStream
        AFPResourceManager resourceManager = afpContext.getResourceManager();
        resourceManager.createObject(graphicsObjectInfo);
View Full Code Here

Examples of org.apache.fop.afp.AFPGraphicsObjectInfo

        AFPObjectAreaInfo objectAreaInfo
            = createObjectAreaInfo(paintingState, x, y, width, height, resolution);

        // Create AFPGraphicsObjectInfo
        AFPResourceInfo resourceInfo = afpInfo.getResourceInfo();
        AFPGraphicsObjectInfo graphicsObjectInfo = createGraphicsObjectInfo(
                paintingState, painter, userAgent, resourceInfo, g2d);
        graphicsObjectInfo.setObjectAreaInfo(objectAreaInfo);

        // Create the GOCA GraphicsObject in the DataStream
        AFPResourceManager resourceManager = afpInfo.getResourceManager();
        resourceManager.createObject(graphicsObjectInfo);
View Full Code Here

Examples of org.apache.fop.afp.AFPGraphicsObjectInfo

    }

    private AFPGraphicsObjectInfo createGraphicsObjectInfo
        (AFPPaintingState paintingState, Graphics2DImagePainter painter,
            FOUserAgent userAgent, AFPResourceInfo resourceInfo, AFPGraphics2D g2d) {
        AFPGraphicsObjectInfo graphicsObjectInfo = new AFPGraphicsObjectInfo();

        String uri = paintingState.getImageUri();
        graphicsObjectInfo.setUri(uri);

        graphicsObjectInfo.setMimeType(MimeConstants.MIME_AFP_GOCA);

        graphicsObjectInfo.setResourceInfo(resourceInfo);

        graphicsObjectInfo.setPainter(painter);

        // Set the afp graphics 2d implementation
        graphicsObjectInfo.setGraphics2D(g2d);

        return graphicsObjectInfo;
    }
View Full Code Here

Examples of org.apache.fop.afp.AFPGraphicsObjectInfo

        AFPObjectAreaInfo objectAreaInfo
            = createObjectAreaInfo(paintingState, x, y, width, height, resolution);

        // Create AFPGraphicsObjectInfo
        AFPResourceInfo resourceInfo = afpInfo.getResourceInfo();
        AFPGraphicsObjectInfo graphicsObjectInfo = createGraphicsObjectInfo(
                paintingState, painter, userAgent, resourceInfo, g2d);
        graphicsObjectInfo.setObjectAreaInfo(objectAreaInfo);

        // Create the GOCA GraphicsObject in the DataStream
        AFPResourceManager resourceManager = afpInfo.getResourceManager();
        resourceManager.createObject(graphicsObjectInfo);
View Full Code Here

Examples of org.apache.fop.afp.AFPGraphicsObjectInfo

        return objectAreaInfo;
    }

    private AFPGraphicsObjectInfo createGraphicsObjectInfo(AFPPaintingState paintingState, Graphics2DImagePainter painter,
            FOUserAgent userAgent, AFPResourceInfo resourceInfo, AFPGraphics2D g2d) {
        AFPGraphicsObjectInfo graphicsObjectInfo = new AFPGraphicsObjectInfo();

        String uri = paintingState.getImageUri();
        graphicsObjectInfo.setUri(uri);

        graphicsObjectInfo.setMimeType(MimeConstants.MIME_AFP_GOCA);

        graphicsObjectInfo.setResourceInfo(resourceInfo);

        graphicsObjectInfo.setPainter(painter);

        // Set the afp graphics 2d implementation
        graphicsObjectInfo.setGraphics2D(g2d);

        return graphicsObjectInfo;
    }
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.