Example usage for com.lowagie.text Rectangle getBottom

List of usage examples for com.lowagie.text Rectangle getBottom

Introduction

In this page you can find the example usage for com.lowagie.text Rectangle getBottom.

Prototype

public float getBottom() 

Source Link

Document

Returns the lower left y-coordinate.

Usage

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draw a rounded rectangular boundary./*  www  .  ja v  a 2s.co  m*/
 *
 * @param rect rectangle
 * @param color colour
 * @param linewidth line width
 * @param r radius for rounded corners
 */
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) {
    template.saveState();
    setStroke(color, linewidth, null);
    template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(),
            r);
    template.stroke();
    template.restoreState();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draw a rectangle's interior with this color.
 *
 * @param rect rectangle/*  w w w.  ja v a2  s.  c o  m*/
 * @param color colour
 */
public void fillRectangle(Rectangle rect, Color color) {
    template.saveState();
    setFill(color);
    template.rectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight());
    template.fill();
    template.restoreState();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

public void fillRoundRectangle(Rectangle rect, Color color, float r) {
    template.saveState();/*from w  w w  . j a va  2s  .com*/
    setFill(color);
    template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(),
            r);
    template.fill();
    template.restoreState();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draw an elliptical exterior with this color.
 *
 * @param rect rectangle in which ellipse should fit
 * @param color colour to use for stroking
 * @param linewidth line width//w  ww.  j  ava  2s.  c  o  m
 */
public void strokeEllipse(Rectangle rect, Color color, float linewidth) {
    template.saveState();
    setStroke(color, linewidth, null);
    template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(),
            origY + rect.getTop());
    template.stroke();
    template.restoreState();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draw an elliptical interior with this color.
 *
 * @param rect rectangle in which ellipse should fit
 * @param color colour to use for filling
 *//*from   w ww .ja va2s .  c o m*/
public void fillEllipse(Rectangle rect, Color color) {
    template.saveState();
    setFill(color);
    template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(),
            origY + rect.getTop());
    template.fill();
    template.restoreState();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Move this rectangle to the specified bottom-left point.
 *
 * @param rect rectangle to move/*ww  w .  j ava  2 s  .  c  o  m*/
 * @param x new x origin
 * @param y new y origin
 */
public void moveRectangleTo(Rectangle rect, float x, float y) {
    float width = rect.getWidth();
    float height = rect.getHeight();
    rect.setLeft(x);
    rect.setBottom(y);
    rect.setRight(rect.getLeft() + width);
    rect.setTop(rect.getBottom() + height);
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Translate this rectangle over the specified following distances.
 *
 * @param rect rectangle to move/*from w  ww . j a  v a 2s  .co m*/
 * @param dx delta x
 * @param dy delta y
 */
public void translateRectangle(Rectangle rect, float dx, float dy) {
    float width = rect.getWidth();
    float height = rect.getHeight();
    rect.setLeft(rect.getLeft() + dx);
    rect.setBottom(rect.getBottom() + dy);
    rect.setRight(rect.getLeft() + dx + width);
    rect.setTop(rect.getBottom() + dy + height);
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draws the specified image with the first rectangle's bounds, clipping with the second one.
 *
 * @param img image/*w  w  w.  j a  v a  2s.  c o m*/
 * @param rect rectangle
 * @param clipRect clipping bounds
 * @param opacity opacity of the image (1 = opaque, 0= transparent)
 */
public void drawImage(Image img, Rectangle rect, Rectangle clipRect, float opacity) {
    try {
        template.saveState();
        // opacity
        PdfGState state = new PdfGState();
        state.setFillOpacity(opacity);
        state.setBlendMode(PdfGState.BM_NORMAL);
        template.setGState(state);
        // clipping code
        if (clipRect != null) {
            template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(),
                    clipRect.getHeight());
            template.clip();
            template.newPath();
        }
        template.addImage(img, rect.getWidth(), 0, 0, rect.getHeight(), origX + rect.getLeft(),
                origY + rect.getBottom());
    } catch (DocumentException e) {
        log.warn("could not draw image", e);
    } finally {
        template.restoreState();
    }
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

private float getAbsoluteY(float f, Rectangle rect) {
    return rect.getBottom() + f * rect.getHeight();
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Draw the specified geometry./* w  w  w.j  a  v a  2  s.co  m*/
 *
 * @param geometry geometry to draw
 * @param symbol symbol for geometry
 * @param fillColor fill colour
 * @param strokeColor stroke colour
 * @param lineWidth line width
 * @param clipRect clipping rectangle
 */
public void drawGeometry(Geometry geometry, SymbolInfo symbol, Color fillColor, Color strokeColor,
        float lineWidth, float[] dashArray, Rectangle clipRect) {
    template.saveState();
    // clipping code
    if (clipRect != null) {
        template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(),
                clipRect.getHeight());
        template.clip();
        template.newPath();
    }
    setStroke(strokeColor, lineWidth, dashArray);
    setFill(fillColor);
    drawGeometry(geometry, symbol);
    template.restoreState();
}