• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 
17 package com.android.launcher;
18 
19 import android.graphics.drawable.Drawable;
20 import android.graphics.PixelFormat;
21 import android.graphics.Bitmap;
22 import android.graphics.Canvas;
23 import android.graphics.ColorFilter;
24 
25 class FastBitmapDrawable extends Drawable {
26     private Bitmap mBitmap;
27 
FastBitmapDrawable(Bitmap b)28     FastBitmapDrawable(Bitmap b) {
29         mBitmap = b;
30     }
31 
32     @Override
draw(Canvas canvas)33     public void draw(Canvas canvas) {
34         canvas.drawBitmap(mBitmap, 0.0f, 0.0f, null);
35     }
36 
37     @Override
getOpacity()38     public int getOpacity() {
39         return PixelFormat.TRANSLUCENT;
40     }
41 
42     @Override
setAlpha(int alpha)43     public void setAlpha(int alpha) {
44     }
45 
46     @Override
setColorFilter(ColorFilter cf)47     public void setColorFilter(ColorFilter cf) {
48     }
49 
50     @Override
getIntrinsicWidth()51     public int getIntrinsicWidth() {
52         return mBitmap.getWidth();
53     }
54 
55     @Override
getIntrinsicHeight()56     public int getIntrinsicHeight() {
57         return mBitmap.getHeight();
58     }
59 
60     @Override
getMinimumWidth()61     public int getMinimumWidth() {
62         return mBitmap.getWidth();
63     }
64 
65     @Override
getMinimumHeight()66     public int getMinimumHeight() {
67         return mBitmap.getHeight();
68     }
69 
getBitmap()70     public Bitmap getBitmap() {
71         return mBitmap;
72     }
73 }
74