當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setImageMatrix方法代碼示例

本文整理匯總了Java中android.widget.ImageView.setImageMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setImageMatrix方法的具體用法?Java ImageView.setImageMatrix怎麽用?Java ImageView.setImageMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setImageMatrix方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setImageViewMatrix

import android.widget.ImageView; //導入方法依賴的package包/類
private void setImageViewMatrix(Matrix matrix) {
    ImageView imageView = getImageView();
    if (null != imageView) {

        checkImageViewScaleType();
        imageView.setImageMatrix(matrix);

        // Call MatrixChangedListener if needed
        if (null != mMatrixChangeListener) {
            RectF displayRect = getDisplayRect(matrix);
            if (null != displayRect) {
                mMatrixChangeListener.onMatrixChanged(displayRect);
            }
        }
    }
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:17,代碼來源:PhotoViewAttacher.java

示例2: ScreenEdgesCalibrationTool

import android.widget.ImageView; //導入方法依賴的package包/類
public ScreenEdgesCalibrationTool(MainActivity _p) 
{
	p = _p;
	img = new ImageView(p);
	img.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
	img.setScaleType(ImageView.ScaleType.MATRIX);
	bmp = BitmapFactory.decodeResource( p.getResources(), R.drawable.calibrate );
	img.setImageBitmap(bmp);
	Matrix m = new Matrix();
	RectF src = new RectF(0, 0, bmp.getWidth(), bmp.getHeight());
	RectF dst = new RectF(Globals.TouchscreenCalibration[0], Globals.TouchscreenCalibration[1], 
							Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
	m.setRectToRect(src, dst, Matrix.ScaleToFit.FILL);
	img.setImageMatrix(m);
	p.getVideoLayout().addView(img);
}
 
開發者ID:NeoTerm,項目名稱:NeoTerm,代碼行數:17,代碼來源:SettingsMenuMouse.java

示例3: setImageViewMatrix

import android.widget.ImageView; //導入方法依賴的package包/類
private void setImageViewMatrix(Matrix matrix) {
	ImageView imageView = getImageView();
	if (null != imageView) {

		checkImageViewScaleType();
		imageView.setImageMatrix(matrix);

		// Call MatrixChangedListener if needed
		if (null != mMatrixChangeListener) {
			RectF displayRect = getDisplayRect(matrix);
			if (null != displayRect) {
				mMatrixChangeListener.onMatrixChanged(displayRect);
			}
		}
	}
}
 
開發者ID:turoDog,項目名稱:KTalk,代碼行數:17,代碼來源:PhotoViewAttacher.java

示例4: setBitmap

import android.widget.ImageView; //導入方法依賴的package包/類
public void setBitmap(Bitmap bitmap) {
    if (mView instanceof ImageView && mIsSrc) {
        ImageView imageView = (ImageView) mView;
        imageView.setAdjustViewBounds(true);
        if (mTransformMatrix != null) {
            imageView.setImageMatrix(mTransformMatrix);
        }
        imageView.setImageBitmap(bitmap);
    } else {
        if (mView instanceof IBackgroundView) {
            ((IBackgroundManager) mView).setHtmlBackground(bitmap, mBackground);
        }
    }
}
 
開發者ID:hsllany,項目名稱:HtmlNative,代碼行數:15,代碼來源:BackgroundViewDelegate.java

示例5: setImageViewMatrix

import android.widget.ImageView; //導入方法依賴的package包/類
private void setImageViewMatrix(Matrix matrix) {
    ImageView imageView = getImageView();
    if (imageView != null) {
        checkImageViewScaleType();
        imageView.setImageMatrix(matrix);
        if (this.mMatrixChangeListener != null) {
            RectF displayRect = getDisplayRect(matrix);
            if (displayRect != null) {
                this.mMatrixChangeListener.onMatrixChanged(displayRect);
            }
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:14,代碼來源:PhotoViewAttacher.java

示例6: IndicatorLayout

import android.widget.ImageView; //導入方法依賴的package包/類
public IndicatorLayout(Context context, PullToRefreshBase.Mode mode) {
	super(context);
	mArrowImageView = new ImageView(context);

	Drawable arrowD = getResources().getDrawable(R.drawable.indicator_arrow);
	mArrowImageView.setImageDrawable(arrowD);

	final int padding = getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
	mArrowImageView.setPadding(padding, padding, padding, padding);
	addView(mArrowImageView);

	int inAnimResId, outAnimResId;
	switch (mode) {
		case PULL_FROM_END:
			inAnimResId = R.anim.slide_in_from_bottom;
			outAnimResId = R.anim.slide_out_to_bottom;
			setBackgroundResource(R.drawable.indicator_bg_bottom);

			// Rotate Arrow so it's pointing the correct way
			mArrowImageView.setScaleType(ScaleType.MATRIX);
			Matrix matrix = new Matrix();
			matrix.setRotate(180f, arrowD.getIntrinsicWidth() / 2f, arrowD.getIntrinsicHeight() / 2f);
			mArrowImageView.setImageMatrix(matrix);
			break;
		default:
		case PULL_FROM_START:
			inAnimResId = R.anim.slide_in_from_top;
			outAnimResId = R.anim.slide_out_to_top;
			setBackgroundResource(R.drawable.indicator_bg_top);
			break;
	}

	mInAnim = AnimationUtils.loadAnimation(context, inAnimResId);
	mInAnim.setAnimationListener(this);

	mOutAnim = AnimationUtils.loadAnimation(context, outAnimResId);
	mOutAnim.setAnimationListener(this);

	final Interpolator interpolator = new LinearInterpolator();
	mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
			0.5f);
	mRotateAnimation.setInterpolator(interpolator);
	mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mRotateAnimation.setFillAfter(true);

	mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f,
			Animation.RELATIVE_TO_SELF, 0.5f);
	mResetRotateAnimation.setInterpolator(interpolator);
	mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
	mResetRotateAnimation.setFillAfter(true);

}
 
開發者ID:ultrasonic,項目名稱:ultrasonic,代碼行數:53,代碼來源:IndicatorLayout.java

示例7: onTouch

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public boolean onTouch(View v, MotionEvent event)
{
    ImageView view = (ImageView) v;
    //view.setScaleType(ImageView.ScaleType.CENTER_CROP);
    view.setScaleType(ImageView.ScaleType.MATRIX);

    float scale;

    /* Show an event in the LogCat view, for debugging */
    //dumpEvent(event);


    // Handle touch events here...

    switch (event.getAction() & MotionEvent.ACTION_MASK)
    {
        case MotionEvent.ACTION_DOWN:   // first finger down only
            matrix.set(view.getImageMatrix());
            savedMatrix.set(matrix);
            start.set(event.getX(), event.getY());
            Log.d(TAG, "mode=DRAG"); // write to LogCat
            mode = DRAG;
            break;

        case MotionEvent.ACTION_UP: // first finger lifted

        case MotionEvent.ACTION_POINTER_UP: // second finger lifted

            mode = NONE;
            Log.d(TAG, "mode=NONE");
            break;

        case MotionEvent.ACTION_POINTER_DOWN: // first and second finger down

            oldDist = spacing(event);
            Log.d(TAG, "oldDist=" + oldDist);
            if (oldDist > 10f) {
                savedMatrix.set(matrix);
                midPoint(mid, event);
                mode = ZOOM;
                Log.d(TAG, "mode=ZOOM");
            }
            break;

        case MotionEvent.ACTION_MOVE:

            if (mode == DRAG)
            {
                matrix.set(savedMatrix);
                matrix.postTranslate(event.getX() - start.x, event.getY() - start.y); // create the transformation in the matrix  of points
            }
            else if (mode == ZOOM)
            {
                // pinch zooming
                float newDist = spacing(event);
                Log.d(TAG, "newDist=" + newDist);
                if (newDist > 10f)
                {
                    matrix.set(savedMatrix);
                    scale = newDist / oldDist; // setting the scaling of the
                    // matrix...if scale > 1 means
                    // zoom in...if scale < 1 means
                    // zoom out
                    matrix.postScale(scale, scale, mid.x, mid.y);
                }
            }
            break;
    }

    view.setImageMatrix(matrix); // display the transformation on screen

    return true; // indicate event was handled
}
 
開發者ID:codingdojoangola,項目名稱:cda-app,代碼行數:75,代碼來源:ImagemActivity.java

示例8: onTouch

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public boolean onTouch(View v, MotionEvent event) {

    ImageView view = (ImageView) v;
    dumpEvent(event);

    // Handle touch events here...
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN:

            matrix.set(view.getImageMatrix());
            savedMatrix.set(matrix);
            start.set(event.getX(), event.getY());
            //Log.d(TAG, "mode=DRAG");
            mode = DRAG;


            //Log.d(TAG, "mode=NONE");
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            oldDist = spacing(event);
            //Log.d(TAG, "oldDist=" + oldDist);
            if (oldDist > 10f) {
                savedMatrix.set(matrix);
                midPoint(mid, event);
                mode = ZOOM;
                //Log.d(TAG, "mode=ZOOM");
            }
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_POINTER_UP:
            mode = NONE;
            //Log.e("view.getWidth", view.getWidth() + "");
            //Log.e("view.getHeight", view.getHeight() + "");

            break;
        case MotionEvent.ACTION_MOVE:
            if (mode == DRAG) {
                // ...
                matrix.set(savedMatrix);
                matrix.postTranslate(event.getX() - start.x, event.getY()
                        - start.y);
            } else if (mode == ZOOM) {
                float newDist = spacing(event);
                //Log.d(TAG, "newDist=" + newDist);
                if (newDist > 10f) {
                    matrix.set(savedMatrix);
                    float scale = newDist / oldDist;
                    matrix.postScale(scale, scale, mid.x, mid.y);
                }
            }
            break;
    }

    view.setImageMatrix(matrix);
    return true; // indicate event was handled
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:58,代碼來源:MulitPointTouchListener.java

示例9: onTouch

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public boolean onTouch(View v, MotionEvent event) {

    ImageView view = (ImageView) v;
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN:
            savedMatrix.set(matrix);
            start.set(event.getX(), event.getY());
            Log.d(TAG, "mode=DRAG");
            mode = DRAG;
            break;
        case MotionEvent.ACTION_POINTER_DOWN:
            oldDist = spacing(event);
            Log.d(TAG, "oldDist=" + oldDist);
            if (oldDist > 10f) {
                savedMatrix.set(matrix);
                midPoint(mid, event);
                mode = ZOOM;
                Log.d(TAG, "mode=ZOOM");
            }
            break;
        case MotionEvent.ACTION_MOVE:
            /*  *//*  if (mode == DRAG) {
                matrix.set(savedMatrix);
                matrix.postTranslate(event.getX() - start.x, event.getY() - start.y);
            }*//*
            else*/
            if (mode == ZOOM) {
                float newDist = spacing(event);
                Log.d(TAG, "newDist=" + newDist);
                if (newDist > 10f) {
                    matrix.set(savedMatrix);
                    float scale = newDist / oldDist;
                    matrix.postScale(scale, scale, mid.x, mid.y);
                }
            }
            break;
        case MotionEvent.ACTION_UP:
        case MotionEvent.ACTION_POINTER_UP:
            mode = NONE;
            Log.d(TAG, "mode=NONE");
            break;
    }
    // Perform the transformation
    view.setImageMatrix(matrix);
    return true; // indicate event was handled
}
 
開發者ID:sega4revenge,項目名稱:Sega,代碼行數:48,代碼來源:Fullscreen.java


注:本文中的android.widget.ImageView.setImageMatrix方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。