use of com.android.layoutlib.bridge.impl.GcSnapshot in project android_frameworks_base by ParanoidAndroid.
the class Canvas_Delegate method native_concat.
@LayoutlibDelegate
static /*package*/
void native_concat(int nCanvas, int nMatrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
return;
}
Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(nMatrix);
if (matrixDelegate == null) {
return;
}
// get the current top graphics2D object.
GcSnapshot snapshot = canvasDelegate.getSnapshot();
// get its current matrix
AffineTransform currentTx = snapshot.getTransform();
// get the AffineTransform of the given matrix
AffineTransform matrixTx = matrixDelegate.getAffineTransform();
// combine them so that the given matrix is applied after.
currentTx.concatenate(matrixTx);
// give it to the graphics2D as a new matrix replacing all previous transform
snapshot.setTransform(currentTx);
}
use of com.android.layoutlib.bridge.impl.GcSnapshot in project android_frameworks_base by ParanoidAndroid.
the class Canvas_Delegate method native_setMatrix.
@LayoutlibDelegate
static /*package*/
void native_setMatrix(int nCanvas, int nMatrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
return;
}
Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(nMatrix);
if (matrixDelegate == null) {
return;
}
// get the current top graphics2D object.
GcSnapshot snapshot = canvasDelegate.getSnapshot();
// get the AffineTransform of the given matrix
AffineTransform matrixTx = matrixDelegate.getAffineTransform();
// give it to the graphics2D as a new matrix replacing all previous transform
snapshot.setTransform(matrixTx);
if (matrixDelegate.hasPerspective()) {
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, "android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " + "supports affine transformations.", null, null);
}
}
use of com.android.layoutlib.bridge.impl.GcSnapshot in project android_frameworks_base by ParanoidAndroid.
the class Canvas_Delegate method skew.
@LayoutlibDelegate
static /*package*/
void skew(Canvas thisCanvas, float kx, float ky) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.mNativeCanvas);
if (canvasDelegate == null) {
return;
}
// get the current top graphics2D object.
GcSnapshot g = canvasDelegate.getSnapshot();
// get its current matrix
AffineTransform currentTx = g.getTransform();
// get the AffineTransform for the given skew.
float[] mtx = Matrix_Delegate.getSkew(kx, ky);
AffineTransform matrixTx = Matrix_Delegate.getAffineTransform(mtx);
// combine them so that the given matrix is applied after.
currentTx.preConcatenate(matrixTx);
// give it to the graphics2D as a new matrix replacing all previous transform
g.setTransform(currentTx);
}
use of com.android.layoutlib.bridge.impl.GcSnapshot in project android_frameworks_base by DirtyUnicorns.
the class Canvas_Delegate method native_skew.
@LayoutlibDelegate
public static void native_skew(long nativeCanvas, float kx, float ky) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
return;
}
// get the current top graphics2D object.
GcSnapshot g = canvasDelegate.getSnapshot();
// get its current matrix
AffineTransform currentTx = g.getTransform();
// get the AffineTransform for the given skew.
float[] mtx = Matrix_Delegate.getSkew(kx, ky);
AffineTransform matrixTx = Matrix_Delegate.getAffineTransform(mtx);
// combine them so that the given matrix is applied after.
currentTx.preConcatenate(matrixTx);
// give it to the graphics2D as a new matrix replacing all previous transform
g.setTransform(currentTx);
}
use of com.android.layoutlib.bridge.impl.GcSnapshot in project android_frameworks_base by DirtyUnicorns.
the class Canvas_Delegate method native_setMatrix.
@LayoutlibDelegate
public static void native_setMatrix(long nCanvas, long nMatrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
return;
}
Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(nMatrix);
if (matrixDelegate == null) {
return;
}
// get the current top graphics2D object.
GcSnapshot snapshot = canvasDelegate.getSnapshot();
// get the AffineTransform of the given matrix
AffineTransform matrixTx = matrixDelegate.getAffineTransform();
// give it to the graphics2D as a new matrix replacing all previous transform
snapshot.setTransform(matrixTx);
if (matrixDelegate.hasPerspective()) {
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, "android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " + "supports affine transformations.", null, null);
}
}
Aggregations