1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.test.hwui;
18
19import android.app.Activity;
20import android.content.Context;
21import android.graphics.Canvas;
22import android.graphics.Paint;
23import android.os.Bundle;
24import android.util.Log;
25import android.view.View;
26
27@SuppressWarnings({"UnusedDeclaration"})
28public class MatrixActivity extends Activity {
29    @Override
30    protected void onCreate(Bundle savedInstanceState) {
31        super.onCreate(savedInstanceState);
32
33        setContentView(new MatrixView(this));
34    }
35
36    static class MatrixView extends View {
37        MatrixView(Context c) {
38            super(c);
39        }
40
41        @Override
42        protected void onDraw(Canvas canvas) {
43            super.onDraw(canvas);
44            canvas.drawRGB(255, 255, 255);
45
46            Log.d("Matrix", "m1=" + canvas.getMatrix());
47
48            canvas.save();
49            canvas.translate(10.0f, 10.0f);
50            Log.d("Matrix", "m2=" + canvas.getMatrix());
51            canvas.translate(20.0f, 20.0f);
52            Log.d("Matrix", "m3=" + canvas.getMatrix());
53            canvas.restore();
54        }
55    }
56}
57