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

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

?? readbmp.c

?? miniucgui1.30版本的源碼
?? C
字號:
/*** $Id: readbmp.c,v 1.24 2003/09/04 06:02:53 weiym Exp $**** Top-level bitmap file read/save function.**** Copyright (C) 2003 Feynman Software** Copyright (C) 2000 ~ 2002 Wei Yongming.**** Current maintainer: Wei Yongming.**** Create date: 2000/08/26, derived from original bitmap.c*//*** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//* * Modify records: * *  Who             When        Where       For What                Status *----------------------------------------------------------------------------- * * TODO: */#include <stdio.h>#include <stdlib.h>#include <string.h>#include "common.h"#include "minigui.h"#include "gdi.h"#include "window.h"#include "cliprect.h"#include "gal.h"#include "internals.h"#include "ctrlclass.h"#include "dc.h"#include "readbmp.h"/* Init a bitmap as a normal bitmap  */BOOL GUIAPI InitBitmap (HDC hdc, Uint32 w, Uint32 h, Uint32 pitch, BYTE* bits, PBITMAP bmp){    PDC pdc;    pdc = dc_HDC2PDC (hdc);    if (w == 0 || h == 0)        return FALSE;    if (bits && pitch) {        if (pdc->surface->format->BytesPerPixel * w > pitch)            return FALSE;        bmp->bmBits = bits;        bmp->bmPitch = pitch;    }    else if (!bits) {        size_t size = GAL_GetBoxSize (pdc->surface, w, h, &bmp->bmPitch);        if (!(bmp->bmBits = malloc (size)))            return FALSE;    }    else /* bits is not zero, but pitch is zero */        return FALSE;    bmp->bmType = BMP_TYPE_NORMAL;    bmp->bmAlpha = 0;    bmp->bmColorKey = 0;    bmp->bmWidth = w;    bmp->bmHeight = h;    bmp->bmBitsPerPixel = pdc->surface->format->BitsPerPixel;    bmp->bmBytesPerPixel = pdc->surface->format->BytesPerPixel;    bmp->bmAlphaPixelFormat = NULL;    return TRUE;}/* Init a standard pixel format with alpha of a bitmap */BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp){    PDC pdc;    Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0;    pdc = dc_HDC2PDC (hdc);    bmp->bmBitsPerPixel = pdc->surface->format->BitsPerPixel;    bmp->bmBytesPerPixel = pdc->surface->format->BytesPerPixel;    if (bmp->bmType & BMP_TYPE_ALPHA) {        if (pdc->surface->format->Amask || bmp->bmBitsPerPixel <= 8) {            bmp->bmAlphaPixelFormat = pdc->surface->format;            return TRUE;        }        switch (bmp->bmBitsPerPixel) {            case 16:                Rmask = 0x0000F000;                Gmask = 0x00000F00;                Bmask = 0x000000F0;                Amask = 0x0000000F;                break;            case 24:                Rmask = 0x00FC0000;                Gmask = 0x0003F000;                Bmask = 0x00000FC0;                Amask = 0x0000003F;                break;            case 32:                Rmask = 0xFF000000;                Gmask = 0x00FF0000;                Bmask = 0x0000FF00;                Amask = 0x000000FF;                break;            default:                return FALSE;        }        bmp->bmAlphaPixelFormat = GAL_AllocFormat (bmp->bmBitsPerPixel,                    Rmask, Gmask, Bmask, Amask);        if (!bmp->bmAlphaPixelFormat)            return FALSE;        bmp->bmType |= BMP_TYPE_PRIV_PIXEL;    }    else        bmp->bmAlphaPixelFormat = NULL;    return TRUE;}/* Function: int ExpandMyBitmap (HDC hdc, PBITMAP bmp, const MYBITMAP* my_bmp, int frame); *      This function expand a mybitmap to compiled bitmap. */int GUIAPI ExpandMyBitmap (HDC hdc, PBITMAP bmp, const MYBITMAP* my_bmp, const RGB* pal, int frame){    PDC pdc;    Uint8* bits;    pdc = dc_HDC2PDC (hdc);    bmp->bmBitsPerPixel = pdc->surface->format->BitsPerPixel;    bmp->bmBytesPerPixel = pdc->surface->format->BytesPerPixel;    bmp->bmAlphaPixelFormat = NULL;    if (!(bmp->bmBits = malloc (GAL_GetBoxSize (pdc->surface,             my_bmp->w, my_bmp->h, &bmp->bmPitch)))) {        return ERR_BMP_MEM;    }    bmp->bmWidth = my_bmp->w;    bmp->bmHeight = my_bmp->h;    bmp->bmType = BMP_TYPE_NORMAL;    if (my_bmp->flags & MYBMP_TRANSPARENT) {        bmp->bmType |= BMP_TYPE_COLORKEY;        if (pal && my_bmp->depth <= 8)            bmp->bmColorKey = GAL_MapRGB (pdc->surface->format,                 pal [my_bmp->transparent].r,                pal [my_bmp->transparent].g,                pal [my_bmp->transparent].b);        else {            Uint8 r, g, b;#if 1            r = GetRValue (my_bmp->transparent);            g = GetGValue (my_bmp->transparent);            b = GetBValue (my_bmp->transparent);#else            Uint8* src = (Uint8*) (&my_bmp->transparent);            if ((my_bmp->flags & MYBMP_TYPE_MASK) == MYBMP_TYPE_BGR) {                b = *src++; g = *src++; r = *src++;            }            else {                r = *src++; g = *src++; b = *src++;            }#endif            bmp->bmColorKey = GAL_MapRGB (pdc->surface->format, r, g, b);        }    }    else        bmp->bmColorKey = 0;    if (my_bmp->flags & MYBMP_ALPHACHANNEL) {        bmp->bmType |= BMP_TYPE_ALPHACHANNEL;        bmp->bmAlpha = my_bmp->alpha;    }    else        bmp->bmAlpha = 0;    if (my_bmp->flags & MYBMP_ALPHA && my_bmp->depth == 32) {        Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0;        switch (bmp->bmBitsPerPixel) {                case 16:                    Rmask = 0x0000F000;                    Gmask = 0x00000F00;                    Bmask = 0x000000F0;                    Amask = 0x0000000F;                    break;                case 24:                    Rmask = 0x00FC0000;                    Gmask = 0x0003F000;                    Bmask = 0x00000FC0;                    Amask = 0x0000003F;                    break;                case 32:                    Rmask = 0xFF000000;                    Gmask = 0x00FF0000;                    Bmask = 0x0000FF00;                    Amask = 0x000000FF;                    break;        }        if (bmp->bmBitsPerPixel > 8) {            bmp->bmAlphaPixelFormat                         = GAL_AllocFormat (my_bmp->depth, Rmask, Gmask, Bmask, Amask);            if (!bmp->bmAlphaPixelFormat)                return ERR_BMP_MEM;            bmp->bmType |= BMP_TYPE_ALPHA;            bmp->bmType |= BMP_TYPE_PRIV_PIXEL;        }        else { /* for bpp <= 8, just strip alpha */            bmp->bmAlphaPixelFormat = pdc->surface->format;        }    }    else        bmp->bmAlphaPixelFormat = NULL;    if (frame <= 0 || frame >= my_bmp->frames)        bits = my_bmp->bits;    else        bits = my_bmp->bits + frame * my_bmp->size;    switch (my_bmp->depth) {    case 1:        ExpandMonoBitmap (hdc, bmp->bmBits, bmp->bmPitch, bits, my_bmp->pitch,                         my_bmp->w, my_bmp->h, my_bmp->flags,                         GAL_MapRGB (pdc->surface->format, pal[0].r, pal[0].g, pal[0].b),                        GAL_MapRGB (pdc->surface->format, pal[1].r, pal[1].g, pal[1].b));        break;    case 4:        Expand16CBitmap (hdc, bmp->bmBits, bmp->bmPitch, bits, my_bmp->pitch,                         my_bmp->w, my_bmp->h, my_bmp->flags, pal);        break;    case 8:        Expand256CBitmap (hdc, bmp->bmBits, bmp->bmPitch, bits, my_bmp->pitch,                         my_bmp->w, my_bmp->h, my_bmp->flags, pal);        break;    case 24:        CompileRGBABitmap (hdc, bmp->bmBits, bmp->bmPitch, bits, my_bmp->pitch,                         my_bmp->w, my_bmp->h, my_bmp->flags & ~MYBMP_RGBSIZE_4,                         bmp->bmAlphaPixelFormat);        break;    case 32:        CompileRGBABitmap (hdc, bmp->bmBits, bmp->bmPitch, bits, my_bmp->pitch,                         my_bmp->w, my_bmp->h, my_bmp->flags | MYBMP_RGBSIZE_4,                         bmp->bmAlphaPixelFormat);        break;    default:        return ERR_BMP_NOT_SUPPORTED;    }    return ERR_BMP_OK;}/* Function: int LoadBitmapEx (HDC hdc, PBITMAP bmp, MG_RWops* area, const char* ext) *      This function loads a bitmap from an image source and fills *      the specified BITMAP struct. */int GUIAPI LoadBitmapEx (HDC hdc, PBITMAP bmp, MG_RWops* area, const char* ext){    MYBITMAP myBitmap;    RGB pal [256];    int ret;    if ((ret = LoadMyBitmapEx (&myBitmap, pal, area, ext)) < 0)        return ret;    ret = ExpandMyBitmap (hdc, bmp, &myBitmap, pal, 0);    free (myBitmap.bits);    return ret;}int GUIAPI LoadBitmapFromFile (HDC hdc, PBITMAP bmp, const char* file_name){    MYBITMAP myBitmap;    RGB pal [256];    int ret;    if ((ret = LoadMyBitmapFromFile (&myBitmap, pal, file_name)) < 0)        return ret;    ret = ExpandMyBitmap (hdc, bmp, &myBitmap, pal, 0);    free (myBitmap.bits);    return ret;}int GUIAPI LoadBitmapFromMem (HDC hdc, PBITMAP bmp, const void* mem, int size, const char* ext){    MYBITMAP myBitmap;    RGB pal [256];    int ret;    if ((ret = LoadMyBitmapFromMem (&myBitmap, pal, mem, size, ext)) < 0)        return ret;    ret = ExpandMyBitmap (hdc, bmp, &myBitmap, pal, 0);    free (myBitmap.bits);    return ret;}/* this function delete the pixel format of a bitmap */void GUIAPI DeleteBitmapAlphaPixel (PBITMAP bmp){    if (bmp->bmType & BMP_TYPE_PRIV_PIXEL) {        GAL_FreeFormat (bmp->bmAlphaPixelFormat);        bmp->bmType &= ~BMP_TYPE_PRIV_PIXEL;        bmp->bmAlphaPixelFormat = NULL;    }}/* this function unloads bitmap */void GUIAPI UnloadBitmap (PBITMAP bmp){    DeleteBitmapAlphaPixel (bmp);    free (bmp->bmBits);    bmp->bmBits = NULL;}#ifdef _SAVE_BITMAPint GUIAPI SaveBitmapToFile (HDC hdc, PBITMAP bmp, const char* file_name){    PDC pdc;    MYBITMAP myBitmap;    int i;    RGB pal [256];    GAL_Palette* palette;    pdc = dc_HDC2PDC (hdc);    palette = pdc->surface->format->palette;    switch (GAL_BitsPerPixel (pdc->surface)) {    case 4:        for (i = 0; i < 16; i++) {            pal [i].r = palette->colors [i].r;            pal [i].g = palette->colors [i].g;            pal [i].b = palette->colors [i].b;        }        break;    case 8:        for (i = 0; i < 256; i++) {            pal [i].r = palette->colors [i].r;            pal [i].g = palette->colors [i].g;            pal [i].b = palette->colors [i].b;        }        break;    }    myBitmap.flags = MYBMP_TYPE_NORMAL;    myBitmap.frames = 1;    myBitmap.depth = GAL_BitsPerPixel (pdc->surface);    myBitmap.w = bmp->bmWidth;    myBitmap.h = bmp->bmHeight;    myBitmap.pitch = bmp->bmPitch;    myBitmap.size = myBitmap.h * bmp->bmPitch;    myBitmap.bits = bmp->bmBits;    return SaveMyBitmapToFile (&myBitmap, pal, file_name);}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美综合色| 精品一区二区免费看| 免费的成人av| 91蝌蚪porny九色| 欧美一卡2卡三卡4卡5免费| 中文字幕一区二区三区在线观看 | 色域天天综合网| 日韩一区二区麻豆国产| 亚洲视频在线一区| 国产裸体歌舞团一区二区| 欧美曰成人黄网| 国产精品成人在线观看 | 香蕉加勒比综合久久| 国产白丝网站精品污在线入口| 91麻豆精品国产91久久久久久久久 | 亚洲小少妇裸体bbw| 国产精品18久久久久| 91精品国产综合久久婷婷香蕉| 日韩美女视频19| 成人手机在线视频| 久久亚洲精品小早川怜子| 美女www一区二区| 91精品国产一区二区| 亚洲成人一区二区在线观看| 一本色道久久综合精品竹菊 | 亚洲精品一区二区三区在线观看| 亚洲无线码一区二区三区| 色综合天天综合网国产成人综合天 | 日韩精品1区2区3区| 欧洲一区二区av| 亚洲国产一区二区视频| 欧美亚洲愉拍一区二区| 一区二区三区在线播| 在线一区二区三区四区五区| 亚洲欧美色综合| 色噜噜狠狠色综合中国| 亚洲伦理在线精品| 欧洲一区在线电影| 亚洲午夜久久久久中文字幕久| 欧美天天综合网| 丝袜国产日韩另类美女| 777亚洲妇女| 国精产品一区一区三区mba桃花| 日韩欧美中文字幕制服| 国内精品免费**视频| 久久九九99视频| 99免费精品视频| 一区二区视频在线看| 欧美日韩综合在线免费观看| 日韩av不卡一区二区| 精品欧美乱码久久久久久| 国产一区在线视频| 亚洲视频综合在线| 欧美久久久久久蜜桃| 极品美女销魂一区二区三区| 国产校园另类小说区| 91同城在线观看| 偷窥少妇高潮呻吟av久久免费 | 欧美午夜不卡视频| 人人精品人人爱| 国产精品视频在线看| 欧美亚洲图片小说| 久久精品国产99国产| 中文字幕一区二区在线播放 | 亚洲国产精品成人综合色在线婷婷| 成人免费视频播放| 亚洲成a人片综合在线| 精品久久久久一区二区国产| 成人小视频免费观看| 亚洲成人你懂的| 一区二区三区在线观看欧美| 欧美猛男男办公室激情| 国产一区二区视频在线| 亚洲综合在线免费观看| 欧美va亚洲va香蕉在线| 色吧成人激情小说| 国产乱妇无码大片在线观看| 亚洲摸摸操操av| 久久久久九九视频| 欧美日韩国产bt| 97久久精品人人做人人爽| 日韩影院精彩在线| 亚洲日本韩国一区| 国产午夜精品久久久久久久| 欧美三级欧美一级| 国产精品18久久久久久久久久久久| 午夜一区二区三区视频| 国产精品免费aⅴ片在线观看| 777午夜精品免费视频| 色综合天天综合给合国产| 国产精品一区一区三区| 日韩av午夜在线观看| 亚洲午夜影视影院在线观看| 国产精品国产三级国产aⅴ入口| 欧美tickling网站挠脚心| 欧美日韩不卡在线| 色婷婷国产精品久久包臀| 国产成人av网站| 国产精品一区一区| 国产做a爰片久久毛片| 奇米影视在线99精品| 天天综合天天做天天综合| 亚洲婷婷国产精品电影人久久| 国产夜色精品一区二区av| 精品久久久久久久久久久久久久久 | 麻豆国产精品官网| 天堂一区二区在线| 午夜精品久久久| 亚洲国产精品嫩草影院| 夜夜嗨av一区二区三区中文字幕 | 国产精品自拍在线| 国产精品自拍三区| 国产激情一区二区三区桃花岛亚洲| 久久精品国产免费| 伦理电影国产精品| 蜜臀av一区二区| 久久97超碰国产精品超碰| 精品午夜久久福利影院| 久草在线在线精品观看| 经典三级一区二区| 国产一区二区女| 国产精品一二三| 成人精品视频网站| 97精品国产露脸对白| 91麻豆精品视频| 欧美久久久久久久久久| 欧美一区二区三区不卡| 日韩一级欧美一级| 精品理论电影在线| 国产女主播在线一区二区| 国产精品狼人久久影院观看方式| 国产精品成人免费| 一个色综合av| 男人的天堂亚洲一区| 国产曰批免费观看久久久| 懂色av噜噜一区二区三区av| 91免费国产在线| 3d动漫精品啪啪1区2区免费 | 不卡一区二区在线| 91国偷自产一区二区使用方法| 在线精品亚洲一区二区不卡| 91精品国产免费久久综合| 国产欧美一区二区三区在线老狼| 18成人在线观看| 青椒成人免费视频| www.久久久久久久久| 欧美日韩亚洲高清一区二区| 精品久久国产老人久久综合| 国产精品三级av| 亚洲高清一区二区三区| 国产精品资源在线观看| 欧美视频精品在线| 久久免费午夜影院| 亚洲综合在线第一页| 经典三级一区二区| 欧美在线短视频| 欧美国产国产综合| 天天综合天天做天天综合| 成人精品视频一区| 日韩午夜在线观看视频| 综合在线观看色| 免费av成人在线| 色综合久久九月婷婷色综合| 精品国精品自拍自在线| 一区二区三区日韩精品| 国产剧情一区二区| 欧美理论片在线| 1000部国产精品成人观看| 男男视频亚洲欧美| 91在线观看污| 国产视频一区二区三区在线观看| 丝袜亚洲另类欧美| 一本色道亚洲精品aⅴ| 国产欧美精品一区| 精品制服美女久久| 欧美三级乱人伦电影| 国产精品白丝在线| 国产精品888| 欧美精品一区二区三区在线播放| 亚洲不卡av一区二区三区| 91视频国产观看| 最新久久zyz资源站| 国产经典欧美精品| 亚洲精品一线二线三线无人区| 婷婷一区二区三区| 欧美日韩国产免费一区二区 | 91精品蜜臀在线一区尤物| 亚洲乱码国产乱码精品精98午夜| 国产.欧美.日韩| 国产婷婷一区二区| 国产福利电影一区二区三区| 日韩免费观看高清完整版| 奇米影视一区二区三区小说| 欧美精品第1页| 视频在线观看一区二区三区| 欧美日韩的一区二区| 日韩成人一级大片| 欧美一区二区大片| 九九视频精品免费| 久久久国产精品麻豆|