当前位置: 首页>>代码示例>>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;未经允许,请勿转载。