use of org.eclipse.swt.graphics.Transform in project pentaho-kettle by pentaho.
the class Sleak method paintCanvas.
void paintCanvas(Event event) {
canvas.setCursor(null);
int index = list.getSelectionIndex();
if (index == -1) {
return;
}
GC gc = event.gc;
Object object = objects[index];
if (object instanceof Color) {
if (((Color) object).isDisposed()) {
return;
}
gc.setBackground((Color) object);
gc.fillRectangle(canvas.getClientArea());
return;
}
if (object instanceof Cursor) {
if (((Cursor) object).isDisposed()) {
return;
}
canvas.setCursor((Cursor) object);
return;
}
if (object instanceof Font) {
if (((Font) object).isDisposed()) {
return;
}
gc.setFont((Font) object);
FontData[] array = gc.getFont().getFontData();
String string = "";
String lf = text.getLineDelimiter();
for (int i = 0; i < array.length; i++) {
FontData data = array[i];
String style = "NORMAL";
int bits = data.getStyle();
if (bits != 0) {
if ((bits & SWT.BOLD) != 0) {
style = "BOLD ";
}
if ((bits & SWT.ITALIC) != 0) {
style += "ITALIC";
}
}
string += data.getName() + " " + data.getHeight() + " " + style + lf;
}
gc.drawString(string, 0, 0);
return;
}
// }
if (object instanceof Image) {
if (((Image) object).isDisposed()) {
return;
}
gc.drawImage((Image) object, 0, 0);
return;
}
if (object instanceof Path) {
if (((Path) object).isDisposed()) {
return;
}
gc.drawPath((Path) object);
return;
}
if (object instanceof Pattern) {
if (((Pattern) object).isDisposed()) {
return;
}
gc.setBackgroundPattern((Pattern) object);
gc.fillRectangle(canvas.getClientArea());
gc.setBackgroundPattern(null);
return;
}
if (object instanceof Region) {
if (((Region) object).isDisposed()) {
return;
}
String string = ((Region) object).getBounds().toString();
gc.drawString(string, 0, 0);
return;
}
if (object instanceof TextLayout) {
if (((TextLayout) object).isDisposed()) {
return;
}
((TextLayout) object).draw(gc, 0, 0);
return;
}
if (object instanceof Transform) {
if (((Transform) object).isDisposed()) {
return;
}
String string = ((Transform) object).toString();
gc.drawString(string, 0, 0);
return;
}
}
use of org.eclipse.swt.graphics.Transform in project pentaho-kettle by pentaho.
the class SWTDirectGC method setTransform.
public void setTransform(float translationX, float translationY, int shadowsize, float magnification) {
if (transform != null) {
// dispose of previous to prevent leaking of handles
transform.dispose();
}
transform = new Transform(gc.getDevice());
transform.translate(translationX + shadowsize * magnification, translationY + shadowsize * magnification);
transform.scale(magnification, magnification);
gc.setTransform(transform);
currentMagnification = magnification;
}
use of org.eclipse.swt.graphics.Transform in project pentaho-kettle by pentaho.
the class SWTGC method setTransform.
public void setTransform(float translationX, float translationY, int shadowsize, float magnification) {
if (transform != null) {
// dispose of previous to prevent leaking of handles
transform.dispose();
}
transform = new Transform(gc.getDevice());
transform.translate(translationX + shadowsize * magnification, translationY + shadowsize * magnification);
transform.scale(magnification, magnification);
gc.setTransform(transform);
currentMagnification = magnification;
}
use of org.eclipse.swt.graphics.Transform in project archi by archimatetool.
the class SWTGraphics method initTransform.
private void initTransform(boolean force) {
if (!force && translateX == 0 && translateY == 0) {
return;
}
if (transform == null) {
transform = new Transform(Display.getCurrent());
elementsNeedUpdate = true;
transform.translate(translateX, translateY);
translateX = 0;
translateY = 0;
gc.setTransform(transform);
currentState.graphicHints |= ADVANCED_GRAPHICS_MASK;
}
}
Aggregations