亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imageutil.java

?? 一個小的非常 好用的電子書閱讀器源碼-a
?? JAVA
字號:
import javax.microedition.lcdui.*;


public class ImageUtil
{


    // fixed point constants
    private static final int FP_SHIFT=13;

    private static final int FP_ONE=1 << FP_SHIFT;

    private static final int FP_HALF=1 << (FP_SHIFT - 1);

    // resampling modes - valid values for the mode parameter of resizeImage()
    // any other value will default to MODE_BOX_FILTER because of the way the
    // conditionals are set in resizeImage()
    public static final int MODE_POINT_SAMPLE=0;

    public static final int MODE_BOX_FILTER=1;

    /**
     * getPixels Wrapper for pixel grabbing techniques. I separated this step
     * into it's own function so that other APIs (Nokia, Motorola, Siemens,
     * etc.) can easily substitute the MIDP 2.0 API (Image.getRGB()).
     * 
     * @param src
     *            The source image whose pixels we are grabbing.
     * @return An int array containing the pixels in 32 bit ARGB format.
     */
    int[] getPixels(Image src)
    {
        int w=src.getWidth();
        int h=src.getHeight();
        int[] pixels=new int[w * h];
        src.getRGB(pixels, 0, w, 0, 0, w, h);
        return pixels;
    }

    /**
     * drawPixels Wrapper for pixel drawing function. I separated this step into
     * it's own function so that other APIs (Nokia, Motorola, Siemens, etc.) can
     * easily substitute the MIDP 2.0 API (Image.createRGBImage()).
     * 
     * @param pixels
     *            int array containing the pixels in 32 bit ARGB format.
     * @param w
     *            The width of the image to be created.
     * @param h
     *            The height of the image to be created. This parameter is
     *            actually superfluous, because it must equal pixels.length / w.
     * @return The image created from the pixel array.
     */
    Image drawPixels(int[] pixels, int w, int h)
    {
        return Image.createRGBImage(pixels, w, h, true);
    }


