use of java.awt.geom.GeneralPath in project android_frameworks_base by DirtyUnicorns.
the class Path_Delegate method transform.
/**
* Transform the points in this path by matrix, and write the answer
* into dst. If dst is null, then the the original path is modified.
*
* @param matrix The matrix to apply to the path
* @param dst The transformed path is written here. If dst is null,
* then the the original path is modified
*/
public void transform(Matrix_Delegate matrix, Path_Delegate dst) {
if (matrix.hasPerspective()) {
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, "android.graphics.Path#transform() only " + "supports affine transformations.", null, null);
}
GeneralPath newPath = new GeneralPath();
PathIterator iterator = mPath.getPathIterator(matrix.getAffineTransform());
newPath.append(iterator, false);
if (dst != null) {
dst.mPath = newPath;
} else {
mPath = newPath;
}
}
use of java.awt.geom.GeneralPath in project intellij-community by JetBrains.
the class MacUIUtil method paintComboboxFocusRing.
public static void paintComboboxFocusRing(@NotNull final Graphics2D g2d, @NotNull final Rectangle bounds) {
final Color color = getFocusRingColor();
final Color[] colors = new Color[] { ColorUtil.toAlpha(color, 180), ColorUtil.toAlpha(color, 130), ColorUtil.toAlpha(color, 80), ColorUtil.toAlpha(color, 80) };
final Object oldAntialiasingValue = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Object oldStrokeControlValue = g2d.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
int _y = MAC_COMBO_BORDER_V_OFFSET;
final GeneralPath path1 = new GeneralPath();
path1.moveTo(2, _y + 4);
path1.quadTo(2, +_y + 2, 4, _y + 2);
path1.lineTo(bounds.width - 7, _y + 2);
path1.quadTo(bounds.width - 5, _y + 3, bounds.width - 4, _y + 5);
path1.lineTo(bounds.width - 4, bounds.height - 7 + _y);
path1.quadTo(bounds.width - 5, bounds.height - 5 + _y, bounds.width - 7, bounds.height - 4 + _y);
path1.lineTo(4, bounds.height - 4 + _y);
path1.quadTo(2, bounds.height - 4 + _y, 2, bounds.height - 6 + _y);
path1.closePath();
g2d.setColor(colors[0]);
g2d.draw(path1);
final GeneralPath path2 = new GeneralPath();
path2.moveTo(1, 5 + _y);
path2.quadTo(1, 1 + _y, 5, 1 + _y);
path2.lineTo(bounds.width - 8, 1 + _y);
path2.quadTo(bounds.width - 4, 2 + _y, bounds.width - 3, 6 + _y);
path2.lineTo(bounds.width - 3, bounds.height - 7 + _y);
path2.quadTo(bounds.width - 4, bounds.height - 4 + _y, bounds.width - 8, bounds.height - 3 + _y);
path2.lineTo(4, bounds.height - 3 + _y);
path2.quadTo(1, bounds.height - 3 + _y, 1, bounds.height - 6 + _y);
path2.closePath();
g2d.setColor(colors[1]);
g2d.draw(path2);
final GeneralPath path3 = new GeneralPath();
path3.moveTo(0, 4 + _y);
path3.quadTo(0, _y, 7, _y);
path3.lineTo(bounds.width - 9, _y);
path3.quadTo(bounds.width - 2, 1 + _y, bounds.width - 2, 7 + _y);
path3.lineTo(bounds.width - 2, bounds.height - 8 + _y);
path3.quadTo(bounds.width - 3, bounds.height - 1 + _y, bounds.width - 12, bounds.height - 2 + _y);
path3.lineTo(7, bounds.height - 2 + _y);
path3.quadTo(0, bounds.height - 1 + _y, 0, bounds.height - 7 + _y);
path3.closePath();
g2d.setColor(colors[2]);
g2d.draw(path3);
// restore rendering hints
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAntialiasingValue);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
}
use of java.awt.geom.GeneralPath in project android_frameworks_base by AOSPA.
the class Path_Delegate method offset.
/**
* Offset the path by (dx,dy), returning true on success
*
* @param dx The amount in the X direction to offset the entire path
* @param dy The amount in the Y direction to offset the entire path
*/
public void offset(float dx, float dy) {
GeneralPath newPath = new GeneralPath();
PathIterator iterator = mPath.getPathIterator(new AffineTransform(0, 0, dx, 0, 0, dy));
newPath.append(iterator, false);
mPath = newPath;
}
use of java.awt.geom.GeneralPath in project antlrworks by antlr.
the class DBInputProcessorToken method drawToken.
public void drawToken(DBInputTextTokenInfo info, Graphics2D g, Color c, boolean fill) {
g.setColor(c);
try {
Rectangle r1 = textPane.modelToView(info.start);
Rectangle r2 = textPane.modelToView(info.end);
if (r2.y > r1.y) {
// token spans more than one line
GeneralPath gp = new GeneralPath();
Area area = new Area();
for (int index = info.start; index < info.end; index++) {
Rectangle r = textPane.modelToView(index);
// compute the width of the index
r.width = Math.max(0, textPane.modelToView(index + 1).x - r.x);
area.add(new Area(r));
}
gp.append(area, true);
if (fill)
g.fill(gp);
else
g.draw(gp);
} else {
if (fill)
g.fillRect(r1.x, r1.y, r2.x - r1.x, r1.height);
else
g.drawRect(r1.x, r1.y, r2.x - r1.x, r1.height);
}
} catch (BadLocationException e) {
// Ignore exception
}
}
use of java.awt.geom.GeneralPath in project android_frameworks_base by ResurrectionRemix.
the class Path_Delegate method transform.
/**
* Transform the points in this path by matrix, and write the answer
* into dst. If dst is null, then the the original path is modified.
*
* @param matrix The matrix to apply to the path
* @param dst The transformed path is written here. If dst is null,
* then the the original path is modified
*/
public void transform(Matrix_Delegate matrix, Path_Delegate dst) {
if (matrix.hasPerspective()) {
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, "android.graphics.Path#transform() only " + "supports affine transformations.", null, null);
}
GeneralPath newPath = new GeneralPath();
PathIterator iterator = mPath.getPathIterator(matrix.getAffineTransform());
newPath.append(iterator, false);
if (dst != null) {
dst.mPath = newPath;
} else {
mPath = newPath;
}
}
Aggregations