国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

!安卓開發(fā)中Bitmap源碼實例

2019-11-02 14:56:43
字體:
供稿:網(wǎng)友

 安卓開發(fā)中Bitmap源碼實例

  package android.graphics;

  import java.awt.image.BufferedImage;

  import java.io.File;

  import java.io.IOException;

  import java.io.InputStream;

  import javax.imageio.ImageIO;

  public final class Bitmap extends _Original_Bitmap {

  private BufferedImage mImage;

  public Bitmap(File input) throws IOException {

  super(1, true, null, -1);

  mImage = ImageIO.read(input);

  }

  public Bitmap(InputStream is) throws IOException {

  s

南瓜園影院[www.aikan.tv/special/nanguayuanyingyuan/]
uper(1, true, null, -1);

  mImage = ImageIO.read(is);

  }

  Bitmap(BufferedImage image) {

  super(1, true, null, -1);

  mImage = image;

  }

  public BufferedImage getImage() {

  return mImage;

  }

  // ----- overriden methods

  public enum Config {

  // these native values must match up with the enum in SkBitmap.h

  ALPHA_8 (2),

  RGB_565 (4),

  ARGB_4444 (5),

  ARGB_8888 (6);

  Config(int ni) {

  this.nativeInt = ni;

  }

  final int nativeInt;

  /* package */ static Config nativeToConfig(int ni) {

  return sConfigs[ni];

  }

  private static Config sConfigs[] = {

  null, null, ALPHA_8, null, RGB_565, ARGB_4444, ARGB_8888

  };

  }

  @Override

  public int getWidth() {

  return mImage.getWidth();

  }

  @Override

  public int getHeight() {

  return mImage.getHeight();

  }

  /**

  * Returns an immutable bitmap from the source bitmap. The new bitmap may

  * be the same object as source, or a copy may have been made.

  */

  public static Bitmap createBitmap(Bitmap src) {

  return createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), null, false);

  }

  /**

  * Returns an immutable bitmap from the specified subset of the source

  * bitmap. The new bitmap may be the same object as source, or a copy may

  * have been made.

  *

  * @param source The bitmap we are subsetting

  * @param x The x coordinate of the first pixel in source

  * @param y The y coordinate of the first pixel in source

  * @param width The number of pixels in each row

  * @param height The number of rows

  */

  public static Bitmap createBitmap(Bitmap source, int x, int y,

  int width, int height) {

  return new Bitmap(source.mImage.getSubimage(x, y, width, height));

  }

  /**

  * Returns an immutable bitmap from subset of the source bitmap,

  * transformed by the optional matrix.

  *

  * @param source The bitmap we are subsetting

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 台中县| 桦川县| 灵璧县| 菏泽市| 阿鲁科尔沁旗| 五原县| 海盐县| 右玉县| 渝中区| 乐平市| 安西县| 汝城县| 玛沁县| 财经| 栾城县| 东乌珠穆沁旗| 虹口区| 洞口县| 连云港市| 兴宁市| 上犹县| 库伦旗| 博乐市| 屯昌县| 金华市| 磐石市| 达州市| 辉南县| 舒兰市| 海安县| 岳阳县| 新邵县| 小金县| 湘西| 团风县| 丹阳市| 葵青区| 云南省| 剑阁县| 霍邱县| 应城市|