Example usage for android.graphics Matrix toString

List of usage examples for android.graphics Matrix toString

Introduction

In this page you can find the example usage for android.graphics Matrix toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:Main.java

public static void logMatrix(String tag, Matrix matrix) {
    if (matrix != null)
        Log.v(tag, matrix.toString());
}

From source file:com.scigames.registration.Registration4PhotoActivity.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CAMERA_REQUEST) {
        or.setVisibility(View.VISIBLE);
        retakeButton.setVisibility(View.VISIBLE);
        saveButton.setVisibility(View.VISIBLE);
        takePhotoButton.setVisibility(View.INVISIBLE);

        if (data.hasExtra("data")) {
            //change to new view
            photo = (Bitmap) data.getExtras().get("data");
            //photoUri = data.getExtras().get("data");
            Log.d(TAG, "photoDensity: ");
            Log.d(TAG, String.valueOf(photo.getDensity()));
            Log.d(TAG, "photo getHeight:");
            Log.d(TAG, String.valueOf(photo.getHeight()));
            Log.d(TAG, "photo getWidth");
            Log.d(TAG, String.valueOf(photo.getWidth()));
            Log.d(TAG, "photo config:");
            if (photo.getHeight() < photo.getWidth()) {
                Log.d(TAG, "height < width");

                Log.d(TAG, photo.getConfig().toString());
                photoToSend = Bitmap.createBitmap(120, 160, photo.getConfig());
                //photoToSend = Bitmap.createBitmap(photo);
                Canvas canvas = new Canvas(photoToSend);
                Log.d(TAG, "photo getScaledHeight:");
                Log.d(TAG, String.valueOf(photo.getScaledHeight(canvas)));
                Log.d(TAG, "photo getScaledWidth");
                Log.d(TAG, String.valueOf(photo.getScaledWidth(canvas)));
                Matrix matrix = new Matrix();
                //matrix.preScale(-1.0f, 1.0f);
                //Bitmap mirroredBitmap = Bitmap.createBitmap(photo, 0, 0, photo.getWidth(), photo.getHeight());
                matrix.setRotate(270, photo.getWidth() / 2, photo.getHeight() / 2);

                //matrix.postTranslate(photo.getWidth(),photo.getHeight());
                Log.d(TAG, matrix.toString());
                canvas.drawBitmap(photo, matrix, new Paint());
            } else {
                Log.d(TAG, photo.getConfig().toString());
                photoToSend = Bitmap.createBitmap(120, 160, photo.getConfig());
                //photoToSend = Bitmap.createBitmap(photo); 
                Canvas canvas = new Canvas(photoToSend);
                Log.d(TAG, "photo getScaledHeight:");
                Log.d(TAG, String.valueOf(photo.getScaledHeight(canvas)));
                Log.d(TAG, "photo getScaledWidth");
                Log.d(TAG, String.valueOf(photo.getScaledWidth(canvas)));
                Matrix matrix = new Matrix();
                //matrix.preScale(-1.0f, 1.0f);
                //Bitmap mirroredBitmap = Bitmap.createBitmap(photo, 0, 0, photo.getWidth(), photo.getHeight());
                //matrix.setRotate(0, photo.getWidth()/2, photo.getHeight()/2);
                //matrix.setScale(0.9f, 0.9f);
                Log.d(TAG, matrix.toString());
                //matrix.postTranslate(photo.getWidth(),photo.getHeight());

                canvas.drawBitmap(photo, matrix, new Paint());
                avatarPhoto.setScaleX(0.95f);
                avatarPhoto.setScaleY(0.95f);
                avatarPhoto.setX(180f);/*from   ww w  . j  a  va  2s . co m*/
                avatarPhoto.setY(440f);
            }
            avatarPhoto.setImageBitmap(photoToSend);

            Log.d(TAG, "photoToSendDensity: ");
            Log.d(TAG, String.valueOf(photoToSend.getDensity()));
            Log.d(TAG, "photoToSend getScaledHeight:");
            Log.d(TAG, String.valueOf(photoToSend.getHeight()));
            Log.d(TAG, "photoToSend getScaledWidth");
            Log.d(TAG, String.valueOf(photoToSend.getWidth()));
        } else {
            or.setVisibility(View.INVISIBLE);
            saveButton.setVisibility(View.INVISIBLE);
            retakeButton.setVisibility(View.INVISIBLE);
            takePhotoButton.setVisibility(View.VISIBLE);
            //instruction.setText("");
        }
    }
}