# dxppng.h

説明を見る。

    00001 /*
    00002 png decoder for dx library portable.
    00003 written by yreeen
    00004 ver1.0.3
    00005 last update 2009/10/27
    00006
    00007 change log
    00008 1.0.0 release
    00009 1.0.1 bug fix
    00010 1.0.2 bug fix
    00011 1.0.3 support alpha info exist check
    00012
    00013 require::zlib
    00014
    00015 PNG Specification, Version 1.2
    00016
    00017 mode:DXPPNG_MODE_GPU
    00018 sizeLimit:  512x512
    00019             2_nSize
    00020             16bitPitchAlignment
    00021
    00022 clut1,2,4 -> T4
    00023 clut8 -> T8
    00024 gray1,2,4 -> T4
    00025 gray8,16 -> T8
    00026 grayalpha8,16 -> 8888
    00027 rgb8,16 -> 8888
    00028 rgba8,16 -> 8888
    00029
    00030 mode:DXPPNG_MODE_RAW
    00031 sizeLimit:  depend for memory capacity
    00032 allFormat -> 8888
    00033 */
    00034
    00035
    00036 /*
    00037 sample code
    00038
    00039 #include <stdio.h>
    00040 #include "dxppng.h"
    00041 int main()
    00042 {
    00043     DXPPNG png;
    00044     DXPPNG_PARAMS param;
    00045     FILE *fp;
    00046
    00047     fp = fopen("image.png","rb");
    00048     params.srcLength = fseek(fp,0,SEEK_END);
    00049     fseek(fp,0,SEEK_SET);
    00050     params.src = malloc(params.srcLength);
    00051     fread(params.src,1,params.srcLength,fp);
    00052     fclose(fp);
    00053
    00054     params.mode = DXPPNG_MODE_RAW;
    00055     params.funcs.pfree = 0;//use default malloc/free
    00056     dxppng_decode(&params,&png);
    00057
    00058     return 0;
    00059 }
    00060 */
    00061 #ifndef DXPPNG_H__
    00062 #define DXPPNG_H__
    00063 #ifdef __cplusplus
    00064 extern "C" {
    00065 #endif
    00066
    00067 #define PSM_8888    (3)
    00068 #define PSM_T4      (4)
    00069 #define PSM_T8      (5)
    00070
    00071 #define DXPPNG_MODE_GPU 1   /*Minimam psm,Pitch,Alignment,Size limit,etc... optimized for psp's gpu*/
    00072 #define DXPPNG_MODE_RAW 0   /*for programmer's immidiate access.*/
    00073
    00074 typedef struct DXPPNG_
    00075 {
    00076     unsigned int width,height;
    00077     unsigned int widthN2,heightN2;
    00078     unsigned int pitch;
    00079     unsigned int psm;
    00080     unsigned int *clut;
    00081     unsigned int clutnum;
    00082     unsigned int alpha;
    00083     void *raw;
    00084 }DXPPNG;
    00085
    00086 typedef struct DXPPNG_FUNCS_
    00087 {
    00088     void*(*pmalloc)(unsigned int);
    00089     void*(*pmemalign)(unsigned int,unsigned int);
    00090     void (*pfree)(void*);
    00091 }DXPPNG_FUNCS;
    00092
    00093 typedef struct DXPPNG_PARAMS_
    00094 {
    00095     void *src;
    00096     unsigned int srcLength;
    00097     unsigned int mode;
    00098     DXPPNG_FUNCS funcs;
    00099 }DXPPNG_PARAMS;
    00100
    00101
    00102 int dxppng_decode(DXPPNG_PARAMS *params,DXPPNG *png);
    00103
    00104 #ifdef __cplusplus
    00105 };
    00106 #endif
    00107
    00108 #endif
    00109