Android位图图像

Android位图图像,android,bitmap,Android,Bitmap,我是android开发新手。 我想知道如何修改用户从图库中选择的图像。 是否可以使用“文件输入流”获取图像? 还是应该使用位图?从相应的位图创建画布对象。 所有编辑都可以在画布实例上完成,并将应用于位图对象。使用。它还支持iOS和WindowPhone7。鸟舍提供大多数功能,如方向、裁剪、锐度、红眼、变白和瑕疵、贴纸、绘图、文本和模因(测试版)、亮度、饱和度、对比度和自定义选项 import android.graphics.Bitmap; public class ProcessingIma

我是android开发新手。 我想知道如何修改用户从图库中选择的图像。 是否可以使用“文件输入流”获取图像?
还是应该使用位图?

从相应的位图创建画布对象。 所有编辑都可以在画布实例上完成,并将应用于位图对象。

使用。它还支持iOS和WindowPhone7。鸟舍提供大多数功能,如方向、裁剪、锐度、红眼、变白和瑕疵、贴纸、绘图、文本和模因(测试版)、亮度、饱和度、对比度和自定义选项

import android.graphics.Bitmap;

public class ProcessingImage {
private Bitmap defaultImg;
private int idBitmap;

public int getIdBitmap() {
    return idBitmap;
}

public void setIdBitmap(int idBitmap) {
    this.idBitmap = idBitmap;
}

public Bitmap getDefaultImg() {
    return defaultImg;
}

public void setDefaultImg(Bitmap defaultImg) {
    this.defaultImg = defaultImg;
}

public ProcessingImage() {
}

public Bitmap processingI(Bitmap myBitmap) {
    return myBitmap;
}

public Bitmap TintThePicture(int deg, Bitmap defaultBitmap) {

    int w = defaultBitmap.getWidth();
    int h = defaultBitmap.getHeight();

    int[] pix = new int[w * h];
    defaultBitmap.getPixels(pix, 0, w, 0, 0, w, h);

    double angle = (3.14159d * (double) deg) / 180.0d;
    int S = (int) (256.0d * Math.sin(angle));
    int C = (int) (256.0d * Math.cos(angle));

    int r, g, b, index;
    int RY, BY, RYY, GYY, BYY, R, G, B, Y;

    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            index = y * w + x;
            r = (pix[index] >> 16) & 0xff;
            g = (pix[index] >> 8) & 0xff;
            b = pix[index] & 0xff;
            RY = (70 * r - 59 * g - 11 * b) / 100;
            BY = (-30 * r - 59 * g + 89 * b) / 100;
            Y = (30 * r + 59 * g + 11 * b) / 100;
            RYY = (S * BY + C * RY) / 256;
            BYY = (C * BY - S * RY) / 256;
            GYY = (-51 * RYY - 19 * BYY) / 100;
            R = Y + RYY;
            R = (R < 0) ? 0 : ((R > 255) ? 255 : R);
            G = Y + GYY;
            G = (G < 0) ? 0 : ((G > 255) ? 255 : G);
            B = Y + BYY;
            B = (B < 0) ? 0 : ((B > 255) ? 255 : B);
            pix[index] = 0xff000000 | (R << 16) | (G << 8) | B;
        }
    }

    Bitmap bm = Bitmap.createBitmap(w, h, defaultBitmap.getConfig());
    bm.setPixels(pix, 0, w, 0, 0, w, h);

    pix = null;
    return bm;
}
}
导入android.graphics.Bitmap;
公共类处理映像{
私有位图默认img;
私有int idBitmap;
public int getIdBitmap(){
返回idBitmap;
}
公共void setIdBitmap(int idBitmap){
this.idBitmap=idBitmap;
}
公共位图getDefaultImg(){
返回defaultImg;
}
public void setDefaultImg(位图defaultImg){
this.defaultImg=defaultImg;
}
公共处理映像(){
}
公共位图处理i(位图myBitmap){
返回我的位图;
}
公共位图颜色图片(整数度,位图默认位图){
int w=defaultBitmap.getWidth();
int h=defaultBitmap.getHeight();
int[]pix=新int[w*h];
获取像素(像素,0,w,0,0,w,h);
双角度=(3.14159d*(双)度)/180.0d;
int S=(int)(256.0d*Math.sin(角度));
int C=(int)(256.0d*Math.cos(角度));
int r,g,b,索引;
in-RY,BY,RYY,GYY,BYY,R,G,B,Y;
对于(int y=0;y>16)&0xff;
g=(pix[index]>>8)&0xff;
b=pix[索引]&0xff;
RY=(70*r-59*g-11*b)/100;
BY=(-30*r-59*g+89*b)/100;
Y=(30*r+59*g+11*b)/100;
RYY=(S*BY+C*RY)/256;
BYY=(C*BY-S*RY)/256;
GYY=(-51*RYY-19*BYY)/100;
R=Y+RYY;
R=(R<0)?0:((R>255)?255:R);
G=Y+GYY;
G=(G<0)?0:((G>255)?255:G);
B=Y+BYY;
B=(B<0)?0:((B>255)?255:B);
pix[index]=0xff000000|(R