com.mxgraph.shape.mxImageShape Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AptSpringProcessor Show documentation
Show all versions of AptSpringProcessor Show documentation
This project contains the apt processor that implements all the checks enumerated in @Verify. It is a self contained, and
shaded jar.
The newest version!
/**
* Copyright (c) 2007-2010, Gaudenz Alder, David Benson
*/
package com.mxgraph.shape;
import java.awt.Color;
import java.awt.Rectangle;
import com.mxgraph.canvas.mxGraphics2DCanvas;
import com.mxgraph.util.mxConstants;
import com.mxgraph.util.mxUtils;
import com.mxgraph.view.mxCellState;
/**
* A rectangular shape that contains a single image. See mxImageBundle for
* creating a lookup table with images which can then be referenced by key.
*/
public class mxImageShape extends mxRectangleShape
{
/**
*
*/
public void paintShape(mxGraphics2DCanvas canvas, mxCellState state)
{
super.paintShape(canvas, state);
boolean flipH = mxUtils.isTrue(state.getStyle(),
mxConstants.STYLE_IMAGE_FLIPH, false);
boolean flipV = mxUtils.isTrue(state.getStyle(),
mxConstants.STYLE_IMAGE_FLIPV, false);
canvas.drawImage(getImageBounds(canvas, state),
getImageForStyle(canvas, state),
mxGraphics2DCanvas.PRESERVE_IMAGE_ASPECT, flipH, flipV);
}
/**
*
*/
public Rectangle getImageBounds(mxGraphics2DCanvas canvas, mxCellState state)
{
return state.getRectangle();
}
/**
*
*/
public boolean hasGradient(mxGraphics2DCanvas canvas, mxCellState state)
{
return false;
}
/**
*
*/
public String getImageForStyle(mxGraphics2DCanvas canvas, mxCellState state)
{
return canvas.getImageForStyle(state.getStyle());
}
/**
*
*/
public Color getFillColor(mxGraphics2DCanvas canvas, mxCellState state)
{
return mxUtils.getColor(state.getStyle(),
mxConstants.STYLE_IMAGE_BACKGROUND);
}
/**
*
*/
public Color getStrokeColor(mxGraphics2DCanvas canvas, mxCellState state)
{
return mxUtils.getColor(state.getStyle(),
mxConstants.STYLE_IMAGE_BORDER);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy