中文字幕免费精品_亚洲视频自拍_亚洲综合国产激情另类一区_色综合咪咪久久

安卓開發(fā)中Bitmap源碼實(shí)例
來源:易賢網(wǎng) 閱讀:1712 次 日期:2014-08-21 15:57:23
溫馨提示:易賢網(wǎng)小編為您整理了“安卓開發(fā)中Bitmap源碼實(shí)例”,方便廣大網(wǎng)友查閱!

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 {

super(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

* @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

* @param m Option matrix to be applied to the pixels

* @param filter true if the source should be filtered.

* Only applies if the matrix contains more than just

* translation.

* @return A bitmap that represents the specified subset of source

* @throws IllegalArgumentException if the x, y, width, height values are

* outside of the dimensions of the source bitmap.

*/

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

int height, Matrix m, boolean filter) {

checkXYSign(x, y);

checkWidthHeight(width, height);

if (x + width > source.getWidth()) {

throw new IllegalArgumentException(

"x + width must be <= bitmap.width()");

}

if (y + height > source.getHeight()) {

throw new IllegalArgumentException(

"y + height must be <= bitmap.height()");

}

// check if we can just return our argument unchanged

if (!source.isMutable() && x == 0 && y == 0

&& width == source.getWidth() && height == source.getHeight()

&& (m == null || m.isIdentity())) {

return source;

}

if (m == null || m.isIdentity()) {

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

}

int neww = width;

int newh = height;

Paint paint;

Rect srcR = new Rect(x, y, x + width, y + height);

RectF dstR = new RectF(0, 0, width, height);

/* the dst should have alpha if the src does, or if our matrix

doesn't preserve rectness

*/

boolean hasAlpha = source.hasAlpha() || !m.rectStaysRect();

RectF deviceR = new RectF();

m.mapRect(deviceR, dstR);

neww = Math.round(deviceR.width());

newh = Math.round(deviceR.height());

Canvas canvas = new Canvas(neww, newh);

canvas.translate(-deviceR.left, -deviceR.top);

canvas.concat(m);

paint = new Paint();

paint.setFilterBitmap(filter);

if (!m.rectStaysRect()) {

paint.setAntiAlias(true);

}

canvas.drawBitmap(source, srcR, dstR, paint);

return new Bitmap(canvas.getImage());

}

/**

* Returns a mutable bitmap with the specified width and height.

*

* @param width The width of the bitmap

* @param height The height of the bitmap

* @param config The bitmap config to create.

* @throws IllegalArgumentException if the width or height are <= 0

*/

public static Bitmap createBitmap(int width, int height, Config config) {

return new Bitmap(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB));

}

/**

* Returns a immutable bitmap with the specified width and height, with each

* pixel value set to the corresponding value in the colors array.

*

* @param colors Array of {@link Color} used to initialize the pixels.

* @param offset Number of values to skip before the first color in the

* array of colors.

* @param stride Number of colors in the array between rows (must be >=

* width or <= -width).

* @param width The width of the bitmap

* @param height The height of the bitmap

* @param config The bitmap config to create. If the config does not

* support per-pixel alpha (e.g. RGB_565), then the alpha

* bytes in the colors[] will be ignored (assumed to be FF)

* @throws IllegalArgumentException if the width or height are <= 0, or if

* the color array's length is less than the number of pixels.

*/

public static Bitmap createBitmap(int colors[], int offset, int stride,

int width, int height, Config config) {

checkWidthHeight(width, height);

if (Math.abs(stride) < width) {

throw new IllegalArgumentException("abs(stride) must be >= width");

}

int lastScanline = offset + (height - 1) * stride;

int length = colors.length;

if (offset < 0 || (offset + width > length)

|| lastScanline < 0

|| (lastScanline + width > length)) {

throw new ArrayIndexOutOfBoundsException();

}

// TODO: create an immutable bitmap...

throw new UnsupportedOperationException();

}

