x += (int)transform.getTranslateX();
y += (int)transform.getTranslateY();
drawRectangle(display, drawable, gc, x, y, width, height);
if (xor_mode) {
XORComposite xor = (XORComposite)composite;
Color xorcolor = xor.getXORColor();
xSetForeground(xorcolor.getRGB());
drawRectangle(display, drawable, gc, x, y, width, height);
xSetForeground(fgColor.getRGB());
}
} else if (type < 7) {
float points[] = new float[]{x, y, x + width - 1, y + height - 1};
transform.transform(points, 0, points, 0, 2);
if (points[0] < points[2]){
x = (int)points[0];
width = (int)(points[2] - points[0]) + 1;
} else {
x = (int)points[2];
width = (int)(points[0] - points[2]) + 1;
}
if (points[1] < points[3]){
y = (int)points[1];
height = (int)(points[3] - points[1]) + 1;
} else {
y = (int)points[3];
height = (int)(points[1] - points[3]) + 1;
}
drawRectangle(display, drawable, gc, x, y, width, height);
if (xor_mode) {
XORComposite xor = (XORComposite)composite;
Color xorcolor = xor.getXORColor();
xSetForeground(xorcolor.getRGB());
drawRectangle(display, drawable, gc, x, y, width, height);
xSetForeground(fgColor.getRGB());
}
} else {
float fpoints[] = new float[]{x, y, x + width - 1, y, x + width - 1, y + height - 1, x, y + height - 1};
transform.transform(fpoints, 0, fpoints, 0, 4);
short points[] = new short[fpoints.length + 2];
int i = 0;
for (; i < fpoints.length; i++)
points[i] = (short)(fpoints[i] + 0.5f);
points[i++] = (short)(fpoints[0] + 0.5f);
points[i++] = (short)(fpoints[1] + 0.5f);
drawLines(display, drawable, gc, points, points.length);
if (xor_mode) {
XORComposite xor = (XORComposite)composite;
Color xorcolor = xor.getXORColor();
xSetForeground(xorcolor.getRGB());
drawLines(display, drawable, gc, points, points.length);
xSetForeground(fgColor.getRGB());
}
}