forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmxActorShape.java
More file actions
40 lines (32 loc) · 943 Bytes
/
mxActorShape.java
File metadata and controls
40 lines (32 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.mxgraph.shape;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.GeneralPath;
import com.mxgraph.canvas.mxGraphics2DCanvas;
import com.mxgraph.view.mxCellState;
public class mxActorShape extends mxBasicShape
{
/**
*
*/
public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state)
{
Rectangle temp = state.getRectangle();
int x = temp.x;
int y = temp.y;
int w = temp.width;
int h = temp.height;
float width = w * 2 / 6;
GeneralPath path = new GeneralPath();
path.moveTo(x, y + h);
path.curveTo(x, y + 3 * h / 5, x, y + 2 * h / 5, x + w / 2, y + 2 * h
/ 5);
path.curveTo(x + w / 2 - width, y + 2 * h / 5, x + w / 2 - width, y, x
+ w / 2, y);
path.curveTo(x + w / 2 + width, y, x + w / 2 + width, y + 2 * h / 5, x
+ w / 2, y + 2 * h / 5);
path.curveTo(x + w, y + 2 * h / 5, x + w, y + 3 * h / 5, x + w, y + h);
path.closePath();
return path;
}
}