/**

* Returns a immutable bitmap with the specified width and height, with each

* pixel value set to the corresponding value in the colors array.

*

* @param colors Array of {@link Color} used to initialize the pixels.

* This array must be at least as large as width * height.

* @param width The width of the bitmap

* @param height The height of the bitmap

* @param config The bitmap config to create. If the config does not

* support per-pixel alpha (e.g. RGB_565), then the alpha

* bytes in the colors[] will be ignored (assumed to be FF)

* @throws IllegalArgumentException if the width or height are <= 0, or if

* the color array's length is less than the number of pixels.

*/

public static Bitmap createBitmap(int colors[], int width, int height,

Config config) {

return createBitmap(colors, 0, width, width, height, config);

}

public static Bitmap createScaledBitmap(Bitmap src, int dstWidth,

int dstHeight, boolean filter) {

Matrix m;

synchronized (Bitmap.class) {

// small pool of just 1 matrix

m = sScaleMatrix;

sScaleMatrix = null;

}

if (m == null) {

m = new Matrix();

}

final int width = src.getWidth();

final int height = src.getHeight();

final float sx = dstWidth / (float)width;

final float sy = dstHeight / (float)height;

m.setScale(sx, sy);

Bitmap b = Bitmap.createBitmap(src, 0, 0, width, height, m, filter);

synchronized (Bitmap.class) {

// do we need to check for null? why not just assign everytime?

if (sScaleMatrix == null) {

sScaleMatrix = m;

}

}

return b;

}

}

更多信息請查看IT技術(shù)專欄

