/// <summary>Return true if the shader has a non-identity local matrix.</summary> /// <remarks>Return true if the shader has a non-identity local matrix.</remarks> /// <param name="localM">If not null, it is set to the shader's local matrix.</param> /// <returns>true if the shader has a non-identity local matrix</returns> public virtual bool getLocalMatrix(android.graphics.Matrix localM) { if (mLocalMatrix != null) { localM.set(mLocalMatrix); return(!mLocalMatrix.isIdentity()); } return(false); }
/// <summary>Returns the transform associated with this texture view.</summary> /// <remarks>Returns the transform associated with this texture view.</remarks> /// <param name="transform"> /// The /// <see cref="android.graphics.Matrix">android.graphics.Matrix</see> /// in which to copy the current /// transform. Can be null. /// </param> /// <returns> /// The specified matrix if not null or a new /// <see cref="android.graphics.Matrix">android.graphics.Matrix</see> /// instance otherwise. /// </returns> /// <seealso cref="setTransform(android.graphics.Matrix)"></seealso> public virtual android.graphics.Matrix getTransform(android.graphics.Matrix transform ) { if (transform == null) { transform = new android.graphics.Matrix(); } transform.set(mMatrix); return(transform); }
public FaceRectView(Context context, AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { mPaint = new Paint(); mPaint.Style = Paint.Style.STROKE; mMatrix = new Matrix(); mAspectRatio = new Matrix(); mRevisionZoomRect = new RectF(); mActualRect = new RectF(); mBoundRect = new RectF(); }
public virtual bool getMatrix(float arg0, android.graphics.Matrix arg1, int arg2) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallBooleanMethod(this.JvmHandle, global::android.graphics.PathMeasure._getMatrix3596, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } else { return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::android.graphics.PathMeasure.staticClass, global::android.graphics.PathMeasure._getMatrix3596, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } }
public FaceRectView(Context context, AttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { mPaint = new Paint(); mPaint.Style = Paint.Style.STROKE; mMatrix = new Matrix(); mAspectRatio = new Matrix(); mRevisionZoomRect = new RectF(); mActualRect = new RectF(); mBoundRect = new RectF(); }
public virtual void getMatrix(android.graphics.Matrix arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { @__env.CallVoidMethod(this.JvmHandle, global::android.graphics.Camera._getMatrix3167, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } else { @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.graphics.Camera.staticClass, global::android.graphics.Camera._getMatrix3167, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } }
public virtual void setImageMatrix(android.graphics.Matrix arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { @__env.CallVoidMethod(this.JvmHandle, global::android.widget.ImageView._setImageMatrix11480, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } else { @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.ImageView.staticClass, global::android.widget.ImageView._setImageMatrix11480, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } }
public virtual bool getLocalMatrix(android.graphics.Matrix arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallBooleanMethod(this.JvmHandle, global::android.graphics.Shader._getLocalMatrix3800, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } else { return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::android.graphics.Shader.staticClass, global::android.graphics.Shader._getLocalMatrix3800, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } }
public virtual void addPath(android.graphics.Path arg0, android.graphics.Matrix arg1) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { @__env.CallVoidMethod(this.JvmHandle, global::android.graphics.Path._addPath3580, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)); } else { @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.graphics.Path.staticClass, global::android.graphics.Path._addPath3580, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1)); } }
/// <summary> /// Reset the transformation to a state that leaves the object /// being animated in an unmodified state. /// </summary> /// <remarks> /// Reset the transformation to a state that leaves the object /// being animated in an unmodified state. The transformation type is /// <see cref="TYPE_BOTH">TYPE_BOTH</see> /// by default. /// </remarks> public virtual void clear() { if (mMatrix == null) { mMatrix = new android.graphics.Matrix(); } else { mMatrix.reset(); } mAlpha = 1.0f; mTransformationType = TYPE_BOTH; }
/// <summary> /// Reset the transformation to a state that leaves the object /// being animated in an unmodified state. /// </summary> /// <remarks> /// Reset the transformation to a state that leaves the object /// being animated in an unmodified state. The transformation type is /// <see cref="TYPE_BOTH">TYPE_BOTH</see> /// by default. /// </remarks> public virtual void clear() { if (mMatrix == null) { mMatrix = new android.graphics.Matrix(); } else { mMatrix.reset(); } mAlpha = 1.0f; mTransformationType = TYPE_BOTH; }
public virtual void setImageMatrix(android.graphics.Matrix matrix) { // collaps null and identity to just null if (matrix != null && matrix.isIdentity()) { matrix = null; } // don't invalidate unless we're actually changing our matrix if (matrix == null && !mMatrix.isIdentity() || matrix != null && !mMatrix.Equals( matrix)) { mMatrix.set(matrix); configureBounds(); invalidate(); } }
private Bitmap captureBitmap(I420Frame i420Frame) { YuvImage yuvImage = i420ToYuvImage(i420Frame); ByteArrayOutputStream stream = new ByteArrayOutputStream(); Rect rect = new Rect(0, 0, yuvImage.Width, yuvImage.Height); // Compress YuvImage to jpeg yuvImage.compressToJpeg(rect, 100, stream); // Convert jpeg to Bitmap sbyte[] imageBytes = stream.toByteArray(); Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.Length); Matrix matrix = new Matrix(); // Apply any needed rotation matrix.postRotate(i420Frame.rotationDegree); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.Width, bitmap.Height, matrix, true); return bitmap; }
private Bitmap captureBitmap(I420Frame i420Frame) { YuvImage yuvImage = i420ToYuvImage(i420Frame); ByteArrayOutputStream stream = new ByteArrayOutputStream(); Rect rect = new Rect(0, 0, yuvImage.Width, yuvImage.Height); // Compress YuvImage to jpeg yuvImage.compressToJpeg(rect, 100, stream); // Convert jpeg to Bitmap sbyte[] imageBytes = stream.toByteArray(); Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.Length); Matrix matrix = new Matrix(); // Apply any needed rotation matrix.postRotate(i420Frame.rotationDegree); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.Width, bitmap.Height, matrix, true); return(bitmap); }
/// <summary>Creates a new bitmap, scaled from an existing bitmap.</summary> /// <remarks>Creates a new bitmap, scaled from an existing bitmap.</remarks> /// <param name="src">The source bitmap.</param> /// <param name="dstWidth">The new bitmap's desired width.</param> /// <param name="dstHeight">The new bitmap's desired height.</param> /// <param name="filter">true if the source should be filtered.</param> /// <returns>the new scaled bitmap.</returns> public static android.graphics.Bitmap createScaledBitmap(android.graphics.Bitmap src, int dstWidth, int dstHeight, bool filter) { android.graphics.Matrix m; lock (typeof(android.graphics.Bitmap)) { // small pool of just 1 matrix m = sScaleMatrix; sScaleMatrix = null; } if (m == null) { m = new android.graphics.Matrix(); } int width = src.getWidth(); int height = src.getHeight(); float sx = dstWidth / (float)width; float sy = dstHeight / (float)height; m.setScale(sx, sy); android.graphics.Bitmap b = android.graphics.Bitmap.createBitmap(src, 0, 0, width , height, m, filter); lock (typeof(android.graphics.Bitmap)) { // do we need to check for null? why not just assign everytime? if (sScaleMatrix == null) { sScaleMatrix = m; } } return b; }
public override void drawBitmap(android.graphics.Bitmap bitmap, android.graphics.Matrix matrix, android.graphics.Paint paint) { throw new System.NotImplementedException(); }
/// <summary>Set the shader's local matrix.</summary> /// <remarks> /// Set the shader's local matrix. Passing null will reset the shader's /// matrix to identity /// </remarks> /// <param name="localM">The shader's new local matrix, or null to specify identity</param> public virtual void setLocalMatrix(android.graphics.Matrix localM) { mLocalMatrix = localM; nativeSetLocalMatrix(native_instance, localM == null ? null : localM.native_instance ); }
public static global::android.graphics.Bitmap createBitmap(android.graphics.Bitmap arg0, int arg1, int arg2, int arg3, int arg4, android.graphics.Matrix arg5, bool arg6) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallStaticObjectMethod(android.graphics.Bitmap.staticClass, global::android.graphics.Bitmap._createBitmap3099, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg4), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg5), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg6))) as android.graphics.Bitmap); }
public CompatibleCanvas(Surface _enclosing) { this._enclosing = _enclosing; mOrigMatrix = null; }
public override void getMatrix(android.graphics.Matrix m) { throw new System.NotImplementedException(); }
public virtual void getMatrix(android.graphics.Matrix matrix) { throw new System.NotImplementedException(); }
/// <summary><p>Sets the transform to associate with this texture view.</summary> /// <remarks> /// <p>Sets the transform to associate with this texture view. /// The specified transform applies to the underlying surface /// texture and does not affect the size or position of the view /// itself, only of its content.</p> /// <p>Some transforms might prevent the content from drawing /// all the pixels contained within this view's bounds. In such /// situations, make sure this texture view is not marked opaque.</p> /// </remarks> /// <param name="transform"> /// The transform to apply to the content of /// this view. /// </param> /// <seealso cref="getTransform(android.graphics.Matrix)"></seealso> /// <seealso cref="isOpaque()"></seealso> /// <seealso cref="setOpaque(bool)"></seealso> public virtual void setTransform(android.graphics.Matrix transform) { mMatrix.set(transform); mMatrixChanged = true; invalidateParentIfNeeded(); }
public override void concat(android.graphics.Matrix matrix) { throw new System.NotImplementedException(); }
/// <summary> /// Return a new matrix with a copy of the canvas' current transformation /// matrix. /// </summary> /// <remarks> /// Return a new matrix with a copy of the canvas' current transformation /// matrix. /// </remarks> public android.graphics.Matrix getMatrix() { android.graphics.Matrix m = new android.graphics.Matrix(); getMatrix(m); return m; }
private void configureBounds() { if (mDrawable == null || !mHaveFrame) { return; } int dwidth = mDrawableWidth; int dheight = mDrawableHeight; int vwidth = getWidth() - mPaddingLeft - mPaddingRight; int vheight = getHeight() - mPaddingTop - mPaddingBottom; bool fits = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight ); if (dwidth <= 0 || dheight <= 0 || android.widget.ImageView.ScaleType.FIT_XY == mScaleType) { mDrawable.setBounds(0, 0, vwidth, vheight); mDrawMatrix = null; } else { // We need to do the scaling ourself, so have the drawable // use its native size. mDrawable.setBounds(0, 0, dwidth, dheight); if (android.widget.ImageView.ScaleType.MATRIX == mScaleType) { // Use the specified matrix as-is. if (mMatrix.isIdentity()) { mDrawMatrix = null; } else { mDrawMatrix = mMatrix; } } else { if (fits) { // The bitmap fits exactly, no transform needed. mDrawMatrix = null; } else { if (android.widget.ImageView.ScaleType.CENTER == mScaleType) { // Center bitmap in view, no scaling. mDrawMatrix = mMatrix; mDrawMatrix.setTranslate((int)((vwidth - dwidth) * 0.5f + 0.5f), (int)((vheight - dheight) * 0.5f + 0.5f)); } else { if (android.widget.ImageView.ScaleType.CENTER_CROP == mScaleType) { mDrawMatrix = mMatrix; float scale; float dx = 0; float dy = 0; if (dwidth * vheight > vwidth * dheight) { scale = (float)vheight / (float)dheight; dx = (vwidth - dwidth * scale) * 0.5f; } else { scale = (float)vwidth / (float)dwidth; dy = (vheight - dheight * scale) * 0.5f; } mDrawMatrix.setScale(scale, scale); mDrawMatrix.postTranslate((int)(dx + 0.5f), (int)(dy + 0.5f)); } else { if (android.widget.ImageView.ScaleType.CENTER_INSIDE == mScaleType) { mDrawMatrix = mMatrix; float scale; float dx; float dy; if (dwidth <= vwidth && dheight <= vheight) { scale = 1.0f; } else { scale = System.Math.Min((float)vwidth / (float)dwidth, (float)vheight / (float)dheight ); } dx = (int)((vwidth - dwidth * scale) * 0.5f + 0.5f); dy = (int)((vheight - dheight * scale) * 0.5f + 0.5f); mDrawMatrix.setScale(scale, scale); mDrawMatrix.postTranslate(dx, dy); } else { // Generate the required transform. mTempSrc.set(0, 0, dwidth, dheight); mTempDst.set(0, 0, vwidth, vheight); mDrawMatrix = mMatrix; mDrawMatrix.setRectToRect(mTempSrc, mTempDst, scaleTypeToScaleToFit(mScaleType)); } } } } } } }
/// <summary>Returns the transform associated with this texture view.</summary> /// <remarks>Returns the transform associated with this texture view.</remarks> /// <param name="transform"> /// The /// <see cref="android.graphics.Matrix">android.graphics.Matrix</see> /// in which to copy the current /// transform. Can be null. /// </param> /// <returns> /// The specified matrix if not null or a new /// <see cref="android.graphics.Matrix">android.graphics.Matrix</see> /// instance otherwise. /// </returns> /// <seealso cref="setTransform(android.graphics.Matrix)"></seealso> public virtual android.graphics.Matrix getTransform(android.graphics.Matrix transform ) { if (transform == null) { transform = new android.graphics.Matrix(); } transform.set(mMatrix); return transform; }
/// <summary>Sets an optional transform on this layer.</summary> /// <remarks>Sets an optional transform on this layer.</remarks> /// <param name="matrix">The transform to apply to the layer.</param> internal abstract void setTransform(android.graphics.Matrix matrix);
internal override void setTransform(android.graphics.Matrix matrix) { throw new System.NotImplementedException(); }
//need inflate syntax/reader for matrix private void initImageView() { mMatrix = new android.graphics.Matrix(); mScaleType = android.widget.ImageView.ScaleType.FIT_CENTER; }
/// <summary>Set the shader's local matrix.</summary> /// <remarks> /// Set the shader's local matrix. Passing null will reset the shader's /// matrix to identity /// </remarks> /// <param name="localM">The shader's new local matrix, or null to specify identity</param> public virtual void setLocalMatrix(android.graphics.Matrix localM) { mLocalMatrix = localM; nativeSetLocalMatrix(native_instance, localM == null ? null : localM.native_instance ); }
private void configureBounds() { if (mDrawable == null || !mHaveFrame) { return; } int dwidth = mDrawableWidth; int dheight = mDrawableHeight; int vwidth = getWidth() - mPaddingLeft - mPaddingRight; int vheight = getHeight() - mPaddingTop - mPaddingBottom; bool fits = (dwidth < 0 || vwidth == dwidth) && (dheight < 0 || vheight == dheight ); if (dwidth <= 0 || dheight <= 0 || android.widget.ImageView.ScaleType.FIT_XY == mScaleType) { mDrawable.setBounds(0, 0, vwidth, vheight); mDrawMatrix = null; } else { // We need to do the scaling ourself, so have the drawable // use its native size. mDrawable.setBounds(0, 0, dwidth, dheight); if (android.widget.ImageView.ScaleType.MATRIX == mScaleType) { // Use the specified matrix as-is. if (mMatrix.isIdentity()) { mDrawMatrix = null; } else { mDrawMatrix = mMatrix; } } else { if (fits) { // The bitmap fits exactly, no transform needed. mDrawMatrix = null; } else { if (android.widget.ImageView.ScaleType.CENTER == mScaleType) { // Center bitmap in view, no scaling. mDrawMatrix = mMatrix; mDrawMatrix.setTranslate((int)((vwidth - dwidth) * 0.5f + 0.5f), (int)((vheight - dheight) * 0.5f + 0.5f)); } else { if (android.widget.ImageView.ScaleType.CENTER_CROP == mScaleType) { mDrawMatrix = mMatrix; float scale; float dx = 0; float dy = 0; if (dwidth * vheight > vwidth * dheight) { scale = (float)vheight / (float)dheight; dx = (vwidth - dwidth * scale) * 0.5f; } else { scale = (float)vwidth / (float)dwidth; dy = (vheight - dheight * scale) * 0.5f; } mDrawMatrix.setScale(scale, scale); mDrawMatrix.postTranslate((int)(dx + 0.5f), (int)(dy + 0.5f)); } else { if (android.widget.ImageView.ScaleType.CENTER_INSIDE == mScaleType) { mDrawMatrix = mMatrix; float scale; float dx; float dy; if (dwidth <= vwidth && dheight <= vheight) { scale = 1.0f; } else { scale = System.Math.Min((float)vwidth / (float)dwidth, (float)vheight / (float)dheight ); } dx = (int)((vwidth - dwidth * scale) * 0.5f + 0.5f); dy = (int)((vheight - dheight * scale) * 0.5f + 0.5f); mDrawMatrix.setScale(scale, scale); mDrawMatrix.postTranslate(dx, dy); } else { // Generate the required transform. mTempSrc.set(0, 0, dwidth, dheight); mTempDst.set(0, 0, vwidth, vheight); mDrawMatrix = mMatrix; mDrawMatrix.setRectToRect(mTempSrc, mTempDst, scaleTypeToScaleToFit(mScaleType)); } } } } } } }
// must match flags in SkPathMeasure.h // must match flags in SkPathMeasure.h /// <summary> /// Pins distance to 0 <= distance <= getLength(), and then computes the /// corresponding matrix. /// </summary> /// <remarks> /// Pins distance to 0 <= distance <= getLength(), and then computes the /// corresponding matrix. Returns false if there is no path, or a zero-length /// path was specified, in which case matrix is unchanged. /// </remarks> /// <param name="distance">The distance along the associated path</param> /// <param name="matrix"> /// Allocated by the caller, this is set to the transformation /// associated with the position and tangent at the specified distance /// </param> /// <param name="flags">Specified what aspects should be returned in the matrix.</param> public virtual bool getMatrix(float distance, android.graphics.Matrix matrix, int flags) { return(native_getMatrix(native_instance, distance, matrix.native_instance, flags)); }
//need inflate syntax/reader for matrix private void initImageView() { mMatrix = new android.graphics.Matrix(); mScaleType = android.widget.ImageView.ScaleType.FIT_CENTER; }