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

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

?? pngencoder.java

?? l系統 l系統 l系統 l系統 l系統 l系統 l系統 l系統
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
    /**     * Write an array of bytes into the pngBytes array, specifying number of bytes to write.     * Note: This routine has the side effect of updating     * maxPos, the largest element written in the array.     * The array is resized by 1000 bytes or the length     * of the data to be written, whichever is larger.     *     * @param data The data to be written into pngBytes.     * @param nBytes The number of bytes to be written.     * @param offset The starting point to write to.     * @return The next place to be written to in the pngBytes array.     */    protected int writeBytes( byte[] data, int nBytes, int offset )    {        maxPos = Math.max( maxPos, offset + nBytes );        if (nBytes + offset > pngBytes.length)        {            pngBytes = resizeByteArray( pngBytes, pngBytes.length +                Math.max( 1000, nBytes ) );        }        System.arraycopy( data, 0, pngBytes, offset, nBytes );        return offset + nBytes;    }    /**     * Write a two-byte integer into the pngBytes array at a given position.     *     * @param n The integer to be written into pngBytes.     * @param offset The starting point to write to.     * @return The next place to be written to in the pngBytes array.     */    protected int writeInt2( int n, int offset )    {        byte[] temp = { (byte)((n >> 8) & 0xff),            (byte) (n & 0xff) };        return writeBytes( temp, offset );    }    /**     * Write a four-byte integer into the pngBytes array at a given position.     *     * @param n The integer to be written into pngBytes.     * @param offset The starting point to write to.     * @return The next place to be written to in the pngBytes array.     */    protected int writeInt4( int n, int offset )    {        byte[] temp = { (byte)((n >> 24) & 0xff),            (byte) ((n >> 16) & 0xff ),            (byte) ((n >> 8) & 0xff ),            (byte) ( n & 0xff ) };        return writeBytes( temp, offset );    }    /**     * Write a single byte into the pngBytes array at a given position.     *     * @param n The integer to be written into pngBytes.     * @param offset The starting point to write to.     * @return The next place to be written to in the pngBytes array.     */    protected int writeByte( int b, int offset )    {        byte[] temp = { (byte) b };        return writeBytes( temp, offset );    }    /**     * Write a string into the pngBytes array at a given position.     * This uses the getBytes method, so the encoding used will     * be its default.     *     * @param n The integer to be written into pngBytes.     * @param offset The starting point to write to.     * @return The next place to be written to in the pngBytes array.     * @see java.lang.String#getBytes()     */    protected int writeString( String s, int offset )    {        return writeBytes( s.getBytes(), offset );    }    /**     * Write a PNG "IHDR" chunk into the pngBytes array.     */    protected void writeHeader()    {        int startPos;        startPos = bytePos = writeInt4( 13, bytePos );        bytePos = writeString( "IHDR", bytePos );        width = image.getWidth( null );        height = image.getHeight( null );        bytePos = writeInt4( width, bytePos );        bytePos = writeInt4( height, bytePos );        bytePos = writeByte( 8, bytePos ); // bit depth        bytePos = writeByte( (encodeAlpha) ? 6 : 2, bytePos ); // direct model        bytePos = writeByte( 0, bytePos ); // compression method        bytePos = writeByte( 0, bytePos ); // filter method        bytePos = writeByte( 0, bytePos ); // no interlace        crc.reset();        crc.update( pngBytes, startPos, bytePos-startPos );        crcValue = crc.getValue();        bytePos = writeInt4( (int) crcValue, bytePos );    }    /**     * Perform "sub" filtering on the given row.     * Uses temporary array leftBytes to store the original values     * of the previous pixels.  The array is 16 bytes long, which     * will easily hold two-byte samples plus two-byte alpha.     *     * @param pixels The array holding the scan lines being built     * @param startPos Starting position within pixels of bytes to be filtered.     * @param width Width of a scanline in pixels.     */    protected void filterSub( byte[] pixels, int startPos, int width )    {        int i;        int offset = bytesPerPixel;        int actualStart = startPos + offset;        int nBytes = width * bytesPerPixel;        int leftInsert = offset;        int leftExtract = 0;        byte current_byte;        for (i=actualStart; i < startPos + nBytes; i++)        {            leftBytes[leftInsert] =  pixels[i];            pixels[i] = (byte) ((pixels[i] - leftBytes[leftExtract]) % 256);            leftInsert = (leftInsert+1) % 0x0f;            leftExtract = (leftExtract + 1) % 0x0f;        }    }    /**     * Perform "up" filtering on the given row.     * Side effect: refills the prior row with current row     *     * @param pixels The array holding the scan lines being built     * @param startPos Starting position within pixels of bytes to be filtered.     * @param width Width of a scanline in pixels.     */    protected void filterUp( byte[] pixels, int startPos, int width )    {        int     i, nBytes;        byte    current_byte;        nBytes = width * bytesPerPixel;        for (i=0; i < nBytes; i++)        {            current_byte = pixels[startPos + i];            pixels[startPos + i] = (byte) ((pixels[startPos  + i] - priorRow[i]) % 256);            priorRow[i] = current_byte;        }    }    /**     * Write the image data into the pngBytes array.     * This will write one or more PNG "IDAT" chunks. In order     * to conserve memory, this method grabs as many rows as will     * fit into 32K bytes, or the whole image; whichever is less.     *     *     * @return true if no errors; false if error grabbing pixels     */    protected boolean writeImageData()    {        int rowsLeft = height;  // number of rows remaining to write        int startRow = 0;       // starting row to process this time through        int nRows;              // how many rows to grab at a time        byte[] scanLines;       // the scan lines to be compressed        int scanPos;            // where we are in the scan lines        int startPos;           // where this line's actual pixels start (used for filtering)        byte[] compressedLines; // the resultant compressed lines        int nCompressed;        // how big is the compressed area?        int depth;              // color depth ( handle only 8 or 32 )        PixelGrabber pg;        bytesPerPixel = (encodeAlpha) ? 4 : 3;        Deflater scrunch = new Deflater( compressionLevel );        ByteArrayOutputStream outBytes =             new ByteArrayOutputStream(1024);                    DeflaterOutputStream compBytes =            new DeflaterOutputStream( outBytes, scrunch );        try        {            while (rowsLeft > 0)            {                nRows = Math.min( 32767 / (width*(bytesPerPixel+1)), rowsLeft );                // nRows = rowsLeft;                int[] pixels = new int[width * nRows];                pg = new PixelGrabber(image, 0, startRow,                    width, nRows, pixels, 0, width);                try {                    pg.grabPixels();                }                catch (Exception e) {                    System.err.println("interrupted waiting for pixels!");                    return false;                }                if ((pg.getStatus() & ImageObserver.ABORT) != 0) {                    System.err.println("image fetch aborted or errored");                    return false;                }                /*                 * Create a data chunk. scanLines adds "nRows" for                 * the filter bytes.                  */                scanLines = new byte[width * nRows * bytesPerPixel +  nRows];                if (filter == FILTER_SUB)                {                    leftBytes = new byte[16];                }                if (filter == FILTER_UP)                {                    priorRow = new byte[width*bytesPerPixel];                }                scanPos = 0;                startPos = 1;                for (int i=0; i<width*nRows; i++)                {                    if (i % width == 0)                    {                        scanLines[scanPos++] = (byte) filter;                         startPos = scanPos;                    }                    scanLines[scanPos++] = (byte) ((pixels[i] >> 16) & 0xff);                    scanLines[scanPos++] = (byte) ((pixels[i] >>  8) & 0xff);                    scanLines[scanPos++] = (byte) ((pixels[i]      ) & 0xff);                    if (encodeAlpha)                    {                        scanLines[scanPos++] = (byte) ((pixels[i] >> 24) & 0xff );                    }                    if ((i % width == width-1) && (filter != FILTER_NONE))                    {                        if (filter == FILTER_SUB)                        {                            filterSub( scanLines, startPos, width );                        }                        if (filter == FILTER_UP)                        {                            filterUp( scanLines, startPos, width );                        }                    }                }                /*                 * Write these lines to the output area                 */                compBytes.write( scanLines, 0, scanPos );                startRow += nRows;                rowsLeft -= nRows;            }            compBytes.close();            /*             * Write the compressed bytes             */            compressedLines = outBytes.toByteArray();            nCompressed = compressedLines.length;            crc.reset();            bytePos = writeInt4( nCompressed, bytePos );            bytePos = writeString("IDAT", bytePos );            crc.update("IDAT".getBytes());            bytePos = writeBytes( compressedLines, nCompressed, bytePos );            crc.update( compressedLines, 0, nCompressed );            crcValue = crc.getValue();            bytePos = writeInt4( (int) crcValue, bytePos );            scrunch.finish();            return true;        }        catch (IOException e)        {            System.err.println( e.toString());            return false;        }    }    /**     * Write a PNG "IEND" chunk into the pngBytes array.     */    protected void writeEnd()    {        bytePos = writeInt4( 0, bytePos );        bytePos = writeString( "IEND", bytePos );        crc.reset();        crc.update("IEND".getBytes());        crcValue = crc.getValue();        bytePos = writeInt4( (int) crcValue, bytePos );    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区蜜桃| 亚洲国产岛国毛片在线| 蜜臀av在线播放一区二区三区| 欧美在线一区二区| 五月综合激情日本mⅴ| 欧美日本视频在线| 久久精品国产亚洲a| 欧美电影免费提供在线观看| 国产精品一区二区x88av| 国产亚洲精品精华液| caoporn国产一区二区| 亚洲色大成网站www久久九九| 欧美综合天天夜夜久久| 热久久一区二区| 久久一夜天堂av一区二区三区| 粉嫩高潮美女一区二区三区| 亚洲欧洲日韩女同| 宅男在线国产精品| 国产成人在线电影| 亚洲伦在线观看| 欧美一区永久视频免费观看| 国产一区二区三区精品视频| 中文字幕中文字幕在线一区| 精品国产欧美一区二区| 国产精品综合一区二区三区| 亚洲免费色视频| 欧美一区二区三区播放老司机| 国产成人a级片| 午夜久久久影院| 中文字幕av不卡| 欧美猛男gaygay网站| 国产成人免费高清| 午夜视频在线观看一区二区三区| 久久久青草青青国产亚洲免观| 一本一本久久a久久精品综合麻豆| 麻豆精品视频在线| 亚洲欧美日韩精品久久久久| 日韩精品在线网站| 色一情一乱一乱一91av| 国产精品资源在线观看| 亚洲风情在线资源站| 日本一区二区三区dvd视频在线| 欧美日韩中文国产| jiyouzz国产精品久久| 狠狠色狠狠色综合系列| 亚洲第一成年网| 亚洲免费看黄网站| 中文字幕精品综合| xfplay精品久久| 69av一区二区三区| 91黄视频在线观看| 99久久综合国产精品| 狠狠狠色丁香婷婷综合久久五月| 亚洲成国产人片在线观看| 国产精品激情偷乱一区二区∴| 日韩精品一区二区三区视频 | 国产精品免费观看视频| 3751色影院一区二区三区| 欧洲av在线精品| 91麻豆国产福利在线观看| 国产精品 日产精品 欧美精品| 亚洲第一福利一区| 亚洲高清免费视频| 亚洲一区二区在线视频| 国产精品大尺度| 中文字幕巨乱亚洲| 精品三级在线观看| 日韩三级中文字幕| 在线播放日韩导航| 欧美精品xxxxbbbb| 欧美情侣在线播放| 91精品免费在线| 日韩欧美国产精品一区| 91精品国产综合久久国产大片| 欧美三级欧美一级| 在线观看视频一区二区| 91久久奴性调教| 色94色欧美sute亚洲线路二 | 激情综合网天天干| 日本欧美在线观看| 青娱乐精品视频| 蜜桃久久久久久| 日韩电影免费在线看| 日本aⅴ精品一区二区三区| 日韩在线卡一卡二| 日本伊人午夜精品| 九色综合国产一区二区三区| 国产综合色视频| 国产福利视频一区二区三区| 岛国一区二区三区| 91色九色蝌蚪| 欧美日韩国产美| 欧美成人性战久久| 久久综合久久综合亚洲| 国产欧美精品区一区二区三区 | 欧美日韩免费一区二区三区视频| 欧美性一二三区| 日韩欧美久久久| 国产欧美一区二区三区沐欲| 国产欧美日韩不卡免费| 亚洲丝袜自拍清纯另类| 亚洲最快最全在线视频| 青青草国产精品97视觉盛宴 | 国产欧美日韩一区二区三区在线观看| 欧美激情资源网| 一区二区三区久久久| 日韩av中文字幕一区二区三区| 国产中文字幕精品| 色妹子一区二区| 欧美va亚洲va在线观看蝴蝶网| 日韩av高清在线观看| 国产精品一区二区你懂的| 99r精品视频| 欧美丰满嫩嫩电影| 久久久国产午夜精品| 亚洲综合丁香婷婷六月香| 久久黄色级2电影| 91在线云播放| 日韩精品一区在线观看| 亚洲精品一二三| 国产一区二区精品在线观看| 91成人免费网站| 国产亚洲精品超碰| 视频一区在线播放| www.欧美亚洲| 欧美videos中文字幕| 一区二区高清在线| 国产91清纯白嫩初高中在线观看| 欧美日韩国产综合视频在线观看 | 91麻豆精品国产综合久久久久久| 久久精品欧美一区二区三区麻豆| 亚洲最快最全在线视频| 国产成人亚洲精品青草天美| 欧美巨大另类极品videosbest | 国产另类ts人妖一区二区| 在线中文字幕一区| 国产女人18毛片水真多成人如厕| 图片区小说区国产精品视频| jiyouzz国产精品久久| 精品电影一区二区| 日韩va欧美va亚洲va久久| 欧美在线免费播放| 中文字幕字幕中文在线中不卡视频| 久久99久久久欧美国产| 制服.丝袜.亚洲.另类.中文| 亚洲一区二区视频| 91在线精品一区二区| 国产精品视频观看| 韩国精品一区二区| 欧美大片在线观看| 蜜臀国产一区二区三区在线播放 | 中文字幕一区二区三区在线播放 | 国产二区国产一区在线观看| 日韩欧美123| 日本成人在线视频网站| 欧美三级电影网| 亚洲精品免费在线播放| 97久久超碰精品国产| 欧美日韩精品免费观看视频 | 色噜噜狠狠一区二区三区果冻| 精品国产一区二区三区av性色| 午夜精品视频一区| 在线精品国精品国产尤物884a| 亚洲资源中文字幕| 国产精品羞羞答答xxdd| 久久嫩草精品久久久久| 国产老肥熟一区二区三区| 久久精品一区二区| 国产成人免费在线观看不卡| 国产亚洲精品福利| 丁香婷婷综合激情五月色| 中文字幕乱码一区二区免费| 成人免费高清视频| 中文字幕日韩精品一区 | 色婷婷激情一区二区三区| 亚洲欧洲www| 在线观看精品一区| 午夜久久久影院| 欧美一区二区三级| 国产一区二区三区在线观看免费 | 91麻豆精品国产91| 美女www一区二区| 久久精品在线免费观看| 波多野结衣在线一区| 亚洲伦在线观看| 欧美电影在哪看比较好| 精品一区二区三区在线视频| 久久久www免费人成精品| 成人激情小说乱人伦| 亚洲精品国产精华液| 欧美一区二区三区播放老司机| 国产麻豆精品视频| 成人欧美一区二区三区在线播放| 91成人看片片| 另类小说欧美激情| 中文字幕一区二区三区不卡 | 欧美日韩一区二区三区高清| 日韩精品高清不卡| 国产目拍亚洲精品99久久精品| 色婷婷精品大在线视频|