Java Code Examples for org.jfree.ui.Align#align()

The following examples show how to use org.jfree.ui.Align#align() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Plot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}
 
Example 2
Source File: Plot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}
 
Example 3
Source File: Plot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}
 
Example 4
Source File: Plot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}
 
Example 5
Source File: Plot.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the 
 * specified area.
 * 
 * @param g2  the graphics device.
 * @param area  the area.
 * 
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
protected void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage != null) {
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 
                this.backgroundImageAlpha));
        Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
                this.backgroundImage.getWidth(null), 
                this.backgroundImage.getHeight(null));
        Align.align(dest, area, this.backgroundImageAlignment);
        g2.drawImage(this.backgroundImage, (int) dest.getX(), 
                (int) dest.getY(), (int) dest.getWidth() + 1, 
                (int) dest.getHeight() + 1, null);
        g2.setComposite(originalComposite);
    }
}
 
Example 6
Source File: Plot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}
 
Example 7
Source File: Plot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the background image (if there is one) aligned within the
 * specified area.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #getBackgroundImage()
 * @see #getBackgroundImageAlignment()
 * @see #getBackgroundImageAlpha()
 */
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) {
    if (this.backgroundImage == null) {
        return;  // nothing to do
    }
    Composite savedComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            this.backgroundImageAlpha));
    Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0,
            this.backgroundImage.getWidth(null),
            this.backgroundImage.getHeight(null));
    Align.align(dest, area, this.backgroundImageAlignment);
    Shape savedClip = g2.getClip();
    g2.clip(area);
    g2.drawImage(this.backgroundImage, (int) dest.getX(),
            (int) dest.getY(), (int) dest.getWidth() + 1,
            (int) dest.getHeight() + 1, null);
    g2.setClip(savedClip);
    g2.setComposite(savedComposite);
}