更多信息請查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:安卓開發(fā)中Bitmap源碼實(shí)例
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2026上岸·考公考編培訓(xùn)報(bào)班

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)
中文字幕免费精品_亚洲视频自拍_亚洲综合国产激情另类一区_色综合咪咪久久
久久精品成人一区二区三区蜜臀| 亚洲第一精品电影| 亚洲乱码国产乱码精品精天堂 | 亚洲欧美日韩人成在线播放| 久久蜜桃av一区精品变态类天堂| 欧美极品在线播放| 国产综合色产在线精品| 亚洲欧美亚洲| 欧美少妇一区| av不卡在线| 欧美激情一区二区在线 | 一本高清dvd不卡在线观看| 一区二区三区在线免费播放| 亚洲精品在线观看视频| 亚洲天堂成人| 老司机免费视频一区二区三区| 亚洲免费在线观看| 欧美乱人伦中文字幕在线| 亚洲盗摄视频| 免费看亚洲片| 亚洲国产精品久久| 欧美成人午夜影院| 亚洲青色在线| 欧美日韩国产二区| 在线视频精品| 欧美午夜宅男影院| 亚洲欧美在线观看| 国产欧美日韩亚洲一区二区三区 | 裸体歌舞表演一区二区| 激情亚洲网站| 欧美激情第1页| 亚洲午夜精品一区二区三区他趣| 欧美日韩一区视频| 亚洲精品综合| 国产精品视频你懂的| 性久久久久久久久久久久| 黄色一区二区三区四区| 欧美韩日高清| 亚洲欧美视频一区| 激情另类综合| 欧美日韩三级视频| 欧美一级午夜免费电影| 亚洲第一搞黄网站| 欧美日韩综合不卡| 久久国产黑丝| 亚洲三级网站| 国产精品揄拍500视频| 久久久综合精品| 日韩午夜三级在线| 国产欧美婷婷中文| 欧美国产日本在线| 香蕉av福利精品导航| 怡红院精品视频| 欧美日韩在线视频首页| 亚洲一区二区在线免费观看| 国产一区高清视频| 欧美精品成人91久久久久久久| 亚洲无限av看| 国产亚洲毛片在线| 亚洲午夜一区| 亚洲电影免费观看高清| 欧美激情国产日韩| 亚洲欧美春色| 亚洲大片一区二区三区| 国产精品久久久999| 久久激情中文| 亚洲区一区二区三区| 国产精品免费看片| 久热精品视频| 一区二区三区不卡视频在线观看 | 亚洲精品影院在线观看| 欧美日韩在线一区| 欧美在线免费一级片| 亚洲国产精品成人一区二区| 欧美日韩免费观看中文| 亚欧美中日韩视频| 亚洲国产欧美一区二区三区久久 | 国产午夜精品一区二区三区视频 | 欧美一二区视频| 在线日韩日本国产亚洲| 欧美日韩亚洲系列| 久久成人资源| 麻豆av福利av久久av| 国产欧美精品国产国产专区| 一区二区欧美精品| 国产日韩欧美在线看| 欧美国产视频在线观看| 亚洲欧美日韩久久精品 | 日韩亚洲视频在线| 黄色资源网久久资源365| 欧美日韩三区四区| 久久动漫亚洲| av成人免费在线| 韩国一区二区三区在线观看| 欧美日韩一区二区三区四区在线观看 | 在线视频一区观看| 在线观看的日韩av| 国产精品美女999| 欧美日本韩国一区| 久久免费黄色| 一区二区三区不卡视频在线观看| 久久精品中文| 国产一区二区三区四区| 欧美日韩三区| 国产精品a久久久久| 美女图片一区二区| 欧美在线国产| 亚洲一区精品在线| 日韩亚洲欧美中文三级| 在线成人av| 国产一区二区无遮挡| 欧美视频在线播放| 久久九九电影| 午夜日韩视频| 亚洲性视频h| 99re6这里只有精品| 亚洲激情av| 在线成人免费观看| 国模一区二区三区| 国产午夜精品视频| 国产精品爽爽爽| 国产精品爱久久久久久久| 亚洲欧美日韩国产一区二区三区 | 欧美日韩人人澡狠狠躁视频| 免费亚洲电影| 国产欧美日韩视频在线观看 | 欧美成人按摩| 久久久综合网站| 久久久久久网址| 曰韩精品一区二区| 国内外成人在线视频| 欧美视频在线一区二区三区| 欧美日韩国产一区二区| 欧美巨乳在线| 欧美激情网站在线观看| 免费欧美在线| 欧美不卡一区| 欧美福利一区二区| 欧美精品网站| 欧美日韩视频免费播放| 欧美三级视频在线播放| 欧美亚州一区二区三区| av成人免费在线观看| 在线观看日韩一区| 国内精品一区二区| 亚洲激情一区二区三区| 在线看国产日韩| 狠狠色综合色综合网络| 久久久夜色精品亚洲| 久久国产精品久久久久久| 亚洲国产精品久久人人爱蜜臀| 欧美大片在线观看| 国产视频一区欧美| 在线欧美电影| 亚洲精选视频免费看| 中文亚洲免费| 黄色成人在线免费| 久久精品亚洲一区| 欧美视频专区一二在线观看| 欧美日韩一卡| 国产视频精品网| 国产精品亚洲а∨天堂免在线| 欧美日本在线| 欧美va日韩va| 欧美电影免费观看网站| 久久久水蜜桃av免费网站| 日韩一级视频免费观看在线| 亚洲人成人99网站| 亚洲高清免费| 亚洲国产精品久久久久秋霞影院| 亚洲免费观看| 亚洲视频香蕉人妖| 久久久青草婷婷精品综合日韩| 老牛嫩草一区二区三区日本| 欧美日韩不卡视频| 亚洲高清视频在线观看| 国产农村妇女毛片精品久久莱园子| 在线午夜精品| 欧美三级日本三级少妇99| 亚洲国产精品va在看黑人| 亚洲综合精品| 欧美性做爰猛烈叫床潮| 最新中文字幕亚洲| 欧美激情按摩在线| 欧美aa在线视频| 欧美性猛交99久久久久99按摩| 亚洲国产日韩在线| 久久久蜜桃精品| 欧美日韩另类一区| 欧美三级电影一区| 精品成人一区二区三区| 亚洲天堂av在线免费| 极品尤物av久久免费看| 亚洲人成在线播放网站岛国| av72成人在线| 欧美+亚洲+精品+三区| 亚洲黄色在线视频| 久久免费高清视频| 欧美精品一线| 国内精品久久国产|