use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.
the class AutoCompletePanel method paint.
@Override
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
int w = this.getWidth();
int h = this.getHeight();
g.setColor(BACKGROUND);
g.fillRoundRect(0, 0, w - 1, h - 1, MARGIN * 2, MARGIN * 2);
GeneralPath resize = new GeneralPath();
resize.moveTo(w - 2 * MARGIN, h);
resize.lineTo(w, h - 2 * MARGIN);
resize.curveTo(w - 1, h - 1, w - 1, h - 1, w - 2 * MARGIN, h);
g.setColor(Color.gray);
g2.fill(resize);
g.setColor(Color.gray);
g.drawRoundRect(0, 0, w - 1, h - 1, MARGIN * 2, MARGIN * 2);
super.paint(g);
}
use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.
the class BlockShape method reformArea.
/**
* Reform the BlockShape area. This is the major procedure that makes all of the sides
* combines them in their correct directions, and connects them so they are all one direction.
* @return reformed Area of the BlockShape
*/
public Area reformArea() {
//hopefully reseting is less costly than creating new ones
gpTop.reset();
gpRight.reset();
gpBottom.reset();
gpLeft.reset();
setupDimensions();
//make all of the sides
makeTopSide();
makeRightSide();
makeBottomSide();
makeLeftSide();
//corrected (clockwise) left and bottom
gpBottomClockwise = new GeneralPath();
gpLeftClockwise = new GeneralPath();
gpBottomClockwise.moveTo((float) gpBottom.getCurrentPoint().getX(), (float) gpBottom.getCurrentPoint().getY());
gpLeftClockwise.moveTo((float) gpLeft.getCurrentPoint().getX(), (float) gpLeft.getCurrentPoint().getY());
BlockShapeUtil.appendPath(gpBottomClockwise, gpBottom, true);
BlockShapeUtil.appendPath(gpLeftClockwise, gpLeft, true);
//create direction specific paths
GeneralPath gpClockwise = new GeneralPath();
GeneralPath gpCounterClockwise = new GeneralPath();
//add to the direction specific paths
gpCounterClockwise.append(gpLeft, true);
gpCounterClockwise.append(gpBottom, true);
gpClockwise.append(gpTop, true);
gpClockwise.append(gpRight, true);
//connect so gpCounterClockwise is the full path
//it must be counter-clockwise for the bevel to be able to use it
BlockShapeUtil.appendPath(gpCounterClockwise, gpClockwise, true);
//convert it to an area
blockArea = new Area(gpCounterClockwise);
return blockArea;
}
use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.
the class SliderBlueprint method reformLeadingTrack.
/**
* creates the shape of the track on the left side of the thumb
* @param blueprint
* @return general path shape of track on the left side of the thumb
*/
public Shape reformLeadingTrack(SliderBlueprint blueprint) {
GeneralPath shape = new GeneralPath();
shape.moveTo(blueprint.closeTrackEdgeLeft, blueprint.trackTop);
shape.lineTo(blueprint.thumbCenter, blueprint.trackTop);
shape.lineTo(blueprint.thumbCenter, blueprint.trackBottom);
shape.lineTo(blueprint.closeTrackEdgeLeft, blueprint.trackBottom);
shape.curveTo(blueprint.farTrackEdgeLeft, blueprint.trackBottom, blueprint.farTrackEdgeLeft, blueprint.trackTop, blueprint.closeTrackEdgeLeft, blueprint.trackTop);
shape.closePath();
return shape;
}
use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.
the class SliderBlueprint method reformTicks.
/**
* creates the shape of the ticks
* @param blueprint
* @return general path of the ticks
*/
public Shape reformTicks(SliderBlueprint blueprint) {
GeneralPath ticks = new GeneralPath();
int count = 0;
float position = blueprint.closeTrackEdgeLeft;
float interval = (float) (blueprint.closeTrackEdgeRight - blueprint.closeTrackEdgeLeft) / this.tickNumber;
while (count < (tickNumber + 1)) {
ticks.moveTo((int) position, blueprint.trackTop);
ticks.lineTo((int) position, blueprint.trackBottom);
position += interval;
count += 1;
}
ticks.closePath();
return ticks;
}
use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.
the class CQueryField method getXCross.
private Shape getXCross(int w, int h) {
GeneralPath shape = new GeneralPath();
shape.moveTo(w - h * 2 / 3, h / 3);
shape.lineTo(w - h / 3, h * 2 / 3);
shape.moveTo(w - h / 3, h / 3);
shape.lineTo(w - h * 2 / 3, h * 2 / 3);
return shape;
}
Aggregations