App
BitmapInfo.java
Go to the documentation of this file.
1 package mhr.appcore.bitmap;
2 
3 import mhr.appcore.utils.Rect;
4 
8 public class BitmapInfo {
9  public int width = 0;
10  public int height = 0;
11  public boolean premultiplied = false;
15 
19  public BitmapInfo() {
20  }
21 
32  this.width = width;
33  this.height = height;
34  this.premultiplied = premultiplied;
35  this.channelCount = channelCount;
36  this.depth = depth;
37  this.colorMode = colorMode;
38  }
39 
44  public BitmapInfo(BitmapInfo other) {
45  this.width = other.width;
46  this.height = other.height;
47  this.premultiplied = other.premultiplied;
48  this.channelCount = other.channelCount;
49  this.depth = other.depth;
50  this.colorMode = other.colorMode;
51  }
52 
57  public boolean isValid() {
59  return true;
60  } else {
61  return false;
62  }
63  }
64 
69  public Rect getRect() {
70  return new Rect(width, height);
71  }
72 
80  if (width > 0 && height > 0) {
82  if (depth == Depth.DEPTH_8_BIT) {
83  return NativeType.MONO_8_BIT;
84  }
86  if (depth == Depth.DEPTH_8_BIT) {
87  return NativeType.RGBA_8_BIT;
88  }
89  }
90  }
91  return NativeType.INVALID_TYPE;
92  }
93 }