国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 阳山县| 郯城县| 合山市| 潞城市| 若尔盖县| 屏边| 奉新县| 安达市| 潼关县| 潼南县| 客服| 靖宇县| 中超| 东宁县| 娄烦县| 阿勒泰市| 石城县| 怀宁县| 江陵县| 九龙坡区| 东港市| 明水县| 揭西县| 肥城市| 新龙县| 麟游县| 长白| 武强县| 清流县| 平江县| 柞水县| 宁远县| 洪雅县| 梅河口市| 晋州市| 江城| 都匀市| 松阳县| 奉新县| 莱州市| 洪洞县|