Java Code Examples for org.eclipse.swt.graphics.Transform#invert()

The following examples show how to use org.eclipse.swt.graphics.Transform#invert() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SvgShape.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns whether or not the given point is contained by this shape.
 * @param x
 * @param y
 * @param gc
 * @param outline
 * @return true if the given point is contained, false otherwise
 * @see Path#contains(float, float, GC, boolean)
 */
public boolean contains(float x, float y, GC gc, boolean outline) {
	Transform t = new Transform(gc.getDevice());
	gc.getTransform(t);
	t.invert();
	float[] pts = new float[] { x, y };
	t.transform(pts);
	t.dispose();
	return path.contains(pts[0], pts[1], gc, outline);
}
 
Example 2
Source File: DefaultTableHeaderRenderer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the rotation of the header text. Please note that you have to call <code>redraw()</code> on the table
 * yourself if you change the rotation while the table is showing.
 * 
 * @param rotation rotation in degrees anti clockwise between 0 and 90 degrees.
 */
public void setRotation(int rotation) {
    if (rotation < 0 || rotation > 90) {
        throw new IllegalArgumentException("Rotation range 0..90");
    }
    if (_rotation != rotation) {
        disposeTransformations();
        _rotation = rotation;
        _transform = new Transform(Display.getCurrent());
        _transformInv = new Transform(Display.getCurrent());
        _transform.rotate(-rotation);
        _transformInv.rotate(-rotation);
        _transformInv.invert();
    }
}
 
Example 3
Source File: DefaultTableHeaderRenderer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the rotation of the header text. Please note that you have to call <code>redraw()</code> on the table
 * yourself if you change the rotation while the table is showing.
 * 
 * @param rotation rotation in degrees anti clockwise between 0 and 90 degrees.
 */
public void setRotation(int rotation) {
    if (rotation < 0 || rotation > 90) {
        throw new IllegalArgumentException("Rotation range 0..90");
    }
    if (_rotation != rotation) {
        disposeTransformations();
        _rotation = rotation;
        _transform = new Transform(Display.getCurrent());
        _transformInv = new Transform(Display.getCurrent());
        _transform.rotate(-rotation);
        _transformInv.rotate(-rotation);
        _transformInv.invert();
    }
}