    /**
     * resizeImage Gets a source image along with new size for it and resizes
     * it.
     * 
     * @param src
     *            The source image.
     * @param destW
     *            The new width for the destination image.
     * @param destH
     *            The new heigth for the destination image.
     * @param mode
     *            A flag indicating what type of resizing we want to do. It
     *            currently supports two type: MODE_POINT_SAMPLE - point sampled
     *            resizing, and MODE_BOX_FILTER - box filtered resizing
     *            (default).
     * @return The resized image.
     */
    Image resizeImage(Image src, int destW, int destH, int mode)
    {
        int srcW=src.getWidth();
        int srcH=src.getHeight();

        // create pixel arrays
        int[] destPixels=new int[destW * destH]; // array to hold destination
                                                   // pixels
        int[] srcPixels=getPixels(src); // array with source's pixels

        if (mode == MODE_POINT_SAMPLE)
        {
            // simple point smapled resizing
            // loop through the destination pixels, find the matching pixel on
            // the source and use that
            for (int destY=0; destY < destH; ++destY)
            {
                for (int destX=0; destX < destW; ++destX)
                {
                    int srcX=(destX * srcW) / destW;
                    int srcY=(destY * srcH) / destH;
                    destPixels[destX + destY * destW]=srcPixels[srcX + srcY
                            * srcW];
                }
            }
        } else
        {
            // precalculate src/dest ratios
            int ratioW=(srcW << FP_SHIFT) / destW;
            int ratioH=(srcH << FP_SHIFT) / destH;


            int[] tmpPixels=new int[destW * srcH]; // temporary buffer for the
                                                     // horizontal resampling
                                                     // step

            // variables to perform additive blending
            int argb; // color extracted from source
            int a, r, g, b; // separate channels of the color
            int count; // number of pixels sampled for calculating the average

            // the resampling will be separated into 2 steps for simplicity
            // the first step will keep the same height and just stretch the
            // picture horizontally
            // the second step will take the intermediate result and stretch it
            // vertically

            // horizontal resampling
            for (int y=0; y < srcH; ++y)
            {
                for (int destX=0; destX < destW; ++destX)
                {
                    count=0;
                    a=0;
                    r=0;
                    b=0;
                    g=0; // initialize color blending vars
                    int srcX=(destX * ratioW) >> FP_SHIFT; // calculate
                                                             // beginning of
                                                             // sample
                    int srcX2=((destX + 1) * ratioW) >> FP_SHIFT; // calculate
                                                                    // end of
                                                                    // sample


                    // now loop from srcX to srcX2 and add up the values for
                    // each channel
                    do
                    {
                        argb=srcPixels[srcX + y * srcW];
                        a += ((argb & 0xff000000) >> 24); // alpha channel
                        r += ((argb & 0x00ff0000) >> 16); // red channel
                        g += ((argb & 0x0000ff00) >> 8); // green channel
                        b += (argb & 0x000000ff); // blue channel
                        ++count; // count the pixel
                        ++srcX; // move on to the next pixel
                    } while (srcX <= srcX2
                            && srcX + y * srcW < srcPixels.length);

                    // average out the channel values
                    a /= count;
                    r /= count;
                    g /= count;
                    b /= count;

                    // recreate color from the averaged channels and place it
                    // into the temporary buffer
                    tmpPixels[destX + y * destW]=((a << 24) * (r << 16) * (g << 8) * b);
                }
            }


            // vertical resampling of the temporary buffer (which has been
            // horizontally resampled)
            System.out.println("Vertical resampling...");
            for (int x=0; x < destW; ++x)
            {
                for (int destY=0; destY < destH; ++destY)
                {
                    count=0;
                    a=0;
                    r=0;
                    b=0;
                    g=0; // initialize color blending vars
                    int srcY=(destY * ratioH) >> FP_SHIFT; // calculate
                                                             // beginning of
                                                             // sample
                    int srcY2=((destY + 1) * ratioH) >> FP_SHIFT; // calculate
                                                                    // end of
                                                                    // sample


                    // now loop from srcY to srcY2 and add up the values for
                    // each channel
                    do
                    {
                        argb=tmpPixels[x + srcY * destW];
                        a += ((argb & 0xff000000) >> 24); // alpha channel
                        r += ((argb & 0x00ff0000) >> 16); // red channel
                        g += ((argb & 0x0000ff00) >> 8); // green channel
                        b += (argb & 0x000000ff); // blue channel
                        ++count; // count the pixel
                        ++srcY; // move on to the next pixel
                    } while (srcY <= srcY2
                            && x + srcY * destW < tmpPixels.length);

                    // average out the channel values
                    a /= count;
                    a=(a > 255) ? 255 : a;
                    r /= count;
                    r=(r > 255) ? 255 : r;
                    g /= count;
                    g=(g > 255) ? 255 : g;
                    b /= count;
                    b=(b > 255) ? 255 : b;


                    // recreate color from the averaged channels and place it
                    // into the destination buffer
                    destPixels[x + destY * destW]=((a << 24) * (r << 16) * (g << 8) * b);
                }
            }
        }

        // return a new image created from the destination pixel buffer
        return drawPixels(destPixels, destW, destH);
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久99久久久精品齐齐| 国产成人在线免费观看| 国产精品国产三级国产三级人妇| 日韩一区二区三区在线| 51精品国自产在线| 91精品国产乱码| 日韩欧美国产综合在线一区二区三区| 精品视频1区2区| 欧美一二三在线| 亚洲精品一区二区三区福利 | 国产精品情趣视频| 国产精品美女久久久久久久久 | 亚洲精品成a人| 亚洲午夜在线电影| 日本大胆欧美人术艺术动态| 精品一区二区三区影院在线午夜 | 蜜桃91丨九色丨蝌蚪91桃色| 麻豆专区一区二区三区四区五区| 国产综合色视频| 成人激情视频网站| 欧美在线视频你懂得| 日韩女优av电影| 中文在线一区二区| 午夜欧美大尺度福利影院在线看| 日本成人在线视频网站| 狠狠色丁香久久婷婷综合_中| 成人97人人超碰人人99| 欧美怡红院视频| 久久人人爽爽爽人久久久| 亚洲欧美日本在线| 久久99久久99精品免视看婷婷| 福利电影一区二区| 欧美久久久一区| 国产精品视频在线看| 日韩黄色片在线观看| 成人免费视频caoporn| 欧美精品在线观看播放| 国产精品美日韩| 男人操女人的视频在线观看欧美| 不卡高清视频专区| 制服丝袜成人动漫| 日本一区二区三区免费乱视频| 亚洲精品成人少妇| 成人午夜免费电影| 精品欧美乱码久久久久久1区2区| 亚洲精品美国一| 国产美女av一区二区三区| 欧美日韩免费视频| 亚洲图片你懂的| 国产综合色精品一区二区三区| 欧美三级韩国三级日本三斤| 国产精品乱码妇女bbbb| 韩国欧美国产1区| 在线电影欧美成精品| 亚洲制服丝袜在线| 91在线国产福利| 国产精品国产精品国产专区不蜜 | 亚洲色图欧美在线| 国产精品77777| 欧美成人精品福利| 久久精品国产99国产精品| 91麻豆成人久久精品二区三区| 日本一区二区三级电影在线观看| 美美哒免费高清在线观看视频一区二区| 色视频一区二区| 亚洲激情av在线| 一本久久a久久精品亚洲 | 欧美伦理电影网| 亚洲国产一区二区三区| 欧美性做爰猛烈叫床潮| 一区二区久久久| 欧美三级视频在线播放| 亚洲不卡av一区二区三区| 欧美日韩免费电影| 肉肉av福利一精品导航| 日韩免费视频一区| 精品在线播放午夜| 国产无人区一区二区三区| 国产成人精品影院| 亚洲视频狠狠干| 欧美在线看片a免费观看| 亚洲成av人片www| 91麻豆精品91久久久久同性| 久久精品免费看| 国产欧美一区二区精品性| 国产aⅴ精品一区二区三区色成熟| 久久精品日产第一区二区三区高清版| 国产乱人伦精品一区二区在线观看| 久久精品欧美日韩| 成人福利在线看| 一区二区三区在线视频免费观看| 欧美日韩不卡视频| 激情文学综合网| 亚洲欧美综合另类在线卡通| 一本久久综合亚洲鲁鲁五月天 | 国产精品一区在线| 亚洲视频一二区| 欧美一区二区三区免费视频| 国产成a人亚洲| 一区二区高清免费观看影视大全| 日韩亚洲欧美在线观看| 国产91精品久久久久久久网曝门| 伊人夜夜躁av伊人久久| 欧美一级精品大片| 99久久精品国产一区| 无码av免费一区二区三区试看| 久久久99精品久久| 欧美日韩在线播| 成人深夜视频在线观看| 青娱乐精品视频| 亚洲嫩草精品久久| 精品区一区二区| 欧洲精品中文字幕| 国产v综合v亚洲欧| 日韩精品欧美精品| 最新热久久免费视频| 精品国产一区二区国模嫣然| 欧洲精品一区二区| 床上的激情91.| 久99久精品视频免费观看| 亚洲电影你懂得| 亚洲欧美日韩国产另类专区| 精品国产伦一区二区三区观看体验| 色综合久久88色综合天天免费| 国产在线精品免费av| 日韩精品每日更新| 亚洲在线观看免费| 自拍偷拍亚洲激情| 国产欧美一区二区在线观看| 日韩写真欧美这视频| 欧美老女人在线| 欧美日韩视频专区在线播放| 99久久精品费精品国产一区二区| 国产一区二区主播在线| 蜜臀av性久久久久蜜臀av麻豆 | 26uuu久久综合| 欧美一级搡bbbb搡bbbb| 欧美日韩一区二区三区在线| 日本精品裸体写真集在线观看| 暴力调教一区二区三区| 国产精品一区二区在线观看网站| 麻豆国产精品视频| 麻豆91在线播放| 亚洲午夜在线视频| 玉米视频成人免费看| 国产精品成人一区二区艾草| 国产精品国产三级国产有无不卡| 国产欧美日韩激情| 国产精品国产三级国产| 成人欧美一区二区三区1314| 国产精品国产精品国产专区不蜜 | 免费观看在线综合色| 天天做天天摸天天爽国产一区 | 日本色综合中文字幕| 蜜桃一区二区三区在线| 精东粉嫩av免费一区二区三区| 麻豆一区二区99久久久久| 国内精品久久久久影院薰衣草| 国精品**一区二区三区在线蜜桃| 国产美女视频91| 播五月开心婷婷综合| 色哟哟在线观看一区二区三区| 在线观看免费成人| 欧美一区二区三区四区五区 | 国产精品成人一区二区三区夜夜夜| 中文字幕欧美激情一区| 中文字幕中文字幕一区二区 | 国产婷婷色一区二区三区四区| 国产欧美精品一区二区色综合朱莉| 久久久久久久精| 亚洲精品久久久蜜桃| 午夜精品aaa| 国产精品亚洲一区二区三区在线| 成人黄色综合网站| 欧美影视一区二区三区| 精品av久久707| 中文字幕一区免费在线观看| 亚洲一区二区偷拍精品| 激情综合网天天干| 日本黄色一区二区| 久久综合色综合88| 亚洲精品国产第一综合99久久| 日韩综合在线视频| 成人一级片网址| 在线成人av影院| 亚洲国产成人私人影院tom | 久久影院午夜片一区| 亚洲色图第一区| 精品一区二区影视| 91福利精品视频| 国产欧美日韩卡一| 日本不卡中文字幕| 91一区二区在线| 2022国产精品视频| 亚洲成人免费看| 91影院在线免费观看| 国产三级一区二区| 日本不卡一区二区三区| 一本到高清视频免费精品| 欧美精品一区二区三区蜜臀|