Package org.axsl.graphic

Examples of org.axsl.graphic.Graphic


     * @exception GraphicException For error reading Graphic file.
     */
    private PsEncodeFilter getFilter(final OutputStream outputStream) throws GraphicException {
        final PsServer psServer = this.getPDFDocument().getPsServer();
        PsEncodeFilter filter = null;
        final Graphic graphic = this.getGraphic();
        if (graphic.getGraphicType() == Graphic.Type.JPEG) {
            filter = psServer.makeEncodeFilter(PsFilterType.DCT, outputStream);
            filter.setInactive();
            return filter;
        }
        if (graphic.getGraphicType() == Graphic.Type.TIFF) {
            final Graphic.Compression imageCompression
                    = graphic.getCompressionType();
            switch (imageCompression) {
            case UNCOMPRESSED:
                return null;
            case CCITT_GROUP_3:
                filter = psServer.makeEncodeFilter(PsFilterType.CCITT_FAX, outputStream);
                filter.setInactive();
                return filter;
            case CCITT_GROUP_4:
                filter = psServer.makeEncodeFilter(PsFilterType.CCITT_FAX, outputStream);
                filter.setInactive();
                filter.setDecodeParms("<< /K -1 /Columns " + graphic.pixelWidth() + " >>");
                return filter;
            case JPEG:
                filter = psServer.makeEncodeFilter(PsFilterType.DCT, outputStream);
                filter.setInactive();
                return filter;
            default:
                throw new GraphicException("Error while loading image "
                        + graphic.getUrl() + " : "
                        + this.getClass() + " - "
                        + "unsupported compression value "
                        + imageCompression);
            }
        }
View Full Code Here


            // error
            break;
        }

        try {
            final Graphic graphic = new TempImage(null, width, height, result);
            final AffineTransform at = getTransform();
            final double[] matrix =
                    new double[PsUtil.MATRIX_QTY_ELEMENTS];
            at.getMatrix(matrix);
            this.out.write("gsave");
            final Shape imclip = getClip();
            writeClip(imclip);
            this.out.write("1000 -1000 scale");
            // psRenderer.write("" + matrix[0] + " " + matrix[1] +
            // " " + matrix[2] + " " + matrix[3] + " " +
            // matrix[4] + " " + matrix[5] + " cm\n");

            /* TODO: The following line is commented out to avoid having this
             * class dependent on the PostScript renderer. After this is all
             * moved to the Graphics package, this needs to be reworked.
             * The "graphic" needs to be a real Graphic instance of the proper
             * type, and should then be converted to PostScript here. */
            graphic.close();
//            this.psRenderer.renderBitmap(graphic, x, -y, width, height);
            this.out.write("grestore");
        } catch (final IOException e) {
            this.logger.error(e.getMessage());
        }
View Full Code Here

        if (value() instanceof DtURI) {
            if (this.graphic != null) {
                return this.graphic;
            }
            final String src = ((DtURI) value()).getValue();
            Graphic backgroundImage = null;
            try {
                backgroundImage = fobj.getGraphicServer().makeGraphic(src,
                        fobj.getFoTree().getGraphicSearchPath(),
                        fobj.getFoTree().getCachingGraphics());
            } catch (final GraphicException imgex) {
View Full Code Here

     * Renders an area's background image, if any.
     * @param area The area whose background should be rendered.
     * @throws GalleyVisitorException For errors during rendering.
     */
    private void markBackgroundImage(final BackgroundArea area) throws GalleyVisitorException {
        final Graphic backgroundImage = area.traitBackgroundImage();
        if (backgroundImage == null) {
            return;
        }
        /*
         * Per XSL-FO Spec 1.0, Section 4.9.4, the background is rendered
         * inside the padding-rectangle.
         */
        final int x = area.prOriginX();
        final int y = area.prOriginY();
        final int w = area.prIpd();
        final int h = area.prBpd();

        if (h == 0 || w == 0) {
            return;
        }

        int imgW;
        int imgH;
        try {
            imgW = backgroundImage.absoluteWidth(getPixelsPerInch());
            imgH = backgroundImage.absoluteHeight(getPixelsPerInch());
        } catch (final GraphicException fie) {
            getLogger().error("Error obtaining bg image width and height");
            getLogger().error(fie.getMessage());
            return;
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void render(final ExternalGraphicArea area) throws GalleyVisitorException {
        final Graphic graphic = area.getGraphic();
        if (graphic == null) {
            throw new NullPointerException("Null graphic.");
        }
        final Rectangle contentRect = new Rectangle(area.crOriginX(),
                area.crOriginY(), area.referenceIpd(), area.referenceBpd());
View Full Code Here

        final int x = area.crOriginX();
        final int y = area.crOriginY();
        final int w = area.crIpd();
        final int h = area.crBpd();

        final Graphic img = area.getGraphic();

        if (img == null) {
            getLogger().error("Error while loading image : area.getImage() "
                    + "is null");

            // correct integer roundoff
            // graphics.drawRect(x / 1000, pageHeight - y / 1000,
            // w / 1000, h / 1000);
            addRect(x, y, w, h, true);    // use helper function


            final java.awt.Font f = this.graphics.getFont();
            final java.awt.Font smallFont = new java.awt.Font(f.getFontName(),
                                      f.getStyle(), 8);

            this.graphics.setFont(smallFont);

            // correct integer roundoff   // aml/rlc
            // graphics.drawString("area.getImage() is null", x / 1000,
            // pageHeight - y / 1000);

            this.graphics.drawString("area.getImage() is null",
                    Math.round(toPoints(x)),
                    this.pageHeight - Math.round(toPoints(y)));

            this.graphics.setFont(f);
        } else {
            if (img instanceof SvgGraphic) {
                final SvgGraphic svg = (SvgGraphic) img;
                final Rectangle contentRect = new Rectangle(area.crOriginX(),
                        area.crOriginY(), area.crIpd(), area.crBpd());
                renderSVGDocument(svg,
                        Renderer.convertMillipointRectangle(contentRect), null);
            } else {

                final String urlString = img.getUrl().toString();
                try {
                    final URL url = URLFactory.createURL(urlString);

                    final ImageIcon icon = new ImageIcon(url);
                    final Image image = icon.getImage();
View Full Code Here

        final int x = area.crOriginX();
        final int y = area.crOriginY();
        final int w = area.crIpd();
        final int h = area.crBpd();

        final Graphic img = area.getGraphic();

        try {
            printBMP(img, x, y, w, h);
        } catch (final GraphicException e) {
            getLogger().error("TXTRenderer.renderImageArea() printing BMP ("
View Full Code Here

        final int x = area.crOriginX();
        final int y = area.crOriginY();
        final int w = area.crIpd();
        final int h = area.crBpd();

        final Graphic img = area.getGraphic();

        if (img == null) {
            getLogger().error("Error while loading image : area.getImage() "
                    + "is null");
View Full Code Here

        final int x = area.crOriginX();
        final int y = area.crOriginY();
        final int w = area.crIpd();
        final int h = area.crBpd();

        final Graphic img = area.getGraphic();

        int xpos = this.xoffset + (x / WKConstants.DECIPOINTS_PER_POINT);
        if (xpos < 0) {
            xpos = 0;
            getLogger().warn("Horizontal position out of bounds.");
View Full Code Here

TOP

Related Classes of org.axsl.graphic.Graphic

Copyright © 2018 www.massapicom. 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.