use of java.awt.geom.NoninvertibleTransformException in project android_frameworks_base by ParanoidAndroid.
the class Matrix_Delegate method native_invert.
@LayoutlibDelegate
static /*package*/
boolean native_invert(int native_object, int inverse) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
}
Matrix_Delegate inv_mtx = sManager.getDelegate(inverse);
if (inv_mtx == null) {
return false;
}
try {
AffineTransform affineTransform = d.getAffineTransform();
AffineTransform inverseTransform = affineTransform.createInverse();
inv_mtx.mValues[0] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[1] = (float) inverseTransform.getShearX();
inv_mtx.mValues[2] = (float) inverseTransform.getTranslateX();
inv_mtx.mValues[3] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[4] = (float) inverseTransform.getShearY();
inv_mtx.mValues[5] = (float) inverseTransform.getTranslateY();
return true;
} catch (NoninvertibleTransformException e) {
return false;
}
}
use of java.awt.geom.NoninvertibleTransformException in project hid-serial by rayshobby.
the class GAbstractControl method calcTransformedOrigin.
/**
* This method takes a position px, py and calculates the equivalent
* position [ox,oy] as if no transformations have taken place and
* the origin is the top-left corner of the control.
* @param px
* @param py
*/
protected void calcTransformedOrigin(float px, float py) {
AffineTransform aff = new AffineTransform();
aff = getTransform(aff);
temp[0] = px;
temp[1] = py;
try {
aff.inverseTransform(temp, 0, temp, 0, 1);
ox = (float) temp[0] + halfWidth;
oy = (float) temp[1] + halfHeight;
} catch (NoninvertibleTransformException e) {
}
}
use of java.awt.geom.NoninvertibleTransformException in project android_frameworks_base by DirtyUnicorns.
the class Matrix_Delegate method native_invert.
@LayoutlibDelegate
static /*package*/
boolean native_invert(long native_object, long inverse) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
}
Matrix_Delegate inv_mtx = sManager.getDelegate(inverse);
if (inv_mtx == null) {
return false;
}
try {
AffineTransform affineTransform = d.getAffineTransform();
AffineTransform inverseTransform = affineTransform.createInverse();
inv_mtx.mValues[0] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[1] = (float) inverseTransform.getShearX();
inv_mtx.mValues[2] = (float) inverseTransform.getTranslateX();
inv_mtx.mValues[3] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[4] = (float) inverseTransform.getShearY();
inv_mtx.mValues[5] = (float) inverseTransform.getTranslateY();
return true;
} catch (NoninvertibleTransformException e) {
return false;
}
}
use of java.awt.geom.NoninvertibleTransformException in project android_frameworks_base by ResurrectionRemix.
the class Matrix_Delegate method native_invert.
@LayoutlibDelegate
static /*package*/
boolean native_invert(long native_object, long inverse) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
}
Matrix_Delegate inv_mtx = sManager.getDelegate(inverse);
if (inv_mtx == null) {
return false;
}
try {
AffineTransform affineTransform = d.getAffineTransform();
AffineTransform inverseTransform = affineTransform.createInverse();
inv_mtx.mValues[0] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[1] = (float) inverseTransform.getShearX();
inv_mtx.mValues[2] = (float) inverseTransform.getTranslateX();
inv_mtx.mValues[3] = (float) inverseTransform.getScaleX();
inv_mtx.mValues[4] = (float) inverseTransform.getShearY();
inv_mtx.mValues[5] = (float) inverseTransform.getTranslateY();
return true;
} catch (NoninvertibleTransformException e) {
return false;
}
}
use of java.awt.geom.NoninvertibleTransformException in project EnrichmentMapApp by BaderLab.
the class AbstractChartLayer method draw.
@Override
public void draw(final Graphics2D g, final Shape shape, final CyNetworkView networkView, final View<? extends CyIdentifiable> view) {
// Give JFreeChart a larger area to draw into, so the proportions of the chart elements looks better
final double scale = 2.0;
Rectangle2D newBounds = new Rectangle2D.Double(bounds.getX() * scale, bounds.getY() * scale, bounds.getWidth() * scale, bounds.getHeight() * scale);
// Of course, we also have to ask Graphics2D to apply the inverse transformation
final double invScale = 1.0 / scale;
final AffineTransform at = new AffineTransform();
at.scale(invScale, invScale);
g.transform(at);
// Check to see if we have a current alpha composite
Composite comp = g.getComposite();
if (comp instanceof AlphaComposite) {
float alpha = ((AlphaComposite) comp).getAlpha();
JFreeChart fc = getChart();
Plot plot = fc.getPlot();
plot.setForegroundAlpha(alpha);
fc.draw(g, newBounds);
} else {
getChart().draw(g, newBounds);
}
// Make sure Graphics2D is "back to normal" before returning
try {
at.invert();
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
g.transform(at);
}
Aggregations