00001
00002
00003
00004
00005
00015
00016 #ifndef GX_IMAGE_INCL
00017 #define GX_IMAGE_INCL
00018
00019 #include "gxsd.h"
00020 #if defined(WIN32) && !defined(GX_DOTNET)
00021 #include <windows.h>
00022 #endif
00023 #include <assert.h>
00024 #include "gxerror.h"
00025 #include "gxvariant.h"
00026
00027 #ifdef __BORLANDC__
00028 #pragma warn -rch
00029 #endif
00030
00031 #ifdef GX_NAMESPACES
00032 namespace gx {
00033 #endif
00034
00035 #ifdef GX_DOTNET
00036 #pragma managed
00037 #endif
00038
00039 #ifndef GX_EXT_MODULE
00040
00042 GX_ENUM GX_PIXELFORMATS {
00043 GX_UNDEF = 0x0000,
00045 GX_GRAY = 0x0001,
00046 GX_RGB555 = 0x0002,
00047 GX_BGR555 = 0x0003,
00048 GX_RGB565 = 0x0004,
00049 GX_BGR565 = 0x0005,
00050 GX_RGB = 0x0006,
00051 GX_BGR = 0x0007,
00052 GX_RGBA = 0x0008,
00053 GX_BGRA = 0x0009,
00054 GX_YUV422 = 0x000A,
00055 GX_GRAY12 = 0x000B,
00056 GX_RGB12 = 0x000C,
00057 GX_BGR12 = 0x000D,
00058 GX_GBRG = 0x000E,
00059 GX_BGGR = 0x000F,
00060 GX_RGGB = 0x0010,
00061 GX_GRBG = 0x0011,
00063 GX_FORMAT_FIRST = GX_GRAY,
00064 GX_FORMAT_LAST = GX_GRBG
00065 };
00066
00068 GX_ENUM GX_IMGFILEFORMATS {
00069 GX_BMP = 1,
00070 GX_JPEG = 2,
00071 GX_JPEG2K_JPC = 3,
00072 GX_JPEG2K_JP2 = 4,
00073 GX_JPEG2K = GX_JPEG2K_JP2,
00074 GX_RAW = 5,
00075 GX_PNG = 6,
00076 GX_WSQ = 7
00077 };
00078
00080 GX_ENUM GX_MIRRORFLAGS {
00081 GX_MIRROR_NOMIRROR = 0,
00082 GX_MIRROR_HORIZONTAL = 1,
00083 GX_MIRROR_VERTICAL = 2
00084 };
00085
00087 GX_ENUM GX_ZOOMMODES {
00088 GX_ZOOM_NEAREST = 0,
00089 GX_ZOOM_LINEAR = 1
00090 };
00091
00093 GX_ENUM GX_QUICKCONVERT {
00094 GX_CONVERT_NORMAL = 0,
00095 GX_CONVERT_QUICK = 1
00096 };
00097
00099 GX_ENUM GX_QUICKDISPLAY {
00100 GX_DISPLAY_NORMAL = 0,
00101 GX_DISPLAY_QUICK = 1
00102 };
00103
00105 GX_ENUM GX_IMAGECOMMENTS {
00106 GX_IMGCOMM_GENERAL = 0,
00107 GX_IMGCOMM_JPEG_APP0,
00108 GX_IMGCOMM_JPEG_APP1,
00109 GX_IMGCOMM_JPEG_APP2,
00110 GX_IMGCOMM_JPEG_APP3,
00111 GX_IMGCOMM_JPEG_APP4,
00112 GX_IMGCOMM_JPEG_APP5,
00113 GX_IMGCOMM_JPEG_APP6,
00114 GX_IMGCOMM_JPEG_APP7,
00115 GX_IMGCOMM_JPEG_APP8,
00116 GX_IMGCOMM_JPEG_APP9,
00117 GX_IMGCOMM_JPEG_APP10,
00118 GX_IMGCOMM_JPEG_APP11,
00119 GX_IMGCOMM_JPEG_APP12,
00120 GX_IMGCOMM_JPEG_APP13,
00121 GX_IMGCOMM_JPEG_APP14,
00122 GX_IMGCOMM_JPEG_APP15,
00123 GX_IMGCOMM_INVALIDFORMAT
00124 };
00125
00127 GX_ENUM GX_IMAGEPROPERTIES1 {
00128 GX_IMGPROP_BMP_FORCE24BPP = GX_CALL_GROUP_GX_BMP,
00135 GX_IMGPROP_BMP_ENABLERLE,
00142 GX_IMGPROP_JPEG_SCALE_NUM = GX_CALL_GROUP_GX_JPEG,
00143 GX_IMGPROP_JPEG_SCALE_DENOM,
00144 GX_IMGPROP_JPEG_DCT_METHOD,
00145 GX_IMGPROP_JPEG_DO_FANCY_UPSAMPLING,
00146 GX_IMGPROP_JPEG_DO_BLOCK_SMOOTHING,
00148 GX_IMGPROP_JPEG_QUALITY,
00149 GX_IMGPROP_JPEG_PROGRESSIVE,
00150 GX_IMGPROP_JPEG_OPTIMIZE_CODING,
00151 GX_IMGPROP_JPEG_RESTART_INTERVAL,
00152 GX_IMGPROP_JPEG_RESTART_IN_ROWS,
00153 GX_IMGPROP_JPEG_SMOOTHING_FACTOR,
00155 GX_IMGPROP_JPEG2K_IMGAREATLX = GX_CALL_GROUP_GX_JPEG2K,
00156 GX_IMGPROP_JPEG2K_IMGAREATLY,
00157 GX_IMGPROP_JPEG2K_TILEGRDTLX,
00158 GX_IMGPROP_JPEG2K_TILEGRDTLY,
00159 GX_IMGPROP_JPEG2K_TILEWIDTH,
00160 GX_IMGPROP_JPEG2K_TILEHEIGHT,
00161 GX_IMGPROP_JPEG2K_PRCWIDTH,
00162 GX_IMGPROP_JPEG2K_PRCHEIGHT,
00163 GX_IMGPROP_JPEG2K_CBLKWIDTH,
00164 GX_IMGPROP_JPEG2K_CBLKHEIGHT,
00165 GX_IMGPROP_JPEG2K_MODE,
00166 GX_IMGPROP_JPEG2K_RATE,
00167 GX_IMGPROP_JPEG2K_ILYRRATES,
00168 GX_IMGPROP_JPEG2K_PRG,
00169 GX_IMGPROP_JPEG2K_NOMCT,
00170 GX_IMGPROP_JPEG2K_NUMRLVLS,
00171 GX_IMGPROP_JPEG2K_SOP,
00172 GX_IMGPROP_JPEG2K_EPH,
00173 GX_IMGPROP_JPEG2K_LAZY,
00174 GX_IMGPROP_JPEG2K_TERMALL,
00175 GX_IMGPROP_JPEG2K_SEGSYM,
00176 GX_IMGPROP_JPEG2K_VCAUSAL,
00177 GX_IMGPROP_JPEG2K_PTERM,
00178 GX_IMGPROP_JPEG2K_RESETPROB,
00179 GX_IMGPROP_JPEG2K_NUMGBITS,
00181 GX_IMGPROP_WSQ_BITRATE = GX_CALL_GROUP_GX_WSQ
00182 };
00183
00184 #endif
00185
00186 #if defined(GX_DOTNET) && !defined(GX_MANUAL)
00187 #pragma unmanaged
00188 #define gxIMAGE _gxIMAGE
00189 #define HDC void*
00190 #endif
00191
00192 #if !defined(GX_SWIGIF) && !(defined(GX_MANUAL) && defined(GX_DOTNET))
00193
00194 struct gxIMAGE {
00195 gxi32 gxid;
00196 gxi32 ref;
00197 void* image;
00198 gxi32 simage;
00199 gxi32 format;
00200 gxi32 xsize;
00201 gxi32 ysize;
00202 gxi32 sline;
00216 gxi32 xres;
00229 gxi32 yres;
00230 };
00231
00232 #ifndef __cplusplus
00233 typedef struct gxIMAGE gxIMAGE;
00234 #endif
00235
00236 #endif
00237 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL)
00238
00239
00240 enum {
00241 GX_CALL_GETPIXELSIZE = GX_CALL_GROUP_GX_IMAGE,
00242 GX_CALL_CONVERTPIXELS,
00243 GX_CALL_FASTRECONVERT,
00244 GX_CALL_ZOOMPIXELS,
00245 GX_CALL_ROTATEPIXELS,
00246 GX_CALL_MIRRORPIXELS,
00247 GX_CALL_INITIMAGE,
00248 GX_CALL_ALLOCIMAGE,
00249 GX_CALL_FREEIMAGE,
00250 GX_CALL_REFIMAGE,
00251 GX_CALL_UNREFIMAGE,
00252 GX_CALL_CREATEIMAGE,
00253 GX_CALL_CONVERTIMAGE,
00254 GX_CALL_ZOOMIMAGE,
00255 GX_CALL_ROTATEIMAGE,
00256 GX_CALL_MIRRORIMAGE,
00257 GX_CALL_LOADIMAGE,
00258 GX_CALL_LOADIMAGEA,
00259 GX_CALL_SAVEIMAGE,
00260 GX_CALL_SAVEIMAGEA,
00261 GX_CALL_LOADFROMMEM,
00262 GX_CALL_SAVETOMEM,
00263 GX_CALL_ISVALIDIMAGE,
00264 GX_CALL_DISPLAYIMAGE,
00265 GX_CALL_GETPIXELPTR,
00266 GX_CALL_IMGTOCLIPBOARD,
00267 GX_CALL_PASTEIMAGE,
00269 GX_CALL_LOADIMAGEFROMFILE,
00270 GX_CALL_LOADIMAGEFROMFILEA,
00271 GX_CALL_LOADIMAGEFROMMEM,
00272 GX_CALL_SAVEIMAGETOFILE,
00273 GX_CALL_SAVEIMAGETOFILEA,
00274 GX_CALL_SAVEIMAGETOMEM,
00276 GX_CALL_COPYIMAGE,
00277 GX_CALL_IMAGETOVARIANT,
00278 GX_CALL_IMAGEFROMVARIANT,
00280 GX_CALL_TESTIMAGEFILEFORMAT,
00281 GX_CALL_TESTIMAGEFILEFORMATA,
00282 GX_CALL_TESTIMAGEFILEFORMATMEM,
00284 GX_CALL_GETIMAGEFILEFORMATINFO,
00285 GX_CALL_SAVEIMAGETOFILE2,
00286 GX_CALL_SAVEIMAGETOMEM2,
00288 GX_CALL_TESTIMAGEFILEFORMATID,
00289 GX_CALL_TESTIMAGEFILEFORMATIDMEM,
00290 };
00291
00292
00293 struct GX_PARM_GETPIXELSIZE {
00294 gxi32 format;
00295 gxi32 size;
00296 };
00297
00298
00299 struct GX_PARM_CONVERTPIXELS {
00300 void *target;
00301 gxi32 tformat;
00302 gxi32 tsline;
00303 const void *source;
00304 gxi32 sformat;
00305 gxi32 ssline;
00306 gxi32 xsize;
00307 gxi32 ysize;
00308 };
00309
00317 struct GX_PARM_FASTRECONVERT {
00318 void *pixels;
00319 gxi32 tformat;
00320 gxi32 sformat;
00321 gxi32 sline;
00322 gxi32 xsize;
00323 gxi32 ysize;
00324 };
00325
00327 struct GX_PARM_ZOOMPIXELS {
00328 void *target;
00329 gxi32 tsline;
00330 gxi32 txsize;
00331 gxi32 tysize;
00332 const void *source;
00333 gxi32 ssline;
00334 gxi32 sxsize;
00335 gxi32 sysize;
00336 gxi32 format;
00337 gxi32 sx1_8;
00338 gxi32 sy1_8;
00339 gxi32 sx2_8;
00340 gxi32 sy2_8;
00341 };
00342
00344 struct GX_PARM_ROTATEPIXELS {
00345 void *target;
00346 gxi32 tsline;
00347 gxi32 txsize;
00348 gxi32 tysize;
00349 const void *source;
00350 gxi32 ssline;
00351 gxi32 sxsize;
00352 gxi32 sysize;
00353 gxi32 format;
00354 gxi32 degree;
00355 };
00356
00358 struct GX_PARM_MIRRORPIXELS {
00359 void *target;
00360 gxi32 tsline;
00361 gxi32 txsize;
00362 gxi32 tysize;
00363 const void *source;
00364 gxi32 ssline;
00365 gxi32 sxsize;
00366 gxi32 sysize;
00367 gxi32 format;
00368 gxi32 flags;
00369 };
00370
00372 struct GX_PARM_CREATEIMAGE {
00373 gxIMAGE *pimage;
00374 gxi32 format;
00375 gxi32 xsize;
00376 gxi32 ysize;
00377 gxi32 sline;
00378 };
00379
00381 struct GX_PARM_CONVERTIMAGE {
00382 gxIMAGE *pdest;
00383 gxIMAGE *psrc;
00384 gxi32 format;
00385 gxi32 xsize;
00386 gxi32 ysize;
00387 gxi32 sline;
00388 };
00389
00391 struct GX_PARM_ZOOMIMAGE {
00392 gxIMAGE *pdest;
00393 gxi32 xsize;
00394 gxi32 ysize;
00395 gxi32 sline;
00396 gxIMAGE *psrc;
00397 gxi32 sx1_8;
00398 gxi32 sy1_8;
00399 gxi32 sx2_8;
00400 gxi32 sy2_8;
00401 };
00402
00404 struct GX_PARM_ROTATEIMAGE {
00405 gxIMAGE *pdest;
00406 gxIMAGE *psrc;
00407 gxi32 degree;
00408 };
00409
00411 struct GX_PARM_MIRRORIMAGE {
00412 gxIMAGE *pdest;
00413 gxIMAGE *psrc;
00414 gxi32 flags;
00415 };
00416
00418 struct GX_PARM_LOADIMAGE {
00419 gxIMAGE *pimage;
00420 const wchar_t *filename;
00421 gxi32 format;
00422 };
00423
00425 struct GX_PARM_LOADIMAGEA {
00426 gxIMAGE *pimage;
00427 const char *filename;
00428 gxi32 format;
00429 };
00430
00432 struct GX_PARM_SAVEIMAGE {
00433 gxIMAGE *pimage;
00434 const wchar_t *filename;
00435 gxi32 fileformat;
00436 };
00437
00439 struct GX_PARM_SAVEIMAGEA {
00440 gxIMAGE *pimage;
00441 const char *filename;
00442 gxi32 fileformat;
00443 };
00444
00446 struct GX_PARM_LOADFROMMEM {
00447 gxIMAGE *pimage;
00448 const void *buffer;
00449 gxi32 buflen;
00450 gxi32 format;
00451 };
00452
00454 struct GX_PARM_SAVETOMEM {
00455 gxIMAGE *pimage;
00456 void **buffer;
00457 gxi32 *buflen;
00458 gxi32 fileformat;
00459 };
00460
00461 #if defined(WIN32)
00462
00463 struct GX_PARM_DISPLAYIMAGE {
00464 HDC hdc;
00465 gxi32 x;
00466 gxi32 y;
00467 gxi32 xsize;
00468 gxi32 ysize;
00469 gxIMAGE *pimage;
00470 };
00471 #endif
00472
00474 struct GX_PARM_GETPIXELPTR {
00475 gxIMAGE *pimage;
00476 gxi32 x;
00477 gxi32 y;
00478 void *ptr;
00479 };
00480
00482 struct GX_PARM_LOADIMAGEFROMFILE {
00483 gxIMAGE *pimage;
00484 const wchar_t *filename;
00485 gxi32 format;
00486 gxVARIANT properties;
00487 gxVARIANT comments;
00488 };
00489
00491 struct GX_PARM_LOADIMAGEFROMFILEA {
00492 gxIMAGE *pimage;
00493 const char *filename;
00494 gxi32 format;
00495 gxVARIANT properties;
00496 gxVARIANT comments;
00497 };
00498
00500 struct GX_PARM_SAVEIMAGETOFILE {
00501 gxIMAGE *pimage;
00502 const wchar_t *filename;
00503 gxi32 fileformat;
00504 gxVARIANT properties;
00505 gxVARIANT comments;
00506 };
00507
00509 struct GX_PARM_SAVEIMAGETOFILEA {
00510 gxIMAGE *pimage;
00511 const char *filename;
00512 gxi32 fileformat;
00513 gxVARIANT properties;
00514 gxVARIANT comments;
00515 };
00516
00518 struct GX_PARM_SAVEIMAGETOFILE2 {
00519 gxIMAGE *pimage;
00520 const wchar_t *filename;
00521 const wchar_t *fileformat;
00522 gxVARIANT properties;
00523 gxVARIANT comments;
00524 };
00525
00527 struct GX_PARM_LOADIMAGEFROMMEM {
00528 gxIMAGE *pimage;
00529 const void *buffer;
00530 gxi32 buflen;
00531 gxi32 format;
00532 gxVARIANT properties;
00533 gxVARIANT comments;
00534 };
00535
00537 struct GX_PARM_SAVEIMAGETOMEM {
00538 gxIMAGE *pimage;
00539 void **buffer;
00540 gxi32 *buflen;
00541 gxi32 fileformat;
00542 gxVARIANT properties;
00543 gxVARIANT comments;
00544 };
00545
00547 struct GX_PARM_SAVEIMAGETOMEM2 {
00548 gxIMAGE *pimage;
00549 void **buffer;
00550 gxi32 *buflen;
00551 const wchar_t *fileformat;
00552 gxVARIANT properties;
00553 gxVARIANT comments;
00554 };
00555
00557 struct GX_PARM_COPYIMAGE {
00558 gxIMAGE *target;
00559 gxIMAGE *source;
00560 };
00561
00563 struct GX_PARM_IMAGETOVARIANT {
00564 gxIMAGE *pimage;
00565 int varid;
00566 gxVARIANT variant;
00567 };
00568
00570 struct GX_PARM_IMAGEFROMVARIANT {
00571 gxIMAGE *pimage;
00572 gxVARIANT variant;
00573 };
00574
00576 struct GX_PARM_TESTIMAGEFILEFORMAT {
00577 const wchar_t *filename;
00578 gxi32 fileformat;
00579 };
00580
00582 struct GX_PARM_TESTIMAGEFILEFORMATA {
00583 const char *filename;
00584 gxi32 fileformat;
00585 };
00586
00588 struct GX_PARM_TESTIMAGEFILEFORMATMEM {
00589 const void *buffer;
00590 gxi32 buflen;
00591 gxi32 fileformat;
00592 };
00593
00595 struct GX_PARM_TESTIMAGEFILEFORMATID {
00596 const wchar_t *filename;
00597 wchar_t* formatid;
00598 gxi32 slen;
00599 };
00600
00602 struct GX_PARM_TESTIMAGEFILEFORMATIDMEM {
00603 const void *buffer;
00604 gxi32 buflen;
00605 wchar_t* formatid;
00606 gxi32 slen;
00607 };
00608
00609 #endif
00610
00611
00612 #if !defined(NO_GX_FUNCTIONS) && !defined(GX_SWIGIF)
00613
00614
00615
00623 inline gxi32 gx_getpixelsize(gxHANDLE handle, gxi32 *size, gxi32 format) {
00624 struct GX_PARM_GETPIXELSIZE ps;
00625 gxi32 ret;
00626 assert(size);
00627 ps.format = format;
00628 ret = gx_call(handle, GX_CALL_GETPIXELSIZE, &ps);
00629 if(ret) *size = ps.size;
00630 return ret;
00631 }
00632
00633
00647 inline gxi32 gx_convertpixels(gxHANDLE handle,
00648 void *target, gxi32 tformat, gxi32 tsline,
00649 const void *source, gxi32 sformat, gxi32 ssline,
00650 gxi32 xsize, gxi32 ysize) {
00651
00652 struct GX_PARM_CONVERTPIXELS cp;
00653 cp.target = target;
00654 cp.tformat = tformat;
00655 cp.tsline = tsline;
00656 cp.source = source;
00657 cp.sformat = sformat;
00658 cp.ssline = ssline;
00659 cp.xsize = xsize;
00660 cp.ysize = ysize;
00661 return gx_call(handle, GX_CALL_CONVERTPIXELS, &cp);
00662 }
00663
00664
00683 inline gxi32 gx_fastreconvert(gxHANDLE handle,
00684 void *pixels, gxi32 tformat, gxi32 sformat,
00685 gxi32 sline, gxi32 xsize, gxi32 ysize) {
00686
00687 struct GX_PARM_FASTRECONVERT fr;
00688 fr.pixels = pixels;
00689 fr.tformat = tformat;
00690 fr.sformat = sformat;
00691 fr.sline = sline;
00692 fr.xsize = xsize;
00693 fr.ysize = ysize;
00694 return gx_call(handle, GX_CALL_FASTRECONVERT, &fr);
00695 }
00696
00697
00716 inline gxi32 gx_zoompixels(gxHANDLE handle,
00717 void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
00718 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
00719 gxi32 format,
00720 gxi32 sx1_8 GX_DEFARG(0), gxi32 sy1_8 GX_DEFARG(0),
00721 gxi32 sx2_8 GX_DEFARG(0), gxi32 sy2_8 GX_DEFARG(0))
00722 {
00723
00724 struct GX_PARM_ZOOMPIXELS zp;
00725 assert(target);
00726 assert(source);
00727 zp.target = target;
00728 zp.tsline = tsline;
00729 zp.txsize = txsize;
00730 zp.tysize = tysize;
00731 zp.source = (void *)source;
00732 zp.ssline = ssline;
00733 zp.sxsize = sxsize;
00734 zp.sysize = sysize;
00735 zp.format = format;
00736 zp.sx1_8 = sx1_8;
00737 zp.sy1_8 = sy1_8;
00738 zp.sx2_8 = sx2_8;
00739 zp.sy2_8 = sy2_8;
00740 return gx_call(handle, GX_CALL_ZOOMPIXELS, &zp);
00741 }
00742
00743
00759 inline gxi32 gx_rotatepixels(gxHANDLE handle,
00760 void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
00761 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
00762 gxi32 format, gxi32 degree) {
00763
00764 struct GX_PARM_ROTATEPIXELS rp;
00765 assert(target);
00766 assert(source);
00767 rp.target = target;
00768 rp.tsline = tsline;
00769 rp.txsize = txsize;
00770 rp.tysize = tysize;
00771 rp.source = source;
00772 rp.ssline = ssline;
00773 rp.sxsize = sxsize;
00774 rp.sysize = sysize;
00775 rp.format = format;
00776 rp.degree = degree;
00777 return gx_call(handle, GX_CALL_ROTATEPIXELS, &rp);
00778 }
00779
00780
00797 inline gxi32 gx_mirrorpixels(gxHANDLE handle,
00798 void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
00799 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
00800 gxi32 format, gxi32 flags) {
00801
00802 struct GX_PARM_MIRRORPIXELS mp;
00803 assert(target);
00804 assert(source);
00805 mp.target = target;
00806 mp.tsline = tsline;
00807 mp.txsize = txsize;
00808 mp.tysize = tysize;
00809 mp.source = source;
00810 mp.ssline = ssline;
00811 mp.sxsize = sxsize;
00812 mp.sysize = sysize;
00813 mp.format = format;
00814 mp.flags = flags;
00815 return gx_call(handle, GX_CALL_MIRRORPIXELS, &mp);
00816 }
00817
00818 #ifdef __cplusplus
00819
00831 inline gxi32 gx_mirrorpixels(gxHANDLE handle,
00832 void *pixels, gxi32 sline, gxi32 xsize, gxi32 ysize,
00833 gxi32 format, gxi32 flags) {
00834 return gx_mirrorpixels(handle, pixels, sline, xsize, ysize,
00835 pixels, sline, xsize, ysize,
00836 format, flags);
00837 }
00838 #endif
00839
00840
00844
00845
00846
00856 inline gxi32 gx_initimage(gxHANDLE handle, gxIMAGE *pimage) {
00857 assert(pimage);
00858 return gx_call(handle, GX_CALL_INITIMAGE, (void *)pimage);
00859 }
00860
00861
00871 inline gxi32 gx_allocimage(gxHANDLE handle, gxIMAGE **pimage) {
00872 assert(pimage);
00873 return gx_call(handle, GX_CALL_ALLOCIMAGE, (void *)pimage);
00874 }
00875
00876
00886 inline gxi32 gx_freeimage(gxHANDLE handle, gxIMAGE *pimage) {
00887 assert(pimage);
00888 return gx_call(handle, GX_CALL_FREEIMAGE, (void *)pimage);
00889 }
00890
00891
00893
00897
00898
00899
00909 inline gxi32 gx_refimage(gxHANDLE handle, gxIMAGE *pimage) {
00910 assert(pimage);
00911 return gx_call(handle, GX_CALL_REFIMAGE, (void *)pimage);
00912 }
00913
00914
00924 inline gxi32 gx_unrefimage(gxHANDLE handle, gxIMAGE *pimage) {
00925 assert(pimage);
00926 return gx_call(handle, GX_CALL_UNREFIMAGE, (void *)pimage);
00927 }
00928
00929
00931
00935
00936
00937
00949 inline gxi32 gx_createimage(gxHANDLE handle, gxIMAGE* pimage, gxi32 format,
00950 gxi32 xsize, gxi32 ysize, gxi32 sline) {
00951 struct GX_PARM_CREATEIMAGE ci;
00952 assert(pimage);
00953 assert(xsize > 0);
00954 assert(ysize > 0);
00955 ci.pimage = pimage;
00956 ci.format = format;
00957 ci.xsize = xsize;
00958 ci.ysize = ysize;
00959 ci.sline = sline;
00960 return gx_call(handle, GX_CALL_CREATEIMAGE, (void *)&ci);
00961 }
00962
00963
00978 inline gxi32 gx_convertimage(gxHANDLE handle, gxIMAGE* pdest,
00979 gxIMAGE* psrc, gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline) {
00980
00981 struct GX_PARM_CONVERTIMAGE ci;
00982 assert(pdest);
00983 assert(psrc);
00984 assert(xsize > 0);
00985 assert(ysize > 0);
00986 ci.pdest = pdest;
00987 ci.psrc = psrc;
00988 ci.format = format;
00989 ci.xsize = xsize;
00990 ci.ysize = ysize;
00991 ci.sline = sline;
00992 return gx_call(handle, GX_CALL_CONVERTIMAGE, (void *)&ci);
00993 }
00994
00995
01010 inline gxi32 gx_zoomimage(gxHANDLE handle, gxIMAGE *pdest,
01011 gxi32 xsize, gxi32 ysize, gxi32 sline,
01012 gxIMAGE *psrc,
01013 gxi32 sx1_8 GX_DEFARG(0), gxi32 sy1_8 GX_DEFARG(0),
01014 gxi32 sx2_8 GX_DEFARG(0), gxi32 sy2_8 GX_DEFARG(0)) {
01015
01016 struct GX_PARM_ZOOMIMAGE zi;
01017 assert(pdest);
01018 assert(psrc);
01019 assert(xsize > 0);
01020 assert(ysize > 0);
01021 zi.pdest = pdest;
01022 zi.xsize = xsize;
01023 zi.ysize = ysize;
01024 zi.sline = sline;
01025 zi.psrc = psrc;
01026 zi.sx1_8 = sx1_8;
01027 zi.sy1_8 = sy1_8;
01028 zi.sx2_8 = sx2_8;
01029 zi.sy2_8 = sy2_8;
01030 return gx_call(handle, GX_CALL_ZOOMIMAGE, (void *)&zi);
01031 }
01032
01033
01042 inline gxi32 gx_rotateimage(gxHANDLE handle, gxIMAGE *pdest,
01043 gxIMAGE *psrc, gxi32 degree) {
01044
01045 struct GX_PARM_ROTATEIMAGE ri;
01046 assert(pdest);
01047 assert(psrc);
01048 ri.pdest = pdest;
01049 ri.psrc = psrc;
01050 ri.degree = degree;
01051 return gx_call(handle, GX_CALL_ROTATEIMAGE, &ri);
01052 }
01053
01054
01064 inline gxi32 gx_mirrorimage(gxHANDLE handle, gxIMAGE *pdest,
01065 gxIMAGE *psrc, gxi32 flags) {
01066
01067 struct GX_PARM_MIRRORIMAGE mi;
01068 assert(pdest);
01069 assert(psrc);
01070 mi.pdest = pdest;
01071 mi.psrc = psrc;
01072 mi.flags = flags;
01073 return gx_call(handle, GX_CALL_MIRRORIMAGE, &mi);
01074 }
01075
01076 #ifdef __cplusplus
01077
01085 inline gxi32 gx_mirrorimage(gxHANDLE handle, gxIMAGE *pimage, gxi32 flags) {
01086 return gx_mirrorimage(handle, pimage, pimage, flags);
01087 }
01088 #endif
01089
01090
01114 inline gxi32 gx_loadimage(gxHANDLE handle, gxIMAGE* pimage,
01115 const wchar_t* filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01116
01117 struct GX_PARM_LOADIMAGE li;
01118 assert(pimage);
01119 assert(filename);
01120 li.pimage = pimage;
01121 li.filename = filename;
01122 li.format = pixelformat;
01123 return gx_call(handle, GX_CALL_LOADIMAGE, (void *)&li);
01124 }
01125
01126
01150 inline gxi32 gx_loadimagea(gxHANDLE handle, gxIMAGE* pimage,
01151 const char* filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01152 struct GX_PARM_LOADIMAGEA li;
01153 assert(pimage);
01154 assert(filename);
01155 li.pimage = pimage;
01156 li.filename = filename;
01157 li.format = pixelformat;
01158 return gx_call(handle, GX_CALL_LOADIMAGEA, (void *)&li);
01159 }
01160
01161 #ifdef __cplusplus
01162
01186 inline gxi32 gx_loadimage(gxHANDLE handle, gxIMAGE* pimage,
01187 const char* filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01188
01189 return gx_loadimagea(handle, pimage, filename, pixelformat);
01190 }
01191 #endif
01192
01193
01202 inline gxi32 gx_saveimage(gxHANDLE handle, gxIMAGE* pimage,
01203 const wchar_t* filename, gxi32 fileformat) {
01204
01205 struct GX_PARM_SAVEIMAGE si;
01206 assert(pimage);
01207 assert(filename);
01208 si.pimage = pimage;
01209 si.filename = filename;
01210 si.fileformat = fileformat;
01211 return gx_call(handle, GX_CALL_SAVEIMAGE, (void *)&si);
01212 }
01213
01214
01223 inline gxi32 gx_saveimagea(gxHANDLE handle, gxIMAGE* pimage,
01224 const char* filename, gxi32 fileformat) {
01225
01226 struct GX_PARM_SAVEIMAGEA si;
01227 assert(pimage);
01228 assert(filename);
01229 si.pimage = pimage;
01230 si.filename = filename;
01231 si.fileformat = fileformat;
01232 return gx_call(handle, GX_CALL_SAVEIMAGEA, (void *)&si);
01233 }
01234
01235 #ifdef __cplusplus
01236
01245 inline gxi32 gx_saveimage(gxHANDLE handle, gxIMAGE *pimage,
01246 const char *filename, gxi32 fileformat) {
01247
01248 return gx_saveimagea(handle, pimage, filename, fileformat);
01249 }
01250 #endif
01251
01252
01268 inline gxi32 gx_loadfrommem(gxHANDLE handle, gxIMAGE* pimage,
01269 const void *buffer, gxi32 buflen, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01270 struct GX_PARM_LOADFROMMEM lm;
01271 assert(pimage);
01272 assert(buffer);
01273 assert(buflen > 0);
01274 lm.pimage = pimage;
01275 lm.buffer = buffer;
01276 lm.buflen = buflen;
01277 lm.format = pixelformat;
01278 return gx_call(handle, GX_CALL_LOADFROMMEM, (void *)&lm);
01279 }
01280
01281
01290 inline gxi32 gx_savetomem(gxHANDLE handle, gxIMAGE* pimage,
01291 void **buffer, gxi32 *buflen, gxi32 fileformat) {
01292 struct GX_PARM_SAVETOMEM sm;
01293 assert(pimage);
01294 assert(buffer);
01295 assert(buflen);
01296 assert(*buflen >= 0);
01297 sm.pimage = pimage;
01298 sm.buffer = buffer;
01299 sm.buflen = buflen;
01300 sm.fileformat = fileformat;
01301 return gx_call(handle, GX_CALL_SAVETOMEM, (void *)&sm);
01302 }
01303
01304
01309 inline gxi32 gx_isvalidimage(gxHANDLE handle, const gxIMAGE *pimage) {
01310 return gx_call(handle, GX_CALL_ISVALIDIMAGE, (void *)pimage);
01311 }
01312
01313
01314 #ifdef WIN32
01315
01325 inline gxi32 gx_displayimage(gxHANDLE handle, HDC hdc, gxi32 x, gxi32 y,
01326 gxi32 xsize, gxi32 ysize, gxIMAGE *pimage) {
01327
01328 struct GX_PARM_DISPLAYIMAGE di;
01329 assert(pimage);
01330 di.hdc = hdc;
01331 di.x = x;
01332 di.y = y;
01333 di.xsize = xsize;
01334 di.ysize = ysize;
01335 di.pimage = pimage;
01336 return gx_call(handle, GX_CALL_DISPLAYIMAGE, (void *)&di);
01337 }
01338
01339
01345 inline gxi32 gx_imgtoclipboard(gxHANDLE handle, gxIMAGE *pimage) {
01346 assert(pimage);
01347 return gx_call(handle, GX_CALL_IMGTOCLIPBOARD, (void *)pimage);
01348 }
01349
01350
01356 inline gxi32 gx_pasteimage(gxHANDLE handle, gxIMAGE *pimage) {
01357 assert(pimage);
01358 return gx_call(handle, GX_CALL_PASTEIMAGE, (void *)pimage);
01359 }
01360 #endif
01361
01362
01364
01368
01369
01370
01377 inline gxi32 gx_copyimage(gxHANDLE handle, gxIMAGE *target, gxIMAGE *source) {
01378 struct GX_PARM_COPYIMAGE cp;
01379 assert(target);
01380 assert(source);
01381 cp.target = target;
01382 cp.source = source;
01383 return gx_call(handle, GX_CALL_COPYIMAGE, (void *)&cp);
01384 }
01385
01386
01394 inline gxi32 gx_testimagefileformat(gxHANDLE handle, const wchar_t *filename,
01395 gxi32 *fileformat) {
01396
01397 struct GX_PARM_TESTIMAGEFILEFORMAT ti;
01398 assert(fileformat);
01399 ti.filename = filename;
01400 if(!gx_call(handle, GX_CALL_TESTIMAGEFILEFORMAT, (void *)&ti)) return false;
01401 *fileformat = ti.fileformat;
01402 return true;
01403 }
01404
01405
01413 inline gxi32 gx_testimagefileformata(gxHANDLE handle, const char *filename,
01414 gxi32 *fileformat) {
01415
01416 struct GX_PARM_TESTIMAGEFILEFORMATA ti;
01417 assert(fileformat);
01418 ti.filename = filename;
01419 if(!gx_call(handle, GX_CALL_TESTIMAGEFILEFORMATA, (void *)&ti)) return false;
01420 *fileformat = ti.fileformat;
01421 return true;
01422 }
01423
01424 #ifdef __cplusplus
01425
01433 inline gxi32 gx_testimagefileformat(gxHANDLE handle, const char *filename,
01434 gxi32 *fileformat) {
01435 return gx_testimagefileformata(handle, filename, fileformat);
01436 }
01437 #endif
01438
01439
01448 inline gxi32 gx_testimagefileformatmem(gxHANDLE handle, const void *buffer, gxi32 buflen,
01449 gxi32 *fileformat) {
01450
01451 struct GX_PARM_TESTIMAGEFILEFORMATMEM ti;
01452 assert(fileformat);
01453 ti.buffer = buffer;
01454 ti.buflen = buflen;
01455 if(!gx_call(handle, GX_CALL_TESTIMAGEFILEFORMATMEM, (void *)&ti)) return false;
01456 *fileformat = ti.fileformat;
01457 return true;
01458 }
01459
01460
01469 inline gxi32 gx_testimagefileformatid(gxHANDLE handle, const wchar_t *filename,
01470 wchar_t *formatid, gxi32 slen) {
01471
01472 struct GX_PARM_TESTIMAGEFILEFORMATID ti;
01473 assert(formatid);
01474 ti.filename = filename;
01475 ti.formatid = formatid;
01476 ti.slen = slen;
01477 if(!gx_call(handle, GX_CALL_TESTIMAGEFILEFORMATID, (void *)&ti)) return false;
01478 return true;
01479 }
01480
01481
01491 inline gxi32 gx_testimagefileformatidmem(gxHANDLE handle, const void *buffer, gxi32 buflen,
01492 wchar_t *formatid, gxi32 slen) {
01493
01494 struct GX_PARM_TESTIMAGEFILEFORMATIDMEM ti;
01495 assert(formatid);
01496 ti.buffer = buffer;
01497 ti.buflen = buflen;
01498 ti.formatid = formatid;
01499 ti.slen = slen;
01500 if(!gx_call(handle, GX_CALL_TESTIMAGEFILEFORMATIDMEM, (void *)&ti)) return false;
01501 return true;
01502 }
01503
01504 #ifdef __cplusplus
01505
01514 inline gxi32 gx_testimagefileformat(gxHANDLE handle, const void *buffer, gxi32 buflen,
01515 gxi32 *fileformat) {
01516 return gx_testimagefileformatmem(handle, buffer, buflen, fileformat);
01517 }
01518 #endif
01519
01520
01522
01526
01527
01528
01536 inline gxi32 gx_imagetovariant(gxHANDLE handle, gxIMAGE *source, gxi32 varid, gxVARIANT *target) {
01537 struct GX_PARM_IMAGETOVARIANT itv;
01538 gxi32 ret;
01539 assert(target);
01540 assert(source);
01541 itv.pimage = source;
01542 itv.varid = varid;
01543 ret = gx_call(handle, GX_CALL_IMAGETOVARIANT, &itv);
01544 if(ret && target) *target = itv.variant;
01545 return ret;
01546 }
01547
01548
01555 inline gxi32 gx_imagefromvariant(gxHANDLE handle, gxIMAGE **target, gxVARIANT source) {
01556 struct GX_PARM_IMAGEFROMVARIANT ifv;
01557 gxi32 ret;
01558 assert(target);
01559 assert(source);
01560 ifv.variant = source;
01561 ret = gx_call(handle, GX_CALL_IMAGEFROMVARIANT, &ifv);
01562 if(ret && target) *target = ifv.pimage;
01563 return ret;
01564 }
01565
01566
01568
01569
01570
01578 inline void *gx_getpixelptr(gxHANDLE handle, gxIMAGE *pimage, gxi32 x, gxi32 y) {
01579 struct GX_PARM_GETPIXELPTR gp;
01580 assert(pimage);
01581 gp.pimage = pimage;
01582 gp.x = x;
01583 gp.y = y;
01584 if(!gx_call(handle, GX_CALL_GETPIXELPTR, (void *)&gp)) return (void *)0;
01585 return gp.ptr;
01586 }
01587
01588
01589 #ifdef __cplusplus
01590
01596 inline gxi32 gx_getpixelsize(gxi32 *size, gxi32 format) {
01597 return gx_getpixelsize(gx_direct(GX_CALL_GROUP_GX_IMAGE), size, format);
01598 }
01599
01600
01612 inline gxi32 gx_convertpixels(void *target, gxi32 tformat, gxi32 tsline,
01613 const void *source, gxi32 sformat, gxi32 ssline,
01614 gxi32 xsize, gxi32 ysize) {
01615
01616 return gx_convertpixels(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01617 target, tformat, tsline,
01618 source, sformat, ssline, xsize, ysize);
01619 }
01620
01621
01639 inline gxi32 gx_fastreconvert(void *pixels, gxi32 tformat, gxi32 sformat,
01640 gxi32 sline, gxi32 xsize, gxi32 ysize) {
01641
01642 return gx_fastreconvert(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01643 pixels, tformat, sformat,
01644 sline, xsize, ysize);
01645 }
01646
01647
01665 inline gxi32 gx_zoompixels(void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
01666 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
01667 gxi32 format,
01668 gxi32 sx1_8 = 0, gxi32 sy1_8 = 0,
01669 gxi32 sx2_8 = 0, gxi32 sy2_8 = 0) {
01670
01671 return gx_zoompixels(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01672 target, tsline, txsize, tysize,
01673 source, ssline, sxsize, sysize, format,
01674 sx1_8, sy1_8, sx2_8, sy2_8);
01675 }
01676
01677
01692 inline gxi32 gx_rotatepixels(void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
01693 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
01694 gxi32 format, gxi32 degree) {
01695
01696 return gx_rotatepixels(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01697 target, tsline, txsize, tysize,
01698 source, ssline, sxsize, sysize,
01699 format, degree);
01700 }
01701
01702
01718 inline gxi32 gx_mirrorpixels(void *target, gxi32 tsline, gxi32 txsize, gxi32 tysize,
01719 const void *source, gxi32 ssline, gxi32 sxsize, gxi32 sysize,
01720 gxi32 format, gxi32 flags) {
01721
01722 return gx_mirrorpixels(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01723 target, tsline, txsize, tysize,
01724 source, ssline, sxsize, sysize,
01725 format, flags);
01726 }
01727
01728
01739 inline gxi32 gx_mirrorpixels(void *pixels, gxi32 sline, gxi32 xsize, gxi32 ysize,
01740 gxi32 format, gxi32 flags) {
01741
01742 return gx_mirrorpixels(pixels, sline, xsize, ysize,
01743 pixels, sline, xsize, ysize,
01744 format, flags);
01745 }
01746
01747
01751
01752
01753
01762 inline gxi32 gx_initimage(gxIMAGE *pimage) {
01763 return gx_initimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
01764 }
01765
01766
01775 inline gxi32 gx_allocimage(gxIMAGE **pimage) {
01776 return gx_allocimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
01777 }
01778
01779
01788 inline gxi32 gx_freeimage(gxIMAGE *pimage) {
01789 return gx_freeimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
01790 }
01791
01792
01794
01798
01799
01800
01809 inline gxi32 gx_refimage(gxIMAGE *pimage) {
01810 return gx_refimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
01811 }
01812
01813
01822 inline gxi32 gx_unrefimage(gxIMAGE *pimage) {
01823 return gx_unrefimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
01824 }
01825
01826
01828
01832
01833
01834
01845 inline gxi32 gx_createimage(gxIMAGE* pimage, gxi32 format,
01846 gxi32 xsize, gxi32 ysize, gxi32 sline) {
01847 return gx_createimage(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01848 pimage, format, xsize, ysize, sline);
01849 }
01850
01851
01864 inline gxi32 gx_convertimage(gxIMAGE* pdest, gxIMAGE* psrc,
01865 gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline) {
01866
01867 return gx_convertimage(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01868 pdest, psrc, format, xsize, ysize, sline);
01869 }
01870
01871
01885 inline gxi32 gx_zoomimage(gxIMAGE *pdest,
01886 gxi32 xsize, gxi32 ysize, gxi32 sline,
01887 gxIMAGE *psrc,
01888 gxi32 sx1_8 = 0, gxi32 sy1_8 = 0,
01889 gxi32 sx2_8 = 0, gxi32 sy2_8 = 0) {
01890
01891 return gx_zoomimage(gx_direct(GX_CALL_GROUP_GX_IMAGE),
01892 pdest, xsize, ysize, sline,
01893 psrc, sx1_8, sy1_8, sx2_8, sy2_8);
01894 }
01895
01896
01904 inline gxi32 gx_rotateimage(gxIMAGE *pdest, gxIMAGE *psrc, gxi32 degree) {
01905 return gx_rotateimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pdest, psrc, degree);
01906 }
01907
01908
01917 inline gxi32 gx_mirrorimage(gxIMAGE *pdest, gxIMAGE *psrc, gxi32 flags) {
01918 return gx_mirrorimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pdest, psrc, flags);
01919 }
01920
01921
01928 inline gxi32 gx_mirrorimage(gxIMAGE *pimage, gxi32 flags) {
01929 return gx_mirrorimage(pimage, pimage, flags);
01930 }
01931
01932
01955 inline gxi32 gx_loadimage(gxIMAGE* pimage, const wchar_t* filename,
01956 gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01957
01958 return gx_loadimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage,
01959 filename, pixelformat);
01960 }
01961
01962
01985 inline gxi32 gx_loadimage(gxIMAGE* pimage, const char* filename,
01986 gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
01987
01988 return gx_loadimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage,
01989 filename, pixelformat);
01990 }
01991
01992
02000 inline gxi32 gx_saveimage(gxIMAGE* pimage,
02001 const wchar_t* filename, gxi32 fileformat) {
02002
02003 return gx_saveimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage, filename, fileformat);
02004 }
02005
02006
02014 inline gxi32 gx_saveimage(gxIMAGE* pimage,
02015 const char* filename, gxi32 fileformat) {
02016
02017 return gx_saveimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage, filename, fileformat);
02018 }
02019
02020
02034 inline gxi32 gx_loadfrommem(gxIMAGE* pimage,
02035 const void *buffer, gxi32 buflen, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) {
02036
02037 return gx_loadfrommem(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage, buffer,
02038 buflen, pixelformat);
02039 }
02040
02041
02049 inline gxi32 gx_savetomem(gxIMAGE* pimage,
02050 void **buffer, gxi32 *buflen, gxi32 fileformat) {
02051
02052 return gx_savetomem(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage, buffer, buflen, fileformat);
02053 }
02054
02055
02059 inline gxi32 gx_isvalidimage(const gxIMAGE *pimage) {
02060
02061 return gx_isvalidimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage);
02062 }
02063
02064
02065 #ifdef WIN32
02066
02075 inline gxi32 gx_displayimage(HDC hdc, gxi32 x, gxi32 y,
02076 gxi32 xsize, gxi32 ysize, gxIMAGE *pimage) {
02077
02078 return gx_displayimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), hdc, x, y, xsize, ysize, pimage);
02079 }
02080
02081
02086 inline gxi32 gx_imgtoclipboard(gxIMAGE *pimage) {
02087 assert(pimage);
02088 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_IMGTOCLIPBOARD, (void *)pimage);
02089 }
02090
02091
02096 inline gxi32 gx_pasteimage(gxIMAGE *pimage) {
02097 assert(pimage);
02098 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_PASTEIMAGE, (void *)pimage);
02099 }
02100 #endif
02101
02102
02108 inline gxi32 gx_copyimage(gxIMAGE *target, gxIMAGE *source) {
02109 return gx_copyimage(gx_direct(GX_CALL_GROUP_GX_IMAGE), target, source);
02110 }
02111
02112
02114
02118
02119
02120
02127 inline gxi32 gx_imagetovariant(gxIMAGE *source, gxi32 varid, gxVARIANT *target) {
02128 return gx_imagetovariant(gx_direct(GX_CALL_GROUP_GX_IMAGE), source, varid, target);
02129 }
02130
02131
02137 inline gxi32 gx_imagefromvariant(gxIMAGE **target, gxVARIANT source) {
02138 return gx_imagefromvariant(gx_direct(GX_CALL_GROUP_GX_IMAGE), target, source);
02139 }
02140
02141
02143
02147
02148
02149
02174 inline gxi32 gx_loadimagefromfile(gxIMAGE* pimage, const wchar_t* filename,
02175 gxi32 pixelformat GX_DEFARG(GX_UNDEF),
02176 gxVARIANT properties GX_DEFARG(0),
02177 gxVARIANT comments GX_DEFARG(0)) {
02178
02179 struct GX_PARM_LOADIMAGEFROMFILE li;
02180 assert(pimage);
02181 assert(filename);
02182 li.pimage = pimage;
02183 li.filename = filename;
02184 li.format = pixelformat;
02185 li.properties = properties;
02186 li.comments = comments;
02187 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_LOADIMAGEFROMFILE, (void *)&li);
02188 }
02189
02190
02215 inline gxi32 gx_loadimagefromfile(gxIMAGE* pimage, const char* filename,
02216 gxi32 pixelformat GX_DEFARG(GX_UNDEF),
02217 gxVARIANT properties GX_DEFARG(0),
02218 gxVARIANT comments GX_DEFARG(0)) {
02219
02220 struct GX_PARM_LOADIMAGEFROMFILEA li;
02221 assert(pimage);
02222 assert(filename);
02223 li.pimage = pimage;
02224 li.filename = filename;
02225 li.format = pixelformat;
02226 li.properties = properties;
02227 li.comments = comments;
02228 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_LOADIMAGEFROMFILEA, (void *)&li);
02229 }
02230
02231
02241 inline gxi32 gx_saveimagetofile(gxIMAGE* pimage,
02242 const wchar_t* filename, gxi32 fileformat,
02243 gxVARIANT properties GX_DEFARG(0),
02244 gxVARIANT comments GX_DEFARG(0)) {
02245
02246 struct GX_PARM_SAVEIMAGETOFILE si;
02247 assert(pimage);
02248 assert(filename);
02249 si.pimage = pimage;
02250 si.filename = filename;
02251 si.fileformat = fileformat;
02252 si.properties = properties;
02253 si.comments = comments;
02254 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_SAVEIMAGETOFILE, (void *)&si);
02255 }
02256
02257
02267 inline gxi32 gx_saveimagetofile(gxIMAGE* pimage,
02268 const char* filename, gxi32 fileformat,
02269 gxVARIANT properties GX_DEFARG(0),
02270 gxVARIANT comments GX_DEFARG(0)) {
02271
02272 struct GX_PARM_SAVEIMAGETOFILEA si;
02273 assert(pimage);
02274 assert(filename);
02275 si.pimage = pimage;
02276 si.filename = filename;
02277 si.fileformat = fileformat;
02278 si.properties = properties;
02279 si.comments = comments;
02280 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_SAVEIMAGETOFILEA, (void *)&si);
02281 }
02282
02283
02294 inline gxi32 gx_saveimagetofile2(gxHANDLE handle, gxIMAGE* pimage,
02295 const wchar_t* filename, const wchar_t* fileformat,
02296 gxVARIANT properties GX_DEFARG(0),
02297 gxVARIANT comments GX_DEFARG(0)) {
02298
02299 struct GX_PARM_SAVEIMAGETOFILE2 si;
02300 assert(pimage);
02301 assert(filename);
02302 si.pimage = pimage;
02303 si.filename = filename;
02304 si.fileformat = fileformat;
02305 si.properties = properties;
02306 si.comments = comments;
02307 return gx_call(handle, GX_CALL_SAVEIMAGETOFILE2, (void *)&si);
02308 }
02309
02310
02327 inline gxi32 gx_loadimagefrommem(gxIMAGE* pimage,
02328 const void *buffer, gxi32 buflen, gxi32 pixelformat GX_DEFARG(GX_UNDEF),
02329 gxVARIANT properties GX_DEFARG(0),
02330 gxVARIANT comments GX_DEFARG(0)) {
02331
02332 struct GX_PARM_LOADIMAGEFROMMEM li;
02333 assert(pimage);
02334 li.pimage = pimage;
02335 li.buffer = buffer;
02336 li.buflen = buflen;
02337 li.format = pixelformat;
02338 li.properties = properties;
02339 li.comments = comments;
02340 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_LOADIMAGEFROMMEM, (void *)&li);
02341 }
02342
02343
02354 inline gxi32 gx_saveimagetomem(gxIMAGE* pimage,
02355 void **buffer, gxi32 *buflen, gxi32 fileformat,
02356 gxVARIANT properties GX_DEFARG(0),
02357 gxVARIANT comments GX_DEFARG(0)) {
02358
02359 struct GX_PARM_SAVEIMAGETOMEM si;
02360 assert(pimage);
02361 si.pimage = pimage;
02362 si.buffer = buffer;
02363 si.buflen = buflen;
02364 si.fileformat = fileformat;
02365 si.properties = properties;
02366 si.comments = comments;
02367 return gx_call(gx_direct(GX_CALL_GROUP_GX_IMAGE), GX_CALL_SAVEIMAGETOMEM, (void *)&si);
02368 }
02369
02370
02382 inline gxi32 gx_saveimagetomem2(gxHANDLE handle, gxIMAGE* pimage,
02383 void **buffer, gxi32 *buflen, wchar_t* fileformat,
02384 gxVARIANT properties GX_DEFARG(0),
02385 gxVARIANT comments GX_DEFARG(0)) {
02386
02387 struct GX_PARM_SAVEIMAGETOMEM2 si;
02388 assert(pimage);
02389 si.pimage = pimage;
02390 si.buffer = buffer;
02391 si.buflen = buflen;
02392 si.fileformat = fileformat;
02393 si.properties = properties;
02394 si.comments = comments;
02395 return gx_call(handle, GX_CALL_SAVEIMAGETOMEM2, (void *)&si);
02396 }
02397
02398
02405 inline gxi32 gx_testimagefileformat(const wchar_t *filename, gxi32 *fileformat) {
02406
02407 return gx_testimagefileformat(gx_direct(GX_CALL_GROUP_GX_IMAGE), filename, fileformat);
02408 }
02409
02410
02417 inline gxi32 gx_testimagefileformat(const char *filename, gxi32 *fileformat) {
02418
02419 return gx_testimagefileformat(gx_direct(GX_CALL_GROUP_GX_IMAGE), filename, fileformat);
02420 }
02421
02422
02430 inline gxi32 gx_testimagefileformat(const void *buffer, gxi32 buflen, gxi32 *fileformat) {
02431
02432 return gx_testimagefileformat(gx_direct(GX_CALL_GROUP_GX_IMAGE), buffer, buflen, fileformat);
02433 }
02434
02435
02437
02438
02439
02446 inline void *gx_getpixelptr(gxIMAGE *pimage, gxi32 x, gxi32 y) {
02447 return gx_getpixelptr(gx_direct(GX_CALL_GROUP_GX_IMAGE), pimage, x, y);
02448 }
02449
02450
02451 #endif
02452 #endif
02453
02454 #ifdef GX_DOTNET
02455 #pragma managed
02456 #endif
02457
02458
02459 #if !defined(NO_GX_CLASSES)
02460
02461 #ifndef GX_EXT_MODULE
02462
02463
02467 GX_CLASS gxImageData
02468 #ifdef GX_DOTNET
02469 : public System::IDisposable
02470 #endif
02471 {
02472
02473 #if !defined(GX_SWIGIF)
02474
02475 #if !defined(GX_DOTNET) && !defined(GX_MANUAL)
02476 public:
02477 GX_INDIRECTION_NOGC(gxIMAGE) _image;
02478 #endif
02479
02480 #if defined(GX_DOTNET)
02481 #if !defined(GX_MANUAL)
02482 private:
02483 GX_INDIRECTION_NOGC(gxIMAGE) _image;
02484 #endif
02485
02486 public:
02492 inline gxOutPtr _get_image(void) GX_CONST {
02493 return GX_PUTPTR(_image);
02494 }
02500 inline void _set_image(gxInPtr ptr) {
02501 _image = (GX_INDIRECTION_NOGC(gxIMAGE))ptr.ToPointer();
02502 }
02503 #endif
02504
02505 #endif
02506
02507 public:
02509 inline gxImageData() {
02510 _image = (GX_INDIRECTION_NOGC(gxIMAGE))GX_NULLPTR;
02511 }
02513 inline ~gxImageData() gxFuncThrowsError {
02514 _Dispose();
02515 }
02516
02517 #ifdef GX_DOTNET_20
02518 inline !gxImageData() gxFuncThrowsError {
02519 _Dispose();
02520 }
02521 #else
02522
02523 inline void Dispose(void) gxFuncThrowsError {
02524 #ifdef GX_DOTNET
02525 System::GC::SuppressFinalize(this);
02526 #endif
02527 _Dispose();
02529 }
02530 #endif
02531
02532 private:
02533 inline void _Dispose(void) {
02534 gxassert(!_image || (_image->ref == 0));
02535 }
02536 public:
02537
02538
02541 inline gxi32 ref(void) GX_CONST gxFuncThrowsError {
02542 gxassert(_image);
02543 return _image->ref;
02544 }
02545 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
02546
02548 inline void *image(void) GX_CONST gxFuncThrowsError {
02549 gxassert(_image);
02550 return _image->image;
02551 }
02552 #endif
02553
02555 inline gxi32 simage(void) GX_CONST gxFuncThrowsError {
02556 gxassert(_image);
02557 return _image->simage;
02558 }
02561 inline gxi32 format(void) GX_CONST gxFuncThrowsError {
02562 gxassert(_image);
02563 return _image->format;
02564 }
02567 inline gxi32 xsize(void) GX_CONST gxFuncThrowsError {
02568 gxassert(_image);
02569 return _image->xsize;
02570 }
02573 inline gxi32 ysize(void) GX_CONST gxFuncThrowsError {
02574 gxassert(_image);
02575 return _image->ysize;
02576 }
02579 inline gxi32 sline(void) GX_CONST gxFuncThrowsError {
02580 gxassert(_image);
02581 return _image->sline;
02582 }
02585 inline gxi32 xres(void) GX_CONST gxFuncThrowsError {
02586 gxassert(_image);
02587 return _image->xres;
02588 }
02591 inline gxi32 yres(void) GX_CONST gxFuncThrowsError {
02592 gxassert(_image);
02593 return _image->yres;
02594 }
02598 inline void xres(gxi32 _xres) gxFuncThrowsError {
02599 gxassert(_image);
02600 _image->xres = _xres;
02601 }
02605 inline void yres(gxi32 _yres) gxFuncThrowsError {
02606 gxassert(_image);
02607 _image->yres = _yres;
02608 }
02609
02612 inline gxi32 GetRef(void) GX_CONST gxFuncThrowsError {
02613 return ref();
02614 }
02615
02618 #if defined(GX_DOTNET)
02619 inline gxOutData GetPixels(void) GX_CONST gxFuncThrowsError {
02620 return GX_PUTDATA(_image->image, _image->simage);
02621 }
02622 #elif defined(GX_SWIG)
02623 inline gxOutData GetPixels(void) GX_CONST gxFuncThrowsError {
02624 return GX_PUTDATA(image(), simage());
02625 }
02626 #else
02627 inline void *GetPixels(void) GX_CONST gxFuncThrowsError {
02628 return image();
02629 }
02630 #endif
02631
02634 inline gxi32 GetSImage(void) GX_CONST gxFuncThrowsError {
02635 return simage();
02636 }
02639 inline gxi32 GetPixelFormat(void) GX_CONST gxFuncThrowsError {
02640 return format();
02641 }
02644 inline gxi32 GetXSize(void) GX_CONST gxFuncThrowsError {
02645 return xsize();
02646 }
02649 inline gxi32 GetYSize(void) GX_CONST gxFuncThrowsError {
02650 return ysize();
02651 }
02654 inline gxi32 GetSLine(void) GX_CONST gxFuncThrowsError {
02655 return sline();
02656 }
02659 inline gxi32 GetXRes(void) GX_CONST gxFuncThrowsError {
02660 return xres();
02661 }
02664 inline gxi32 GetYRes(void) GX_CONST gxFuncThrowsError {
02665 return yres();
02666 }
02671 inline bool SetXRes(gxi32 _xres) gxFuncThrowsError {
02672 xres(_xres);
02673 return true;
02674 }
02679 inline bool SetYRes(gxi32 _yres) gxFuncThrowsError {
02680 yres(_yres);
02681 return true;
02682 }
02683
02684 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
02685
02687 inline operator gxIMAGE *() GX_CONST {
02688 return _image;
02689 }
02692 inline operator gxIMAGE &() GX_CONST gxFuncThrowsError {
02693 gxassert(_image);
02694 return *_image;
02695 }
02696 #endif
02697 };
02698
02699
02701 GX_CLASS gxImageHandler : public gxHandle
02702 {
02703 public:
02705 inline gxImageHandler() gxFuncThrowsError {
02706 #ifndef GX_DOTNET
02707 if(!gx_openmodule(this, L"gximage", L"default")) gxthrow;
02708 #else
02709 GX_GETHANDLE(h);
02710 if(!gx_openmodule(&h, L"gximage", L"default")) gxthrow;
02711 _set_handle(h.handle);
02712 #endif
02713 }
02714
02715 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
02716
02719 inline gxImageHandler(const gxHANDLE *src) gxFuncThrowsError : gxHandle() {
02720 if(src) {
02721 handle = src->handle;
02722 if(!gx_refhandle(*this)) gxthrow;
02723 }
02724 }
02728 inline gxImageHandler(const gxHANDLE &src) gxFuncThrowsError : gxHandle() {
02729 handle = src.handle;
02730 if(!gx_refhandle(*this)) gxthrow;
02731 }
02732
02737 inline gxImageHandler(const wchar_t *propname,
02738 const wchar_t *modname = (const wchar_t *)0) gxFuncThrowsError {
02739
02740 if(!gx_openmodule(this, modname ? modname : L"gximage", propname)) gxthrow;
02741 }
02742
02747 inline gxImageHandler(const char *propname,
02748 const char *modname = (const char *)0) gxFuncThrowsError {
02749
02750 if(!gx_openmodulea(this, modname ? modname : "gximage", propname)) gxthrow;
02751 }
02752 #endif
02753
02754 #ifdef GX_UNICODE
02755
02759 inline gxImageHandler(gxInStr propname, gxInStr modname) gxFuncThrowsError {
02760 GX_GETSTRING(_propname, propname);
02761 GX_GETSTRING(_modname, modname);
02762 #ifndef GX_DOTNET
02763 if(!gx_openmodule(this, _modname, _propname)) gxthrow;
02764 #else
02765 GX_GETHANDLE(h);
02766 if(!gx_openmodule(&h, _modname, _propname)) gxthrow;
02767 _set_handle(h.handle);
02768 #endif
02769 }
02773 inline gxImageHandler(gxInStr propname) gxFuncThrowsError {
02774 GX_GETSTRING(_propname, propname);
02775 #ifndef GX_DOTNET
02776 if(!gx_openmodule(this, L"gximage", _propname)) gxthrow;
02777 #else
02778 GX_GETHANDLE(h);
02779 if(!gx_openmodule(&h, L"gximage", _propname)) gxthrow;
02780 _set_handle(h.handle);
02781 #endif
02782 }
02783 #endif
02784
02785 #ifdef GX_ASCII
02786
02790 inline gxImageHandler(gxInAStr propname, gxInAStr modname) gxFuncThrowsError {
02791 GX_GETASTRING(_propname, propname);
02792 GX_GETASTRING(_modname, modname);
02793 if(!gx_openmodulea(this, _modname, _propname)) gxthrow;
02794 }
02797 inline gxImageHandler(gxInAStr propname) gxFuncThrowsError {
02798 GX_GETASTRING(_propname, propname);
02799 if(!gx_openmodulea(this, "gximage", _propname)) gxthrow;
02800 }
02801 #endif
02802
02806 inline gxImageHandler(GX_CONST gxImageHandler GX_REF_CLASS(src)) gxFuncThrowsError : gxHandle() {
02807 #ifndef GX_DOTNET
02808 handle = src.handle;
02809 if(!gx_refhandle(*this)) gxthrow;
02810 #else
02811 gxHANDLE h = { src GX_M _get_handle() };
02812 if(!gx_refhandle(h)) gxthrow;
02813 _set_handle(h.handle);
02814 #endif
02815 }
02816
02817 };
02818
02819 #endif
02820
02821 #if !defined(GX_MANUAL)
02822 #if !defined(GX_DOTNET)
02823 #define GX_GETIMAGE(name) gxIMAGE *name = _image
02824 #define GX_GETIMAGE2(name,src) gxIMAGE *name = (src)._image
02825 #else
02826 #define GX_GETIMAGE(name) gxIMAGE *name = (gxIMAGE *)_get_image().ToPointer()
02827 #define GX_GETIMAGE2(name,src) gxIMAGE *name = (gxIMAGE *)((src) GX_M _get_image().ToPointer())
02828 #endif
02829 #endif
02830
02831
02832
02833 #ifndef GX_EXT_MODULE
02834
02835
02837 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
02838 class gxImage : public gxImageHandler, public gxImageData {
02839 #else
02840 GX_CLASS gxImage : public gxImageHandler
02841 #ifdef GX_DOTNET
02842 , public System::IDisposable
02843 #endif
02844 {
02845
02846 #if !defined(GX_SWIGIF)
02847
02848 #if !defined(GX_DOTNET) && !defined(GX_MANUAL)
02849 public:
02850 GX_INDIRECTION_NOGC(gxIMAGE) _image;
02851 #endif
02852
02853 #if defined(GX_DOTNET)
02854 #if !defined(GX_MANUAL)
02855 private:
02856 GX_INDIRECTION_NOGC(gxIMAGE) _image;
02857 #endif
02858
02859 public:
02865 inline gxOutPtr _get_image(void) GX_CONST {
02866 return GX_PUTPTR(_image);
02867 }
02873 inline void _set_image(gxInPtr ptr) {
02874 _image = (GX_INDIRECTION_NOGC(gxIMAGE))GX_GETPTR(ptr);
02875 }
02878 private:
02879 inline void _set_image(GX_INDIRECTION_NOGC(gxIMAGE) ptr) {
02880 _image = ptr;
02881 }
02882 public:
02883 #endif
02884 #endif
02885
02886 public:
02889 inline gxi32 ref(void) GX_CONST gxFuncThrowsError {
02890 gxassert(_image);
02891 return _image->ref;
02892 }
02893
02896 inline gxi32 simage(void) GX_CONST gxFuncThrowsError {
02897 gxassert(_image);
02898 return _image->simage;
02899 }
02902 inline gxi32 format(void) GX_CONST gxFuncThrowsError {
02903 gxassert(_image);
02904 return _image->format;
02905 }
02908 inline gxi32 xsize(void) GX_CONST gxFuncThrowsError {
02909 gxassert(_image);
02910 return _image->xsize;
02911 }
02914 inline gxi32 ysize(void) GX_CONST gxFuncThrowsError {
02915 gxassert(_image);
02916 return _image->ysize;
02917 }
02920 inline gxi32 sline(void) GX_CONST gxFuncThrowsError {
02921 gxassert(_image);
02922 return _image->sline;
02923 }
02926 inline gxi32 xres(void) GX_CONST gxFuncThrowsError {
02927 gxassert(_image);
02928 return _image->xres;
02929 }
02932 inline gxi32 yres(void) GX_CONST gxFuncThrowsError {
02933 gxassert(_image);
02934 return _image->yres;
02935 }
02938 inline void xres(gxi32 _xres) gxFuncThrowsError {
02939 gxassert(_image);
02940 _image->xres = _xres;
02941 }
02944 inline void yres(gxi32 _yres) gxFuncThrowsError {
02945 gxassert(_image);
02946 _image->yres = _yres;
02947 }
02948
02951 inline gxi32 GetRef(void) GX_CONST gxFuncThrowsError {
02952 return ref();
02953 }
02954
02957 #if defined(GX_DOTNET)
02958 inline gxOutData GetPixels(void) GX_CONST gxFuncThrowsError {
02959 return GX_PUTDATA(_image->image, _image->simage);
02960 }
02961 #elif defined(GX_SWIG)
02962 inline gxOutData GetPixels(void) GX_CONST gxFuncThrowsError {
02963 return GX_PUTDATA(image(), simage());
02964 }
02965 #else
02966 inline void *GetPixels(void) GX_CONST gxFuncThrowsError {
02967 return image();
02968 }
02969 #endif
02970
02973 inline gxi32 GetSImage(void) GX_CONST gxFuncThrowsError {
02974 return simage();
02975 }
02978 inline gxi32 GetPixelFormat(void) GX_CONST gxFuncThrowsError {
02979 return format();
02980 }
02983 inline gxi32 GetXSize(void) GX_CONST gxFuncThrowsError {
02984 return xsize();
02985 }
02988 inline gxi32 GetYSize(void) GX_CONST gxFuncThrowsError {
02989 return ysize();
02990 }
02993 inline gxi32 GetSLine(void) GX_CONST gxFuncThrowsError {
02994 return sline();
02995 }
02998 inline gxi32 GetXRes(void) GX_CONST gxFuncThrowsError {
02999 return xres();
03000 }
03003 inline gxi32 GetYRes(void) GX_CONST gxFuncThrowsError {
03004 return yres();
03005 }
03009 inline bool SetXRes(gxi32 _xres) gxFuncThrowsError {
03010 xres(_xres);
03011 return true;
03012 }
03016 inline bool SetYRes(gxi32 _yres) gxFuncThrowsError {
03017 yres(_yres);
03018 return true;
03019 }
03020 #endif
03021 public:
03022 #if defined(GX_DOTNET) || defined(GX_SWIGIF)
03023
03024 inline gxImage() gxFuncThrowsError : gxImageHandler() {
03025 _image = 0;
03026 if(gxHandle::IsValid()) {
03027 #ifndef GX_DOTNET
03028 if(!gx_allocimage(*this, &_image)) gxthrow;
03029 #else
03030 GX_GETHANDLE(h);
03031 GX_GETIMAGE(i);
03032 if(!gx_allocimage(h, &i)) gxthrow;
03033 _set_image(i);
03034 #endif
03035 }
03036 }
03037 #endif
03038
03039 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03040
03041 inline gxImage() gxFuncThrowsError : gxImageHandler(), gxImageData() {
03042 if(gxHandle::IsValid()) {
03043 if(!gx_allocimage(*this, &_image)) gxthrow;
03044 }
03045 }
03046
03050 inline gxImage(const gxHANDLE &h) gxFuncThrowsError : gxImageHandler(h), gxImageData() {
03051 if(gxHandle::IsValid()) {
03052 if(!gx_allocimage(*this, &_image)) gxthrow;
03053 }
03054 }
03058 inline gxImage(const gxHANDLE *h) gxFuncThrowsError : gxImageHandler(h), gxImageData() {
03059 if(gxHandle::IsValid()) {
03060 if(!gx_allocimage(*this, &_image)) gxthrow;
03061 }
03062 }
03063
03068 inline gxImage(const wchar_t *propname,
03069 const wchar_t *modname = (const wchar_t *)0) gxFuncThrowsError
03070 : gxImageHandler(propname, modname), gxImageData() {
03071
03072 if(gxHandle::IsValid()) {
03073 if(!gx_allocimage(*this, &_image)) gxthrow;
03074 }
03075 }
03076
03081 inline gxImage(const char *propname,
03082 const char *modname = (const char *)0) gxFuncThrowsError
03083 : gxImageHandler(propname, modname), gxImageData() {
03084
03085 if(gxHandle::IsValid()) {
03086 if(!gx_allocimage(*this, &_image)) gxthrow;
03087 }
03088 }
03089
03092 inline gxImage(gxIMAGE &src) gxFuncThrowsError : gxImageHandler(), gxImageData() {
03093 if(gxHandle::IsValid()) {
03094 if(gx_allocimage(*this, &_image)) {
03095 Copy(src);
03096 } else {
03097 gxthrow;
03098 }
03099 }
03100 }
03101
03107 inline gxImage(gxIMAGE &src, const wchar_t *propname,
03108 const wchar_t *modname = (const wchar_t *)0) gxFuncThrowsError
03109 : gxImageHandler(propname, modname), gxImageData() {
03110
03111 if(gxHandle::IsValid()) {
03112 if(gx_allocimage(*this, &_image)) {
03113 Copy(src);
03114 } else {
03115 gxthrow;
03116 }
03117 }
03118 }
03119
03125 inline gxImage(gxIMAGE &src, const char *propname,
03126 const char *modname = (const char *)0) gxFuncThrowsError
03127 : gxImageHandler(propname, modname), gxImageData() {
03128
03129 if(gxHandle::IsValid()) {
03130 if(gx_allocimage(*this, &_image)) {
03131 Copy(src);
03132 } else {
03133 gxthrow;
03134 }
03135 }
03136 }
03137
03143 inline gxImage(gxImage &src, const wchar_t *propname, const wchar_t *modname = (const wchar_t *)0)
03144 gxFuncThrowsError : gxImageHandler(propname, modname), gxImageData() {
03145
03146 if(gxHandle::IsValid()) {
03147 if(gx_allocimage(*this, &_image)) {
03148 Copy(src);
03149 } else {
03150 gxthrow;
03151 }
03152 }
03153 }
03154
03160 inline gxImage(gxImage &src, const char *propname,
03161 const char *modname = (const char *)0) gxFuncThrowsError
03162 : gxImageHandler(propname, modname), gxImageData() {
03163
03164 if(gxHandle::IsValid()) {
03165 if(gx_allocimage(*this, &_image)) {
03166 Copy(src);
03167 } else {
03168 gxthrow;
03169 }
03170 }
03171 }
03172 #endif
03173
03174 #ifdef GX_UNICODE
03175
03178 #ifndef GX_DOTNET
03179 inline gxImage(gxInStr propname) gxFuncThrowsError
03180 : gxImageHandler(propname), gxImageData() {
03181
03182 if(gxHandle::IsValid()) {
03183 if(!gx_allocimage(*this, &_image)) gxthrow;
03184 }
03185 }
03186 #else
03187 inline gxImage(gxInStr propname) gxFuncThrowsError
03188 : gxImageHandler(propname) {
03189
03190 _set_image(0);
03191 if(gxHandle::IsValid()) {
03192 GX_GETHANDLE(h);
03193 GX_GETIMAGE(i);
03194 if(!gx_allocimage(h, &i)) gxthrow;
03195 _set_image(i);
03196 }
03197 }
03198 #endif
03199
03204 #ifndef GX_DOTNET
03205 inline gxImage(gxInStr propname, gxInStr modname) gxFuncThrowsError
03206 : gxImageHandler(propname, modname), gxImageData() {
03207 if(gxHandle::IsValid()) {
03208 if(!gx_allocimage(*this, &_image)) gxthrow;
03209 }
03210 }
03211 #else
03212 inline gxImage(gxInStr propname, gxInStr modname) gxFuncThrowsError
03213 : gxImageHandler(propname, modname) {
03214
03215 _set_image(0);
03216 if(gxHandle::IsValid()) {
03217 GX_GETHANDLE(h);
03218 GX_GETIMAGE(i);
03219 if(!gx_allocimage(h, &i)) gxthrow;
03220 _set_image(i);
03221 }
03222 }
03223 #endif
03224
03225 #endif
03226
03227 #ifdef GX_ASCII
03228
03231 inline gxImage(gxInAStr propname) gxFuncThrowsError
03232 : gxImageHandler(propname), gxImageData() {
03233
03234 if(gxHandle::IsValid()) {
03235 if(!gx_allocimage(*this, &_image)) gxthrow;
03236 }
03237 }
03242 inline gxImage(gxInAStr propname, gxInAStr modname) gxFuncThrowsError
03243 : gxImageHandler(propname, modname), gxImageData() {
03244 if(gxHandle::IsValid()) {
03245 if(!gx_allocimage(*this, &_image)) gxthrow;
03246 }
03247 }
03248 #endif
03249
03253 #ifndef GX_DOTNET
03254 inline gxImage(gxImageHandler &ih) gxFuncThrowsError : gxImageHandler(ih), gxImageData() {
03255 if(gxHandle::IsValid()) {
03256 if(!gx_allocimage(*this, &_image)) gxthrow;
03257 }
03258 }
03259 #else
03260
03261 inline gxImage(gxImageHandler GX_REF_CLASS(ih)) gxFuncThrowsError : gxImageHandler(ih) {
03262
03263 _set_image(GX_NULLPTR);
03264 if(gxHandle::IsValid()) {
03265 GX_GETHANDLE(h);
03266 GX_GETIMAGE(i);
03267 if(!gx_allocimage(h, &i)) gxthrow;
03268 _set_image(i);
03269
03270 }
03271 }
03272 #endif
03273
03277 #ifndef GX_DOTNET
03278 inline gxImage(gxImage &src) gxFuncThrowsError : gxImageHandler((const gxHANDLE &)src), gxImageData() {
03279 if(gxHandle::IsValid()) {
03280 if(gx_allocimage(*this, &_image)) {
03281 Copy(src);
03282 } else {
03283 gxthrow;
03284 }
03285 }
03286 }
03287 #else
03288 inline gxImage(gxImage GX_REF_CLASS(src)) gxFuncThrowsError : gxImageHandler(src) {
03289 _set_image(0);
03290 if(gxHandle::IsValid()) {
03291 GX_GETHANDLE(h);
03292 GX_GETIMAGE(i);
03293 if(gx_allocimage(h, &i)) {
03294 _set_image(i);
03295 Copy(src);
03296 } else {
03297 gxthrow;
03298 }
03299 }
03300 }
03301 #endif
03302
03304 inline ~gxImage() gxFuncThrowsError {
03305 _Dispose();
03306 }
03307
03308 #ifdef GX_DOTNET_20
03309 inline !gxImage() gxFuncThrowsError {
03310 _Dispose();
03311 }
03312 #else
03313
03314 inline void Dispose(void) gxFuncThrowsError {
03315 #ifdef GX_DOTNET
03316 System::GC::SuppressFinalize(this);
03317 #endif
03318 _Dispose();
03320 gxHandle::Dispose();
03321 }
03322 #endif
03323
03324 private:
03325 inline void _Dispose(void) gxFuncThrowsError {
03326 #ifndef GX_DOTNET
03327 if(_image) {
03328 if(!gx_unrefimage(*this, _image)) gxthrow;
03329 }
03330 #else
03331 GX_GETHANDLE(h);
03332 GX_GETIMAGE(i);
03333 if(i) {
03334 if(!gx_unrefimage(h, i)) gxthrow;
03335 }
03336 #endif
03337 _image=0;
03338 }
03339
03340 public:
03341
03342 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03343
03347 inline gxImage &operator = (gxIMAGE &src) gxFuncThrowsError {
03348 Copy(src);
03349 return *this;
03350 }
03351
03356 inline gxImage &operator = (gxImage &src) gxFuncThrowsError {
03357 Copy(src);
03358 return *this;
03359 }
03360
03363 inline operator gxIMAGE & () gxFuncThrowsError {
03364 gxassert(_image);
03365 return *_image;
03366 }
03369 inline operator gxIMAGE * () gxFuncThrowsError {
03370 gxassert(_image);
03371 return _image;
03372 }
03375 inline operator const gxIMAGE * () const gxFuncThrowsError {
03376 gxassert(_image);
03377 return _image;
03378 }
03379
03383 inline bool Attach(gxIMAGE *src) gxFuncThrowsError {
03384 gxassert(_image && src);
03385 if(src->ref >= 0) {
03386 gx_seterror(GX_EINVAL, L"(src->ref < 0)");
03387 gxthrow;
03388 return false;
03389 }
03390 if(!gx_refimage(*this, src)) {
03391 gxthrow;
03392 return false;
03393 }
03394 if(!gx_unrefimage(*this, _image)) {
03395 gx_unrefimage(*this, src);
03396 gxthrow;
03397 return false;
03398 }
03399 _image = src;
03400 return true;
03401 }
03402
03405 inline bool Detach(void) gxFuncThrowsError {
03406 if(!gx_unrefimage(*this, _image)) {
03407 gxthrow;
03408 return false;
03409 }
03410 if(!gx_allocimage(*this, &_image)) {
03411 gxthrow;
03412 return false;
03413 }
03414 return true;
03415 }
03416
03420 inline bool GetPixelSize(gxi32 *size) const gxFuncThrowsError {
03421 if(!gx_getpixelsize(*this, size, format())) {
03422 throw gxError();
03423 return false;
03424 }
03425 return true;
03426 }
03427
03433 inline void *GetPixelPtr(gxi32 x, gxi32 y) gxFuncThrowsError {
03434 gxassert(_image);
03435 void *ret = gx_getpixelptr(*this, _image, x, y);
03436 gxcondthrow(!ret);
03437 return ret;
03438 }
03439 #endif
03440
03442 inline gxi32 GetPixelSize(void) GX_CONST gxFuncThrowsError {
03443 gxi32 size = -1;
03444 GX_GETHANDLE(h);
03445 if(!gx_getpixelsize(h, &size, format())) gxthrow;
03446 return size;
03447 }
03448
03456 inline bool Create(gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline GX_DEFARG(0)) gxFuncThrowsError {
03457 gxassert(_image);
03458 GX_GETHANDLE(h);
03459 bool st = gx_createimage(h, _image, format, xsize, ysize, sline) ? true : false;
03460 gxcondthrow(!st);
03461 return st;
03462 }
03463
03464 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03465
03473 inline bool Convert(gxIMAGE *src, gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline GX_DEFARG(0)) gxFuncThrowsError {
03474 gxassert(_image);
03475 bool st = gx_convertimage(*this, _image, src, format, xsize, ysize, sline) ? true : false;
03476 gxcondthrow(!st);
03477 return st;
03478 }
03479 #endif
03480
03488 inline bool Convert(gxImageData GX_REF_CLASS(src), gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline GX_DEFARG(0)) gxFuncThrowsError {
03489 gxassert(_image);
03490 GX_GETHANDLE(h);
03491 #ifndef GX_DOTNET
03492 bool st = gx_convertimage(h, _image, src._image, format, xsize, ysize, sline) ? true : false;
03493 #else
03494 bool st = gx_convertimage(h, _image, (gxIMAGE *)src GX_M _get_image().ToPointer(), format, xsize, ysize, sline) ? true : false;
03495 #endif
03496 gxcondthrow(!st);
03497 return st;
03498 }
03499
03508 inline bool Convert(gxImage GX_REF_CLASS(src), gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline GX_DEFARG(0)) gxFuncThrowsError {
03509 gxassert(_image);
03510 GX_GETHANDLE(h);
03511 bool st = gx_convertimage(h, _image, src GX_M _image, format, xsize, ysize, sline) ? true : false;
03512 gxcondthrow(!st);
03513 return st;
03514 }
03515
03523 inline bool Convert(gxi32 format, gxi32 xsize, gxi32 ysize, gxi32 sline GX_DEFARG(0)) gxFuncThrowsError {
03524 gxassert(_image);
03525 GX_GETHANDLE(h);
03526 bool st = gx_convertimage(h, _image, _image, format, xsize, ysize, sline) ? true : false;
03527 gxcondthrow(!st);
03528 return st;
03529 }
03530
03534 inline bool Convert(gxi32 format) gxFuncThrowsError {
03535 gxassert(_image);
03536 GX_GETHANDLE(h);
03537 bool st = gx_convertimage(h, _image, _image, format, xsize(), ysize(), 0) ? true : false;
03538 gxcondthrow(!st);
03539 return st;
03540 }
03541
03542 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03543
03546 inline bool Copy(gxIMAGE *src) gxFuncThrowsError {
03547 gxassert(_image);
03548 bool st = gx_copyimage(*this, _image, src) ? true : false;
03549 gxcondthrow(!st);
03550 return st;
03551 }
03552
03556 inline bool Copy(gxIMAGE &src) gxFuncThrowsError {
03557 gxassert(_image);
03558 bool st = gx_copyimage(*this, _image, &src) ? true : false;
03559 gxcondthrow(!st);
03560 return st;
03561 }
03562
03566 inline bool Copy(gxImage *src) gxFuncThrowsError {
03567 gxassert(src);
03568 return Copy((gxIMAGE *)(*src));
03569 }
03570 #endif
03571
03575 inline bool Copy(gxImageData GX_REF_CLASS(src)) gxFuncThrowsError {
03576 #ifndef GX_DOTNET
03577 return Copy((gxIMAGE &)src);
03578 #else
03579 GX_GETHANDLE(h);
03580 GX_GETIMAGE(i);
03581 bool st = gx_copyimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer()) ? true : false;
03582 gxcondthrow(!st);
03583 return st;
03584 #endif
03585 }
03586
03590 inline bool Copy(gxImage GX_REF_CLASS(src)) gxFuncThrowsError {
03591 #ifndef GX_DOTNET
03592 return Copy((gxIMAGE &)src);
03593 #else
03594 GX_GETHANDLE(h);
03595 GX_GETIMAGE(i);
03596 bool st = gx_copyimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer()) ? true : false;
03597 gxcondthrow(!st);
03598 return st;
03599 #endif
03600 }
03601
03602 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03603
03613 inline bool Zoom(gxIMAGE *src, gxi32 xsize, gxi32 ysize, gxi32 sline,
03614 gxi32 sx1_8 GX_DEFARG(0), gxi32 sy1_8 GX_DEFARG(0),
03615 gxi32 sx2_8 GX_DEFARG(0), gxi32 sy2_8 GX_DEFARG(0)) gxFuncThrowsError {
03616 gxassert(_image);
03617 bool st = gx_zoomimage(*this, _image, xsize, ysize, sline, src,
03618 sx1_8, sy1_8, sx2_8, sy2_8) ? true : false;
03619 gxcondthrow(!st);
03620 return st;
03621 }
03622 #endif
03623
03634 inline bool Zoom(gxImageData GX_REF_CLASS(src), gxi32 xsize, gxi32 ysize, gxi32 sline,
03635 gxi32 sx1_8 GX_DEFARG(0), gxi32 sy1_8 GX_DEFARG(0),
03636 gxi32 sx2_8 GX_DEFARG(0), gxi32 sy2_8 GX_DEFARG(0)) gxFuncThrowsError {
03637 gxassert(_image);
03638 #ifndef GX_DOTNET
03639 bool st = gx_zoomimage(*this, _image, xsize, ysize, sline, src,
03640 sx1_8, sy1_8, sx2_8, sy2_8) ? true : false;
03641 #else
03642 GX_GETHANDLE(h);
03643 GX_GETIMAGE(i);
03644 bool st = gx_zoomimage(h, i, xsize, ysize, sline,
03645 (gxIMAGE *)src GX_M _get_image().ToPointer(),
03646 sx1_8, sy1_8, sx2_8, sy2_8) ? true : false;
03647 #endif
03648 gxcondthrow(!st);
03649 return st;
03650 }
03651 #ifdef GX_DOTNET
03652
03658 inline bool Zoom(gxImageData GX_REF_CLASS(src), gxi32 xsize, gxi32 ysize, gxi32 sline) gxFuncThrowsError {
03659 return false;
03660
03661 }
03662 #endif
03663
03674 inline bool Zoom(gxImage GX_REF_CLASS(src), gxi32 xsize, gxi32 ysize, gxi32 sline,
03675 gxi32 sx1_8 GX_DEFARG(0), gxi32 sy1_8 GX_DEFARG(0),
03676 gxi32 sx2_8 GX_DEFARG(0), gxi32 sy2_8 GX_DEFARG(0)) gxFuncThrowsError {
03677 gxassert(_image);
03678 #ifndef GX_DOTNET
03679 bool st = gx_zoomimage(*this, _image, xsize, ysize, sline, src,
03680 sx1_8, sy1_8, sx2_8, sy2_8) ? true : false;
03681 #else
03682 GX_GETHANDLE(h);
03683 GX_GETIMAGE(i);
03684 bool st = gx_zoomimage(h, i, xsize, ysize, sline,
03685 (gxIMAGE *)src GX_M _get_image().ToPointer(),
03686 sx1_8, sy1_8, sx2_8, sy2_8) ? true : false;
03687 #endif
03688 gxcondthrow(!st);
03689 return st;
03690 }
03691 #ifdef GX_DOTNET
03692
03698 inline bool Zoom(gxImage GX_REF_CLASS(src), gxi32 xsize, gxi32 ysize, gxi32 sline) gxFuncThrowsError {
03699 return Zoom(src, xsize, ysize, sline, 0,0,0,0);
03700 }
03701 #endif
03702
03703 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03704
03708 inline bool Rotate(gxIMAGE *src, gxi32 degree) gxFuncThrowsError {
03709 gxassert(_image);
03710 bool st = gx_rotateimage(*this, _image, src, degree) ? true : false;
03711 gxcondthrow(!st);
03712 return st;
03713 }
03714 #endif
03715
03720 inline bool Rotate(gxImageData GX_REF_CLASS(src), gxi32 degree) gxFuncThrowsError {
03721 gxassert(_image);
03722 #ifndef GX_DOTNET
03723 bool st = gx_rotateimage(*this, _image, src, degree) ? true : false;
03724 #else
03725 GX_GETHANDLE(h);
03726 GX_GETIMAGE(i);
03727 bool st = gx_rotateimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer(), degree) ? true : false;
03728 #endif
03729 gxcondthrow(!st);
03730 return st;
03731 }
03732
03737 inline bool Rotate(gxImage GX_REF_CLASS(src), gxi32 degree) gxFuncThrowsError {
03738 gxassert(_image);
03739 #ifndef GX_DOTNET
03740 bool st = gx_rotateimage(*this, _image, src, degree) ? true : false;
03741 #else
03742 GX_GETHANDLE(h);
03743 GX_GETIMAGE(i);
03744 bool st = gx_rotateimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer(), degree) ? true : false;
03745 #endif
03746 gxcondthrow(!st);
03747 return st;
03748 }
03749
03750 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
03751
03755 inline bool Mirror(gxIMAGE *src, gxi32 flags) gxFuncThrowsError {
03756 gxassert(_image);
03757 bool st = gx_mirrorimage(*this, _image, src, flags) ? true : false;
03758 gxcondthrow(!st);
03759 return st;
03760 }
03761 #endif
03762
03766 inline bool Mirror(gxImageData GX_REF_CLASS(src), gxi32 flags) {
03767 gxassert(_image);
03768 #ifndef GX_DOTNET
03769 bool st = gx_mirrorimage(*this, _image, src, flags) ? true : false;
03770 #else
03771 GX_GETHANDLE(h);
03772 GX_GETIMAGE(i);
03773 bool st = gx_mirrorimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer(), flags) ? true : false;
03774 #endif
03775 gxcondthrow(!st);
03776 return st;
03777 }
03778
03783 inline bool Mirror(gxImage GX_REF_CLASS(src), gxi32 flags) {
03784 gxassert(_image);
03785 #ifndef GX_DOTNET
03786 bool st = gx_mirrorimage(*this, _image, src, flags) ? true : false;
03787 #else
03788 GX_GETHANDLE(h);
03789 GX_GETIMAGE(i);
03790 bool st = gx_mirrorimage(h, i, (gxIMAGE *)src GX_M _get_image().ToPointer(), flags) ? true : false;
03791 #endif
03792 gxcondthrow(!st);
03793 return st;
03794 }
03795
03799 inline bool Mirror(gxi32 flags) {
03800 gxassert(_image);
03801 GX_GETHANDLE(h);
03802 GX_GETIMAGE(i);
03803 bool st = gx_mirrorimage(h, i, flags) ? true : false;
03804 gxcondthrow(!st);
03805 return st;
03806 }
03807
03808 #if !defined(GX_SWIG) && !defined(GX_DOTNET)
03809
03829 inline bool Load(const wchar_t *filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF),
03830 gxVARIANT properties GX_DEFARG(0),
03831 gxVARIANT comments GX_DEFARG(0)) gxFuncThrowsError {
03832 gxassert(_image);
03833 bool st = gx_loadimagefromfile(_image, filename, pixelformat,
03834 properties, comments) ? true : false;
03835 gxcondthrow(!st);
03836 return st;
03837 }
03838
03859 inline bool Load(const char *filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF),
03860 gxVARIANT properties GX_DEFARG(0),
03861 gxVARIANT comments GX_DEFARG(0)) gxFuncThrowsError {
03862 gxassert(_image);
03863 bool st = gx_loadimagefromfile(_image, filename, pixelformat,
03864 properties, comments) ? true : false;
03865 gxcondthrow(!st);
03866 return st;
03867 }
03868 #endif
03869 #ifdef GX_UNICODE
03870
03892 inline bool Load(gxInStr filename, gxi32 pixelformat,
03893 #ifndef GX_DOTNET
03894 gxVariant &properties, gxVariant &comments
03895 #else
03896 #ifndef GX_DOTNET_20
03897 gxVariant *properties, gxVariant *comments
03898 #else
03899 gxVariant ^properties, gxVariant ^comments
03900 #endif
03901 #endif
03902 ) gxFuncThrowsError {
03903
03904 GX_GETSTRING(_filename, filename);
03905 GX_GETIMAGE(i);
03906 bool st = gx_loadimagefromfile(i, _filename, pixelformat,
03907 #ifndef GX_DOTNET
03908 properties._variant, comments._variant
03909 #else
03910 properties ? properties->_variant : 0,
03911 comments ? comments->_variant : 0
03912 #endif
03913 ) ? true : false;
03914 gxcondthrow(!st);
03915 return st;
03916 }
03917
03938 inline bool Load(gxInStr filename, gxi32 pixelformat) gxFuncThrowsError {
03939
03940 GX_GETSTRING(_filename, filename);
03941 GX_GETHANDLE(h);
03942 GX_GETIMAGE(i);
03943 bool st = gx_loadimage(h, i, _filename, pixelformat) ? true : false;
03944 gxcondthrow(!st);
03945 return st;
03946 }
03947
03951 inline bool Load(gxInStr filename) gxFuncThrowsError {
03952 GX_GETSTRING(_filename, filename);
03953 GX_GETHANDLE(h);
03954 GX_GETIMAGE(i);
03955 bool st = gx_loadimage(h, i, _filename, (int)GX_ENUM_PATH(GX_PIXELFORMATS) GX_UNDEF) ? true : false;
03956 gxcondthrow(!st);
03957 return st;
03958 }
03959 #endif
03960 #ifdef GX_ASCII
03961
03981 inline bool Load(gxInAStr filename, gxi32 pixelformat,
03982 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
03983
03984 GX_GETASTRING(_filename, filename);
03985 bool st = gx_loadimagefromfile(_image, _filename, pixelformat,
03986 properties._variant, comments._variant) ? true : false;
03987 gxcondthrow(!st);
03988 return st;
03989 }
03990
04009 inline bool Load(gxInAStr filename, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) gxFuncThrowsError {
04010 GX_GETASTRING(_filename, filename);
04011 bool st = gx_loadimage(*this, _image, _filename, pixelformat) ? true : false;
04012 gxcondthrow(!st);
04013 return st;
04014 }
04015 #endif
04016
04017 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04018
04023 inline bool Save(const wchar_t *filename, gxi32 fileformat) gxFuncThrowsError {
04024 gxassert(_image);
04025 bool st = gx_saveimage(*this, _image, filename, fileformat) ? true : false;
04026 gxcondthrow(!st);
04027 return st;
04028 }
04029
04035 inline bool Save(const char *filename, gxi32 fileformat) gxFuncThrowsError {
04036 gxassert(_image);
04037 bool st = gx_saveimage(*this, _image, filename, fileformat) ? true : false;
04038 gxcondthrow(!st);
04039 return st;
04040 }
04041
04049 inline bool Save(const wchar_t *filename, gxi32 fileformat,
04050 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
04051
04052 gxassert(_image);
04053 bool st = gx_saveimagetofile(_image, filename, fileformat,
04054 properties._variant, comments._variant) ? true : false;
04055 gxcondthrow(!st);
04056 return st;
04057 }
04058
04066 inline bool Save(const char *filename, gxi32 fileformat,
04067 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
04068 gxassert(_image);
04069 bool st = gx_saveimagetofile(_image, filename, fileformat,
04070 properties._variant, comments._variant) ? true : false;
04071 gxcondthrow(!st);
04072 return st;
04073 }
04074 #endif
04075 #ifdef GX_UNICODE
04076
04083 inline bool Save(gxInStr filename, gxi32 fileformat,
04084 gxVariant GX_REF_CLASS(properties), gxVariant GX_REF_CLASS(comments)
04085 ) gxFuncThrowsError {
04086
04087 GX_GETSTRING(_filename, filename);
04088 GX_GETIMAGE(i);
04089 bool st = gx_saveimagetofile(i, _filename, fileformat,
04090 #ifndef GX_DOTNET
04091 properties._variant, comments._variant
04092 #else
04093 properties ? properties->_variant : 0,
04094 comments ? comments->_variant : 0
04095 #endif
04096 ) ? true : false;
04097 gxcondthrow(!st);
04098 return st;
04099 }
04100
04106 inline bool Save(gxInStr filename, gxi32 fileformat) gxFuncThrowsError {
04107 GX_GETSTRING(_filename, filename);
04108 GX_GETHANDLE(h);
04109 GX_GETIMAGE(i);
04110 bool st = gx_saveimage(h, i, _filename, fileformat) ? true : false;
04111 gxcondthrow(!st);
04112 return st;
04113 }
04114 #endif
04115 #ifdef GX_ASCII
04116
04123 inline bool Save(gxInAStr filename, gxi32 fileformat,
04124 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
04125 GX_GETASTRING(_filename, filename);
04126 return Save(_filename, fileformat, properties, comments);
04127 }
04128
04134 inline bool Save(gxInAStr filename, gxi32 fileformat) gxFuncThrowsError {
04135 GX_GETASTRING(_filename, filename);
04136 return Save(_filename, fileformat);
04137 }
04138 #endif
04139
04140 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET)
04141
04155 inline bool LoadFromMem(const void *buffer, gxi32 buflen, gxi32 pixelformat,
04156 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
04157 gxassert(_image);
04158 bool st = gx_loadimagefrommem(_image, buffer, buflen, pixelformat,
04159 properties._variant, comments._variant) ? true : false;
04160 gxcondthrow(!st);
04161 return st;
04162 }
04163
04172 inline bool SaveToMem(void **buffer, gxi32 *buflen, gxi32 fileformat,
04173 gxVariant &properties, gxVariant &comments) gxFuncThrowsError {
04174 gxassert(_image);
04175 bool st = gx_saveimagetomem(_image, buffer, buflen, fileformat,
04176 properties._variant, comments._variant) ? true : false;
04177 gxcondthrow(!st);
04178 return st;
04179 }
04180
04192 inline bool LoadFromMem(const void *buffer, gxi32 buflen, gxi32 pixelformat GX_DEFARG(GX_UNDEF)) gxFuncThrowsError {
04193 gxassert(_image);
04194 bool st = gx_loadfrommem(*this, _image, buffer, buflen, pixelformat) ? true : false;
04195 gxcondthrow(!st);
04196 return st;
04197 }
04198
04204 inline bool SaveToMem(void **buffer, gxi32 *buflen, gxi32 fileformat) gxFuncThrowsError {
04205 gxassert(_image);
04206 bool st = gx_savetomem(*this, _image, buffer, buflen, fileformat) ? true : false;
04207 gxcondthrow(!st);
04208 return st;
04209 }
04210 #endif
04211
04212 #if defined(GX_SWIG) || defined(GX_DOTNET)
04213
04226 inline bool LoadFromMem(gxInData buffer, gxi32 pixelformat,
04227 gxVariant GX_REF_CLASS(properties), gxVariant GX_REF_CLASS(comments)
04228 ) gxFuncThrowsError {
04229
04230 GX_GETDATA(buffer);
04231 GX_GETIMAGE(i);
04232 bool st = gx_loadimagefrommem(i, GX_DATAPTR(buffer), GX_DATALEN(buffer), pixelformat,
04233 #ifndef GX_DOTNET
04234 properties._variant, comments._variant
04235 #else
04236 properties ? properties->_variant : 0,
04237 comments ? comments->_variant : 0
04238 #endif
04239 ) ? true : false;
04240 GX_FREEDATA(buffer);
04241 if(!st) gxthrow;
04242 return st;
04243 }
04244
04250 inline gxOutData SaveToMem(gxi32 fileformat,
04251 gxVariant GX_REF_CLASS(properties), gxVariant GX_REF_CLASS(comments)
04252 ) gxFuncThrowsError {
04253
04254 void *buffer = (void *)0;
04255 gxi32 buflen = 0;
04256 GX_GETIMAGE(i);
04257 if(!gx_saveimagetomem(i, &buffer, &buflen, fileformat,
04258 #ifndef GX_DOTNET
04259 properties._variant, comments._variant
04260 #else
04261 properties ? properties->_variant : 0,
04262 comments ? comments->_variant : 0
04263 #endif
04264 )) {
04265 gxthrow;
04266 return GX_PUTDATA_NONE;
04267 }
04268 gxOutData ret = GX_PUTDATA(buffer, buflen);
04269 if(buffer) gx_globalfree(buffer);
04270 return ret;
04271 }
04272
04283 inline bool LoadFromMem(gxInData buffer, gxi32 pixelformat) gxFuncThrowsError {
04284 GX_GETDATA(buffer);
04285 GX_GETHANDLE(h);
04286 GX_GETIMAGE(i);
04287 bool st = gx_loadfrommem(h, i, GX_DATAPTR(buffer), GX_DATALEN(buffer), pixelformat) ? true : false;
04288 GX_FREEDATA(buffer);
04289 if(!st) gxthrow;
04290 return st;
04291 }
04292
04296 inline gxOutData SaveToMem(gxi32 fileformat) gxFuncThrowsError
04297 {
04298 void *buffer = (void *)0;
04299 gxi32 buflen = 0;
04300 GX_GETHANDLE(h);
04301 GX_GETIMAGE(i);
04302 if(!gx_savetomem(h, i, &buffer, &buflen, fileformat)) {
04303 gxthrow;
04304 return GX_PUTDATA_NONE;
04305 }
04306 gxOutData ret = GX_PUTDATA(buffer, buflen);
04307 if(buffer) gx_globalfree(buffer);
04308 return ret;
04309 }
04310 #endif
04311
04314 inline bool IsValid(void) GX_CONST {
04315 if(!gxHandle::IsValid()) return false;
04316 GX_GETHANDLE(h);
04317 GX_GETIMAGE(i);
04318 return gx_isvalidimage(h, i) ? true : false;
04319 }
04320
04321 #ifdef WIN32
04322 #if !defined(GX_SWIGIF)
04323
04330 #ifndef GX_DOTNET
04331 inline bool DisplayImage(HDC hdc, gxi32 x, gxi32 y, gxi32 xsize, gxi32 ysize) gxFuncThrowsError {
04332 gxassert(_image);
04333 bool st = gx_displayimage(*this, hdc, x, y, xsize, ysize, _image) ? true : false;
04334 gxcondthrow(!st);
04335 return st;
04336 }
04337 #else
04338 inline bool DisplayImage(gxInPtr hdc, gxi32 x, gxi32 y, gxi32 xsize, gxi32 ysize) gxFuncThrowsError {
04339 gxassert(_image);
04340 GX_GETHANDLE(h);
04341 bool st = gx_displayimage(h, hdc.ToPointer(), x, y, xsize, ysize, _image) ? true : false;
04342 gxcondthrow(!st);
04343 return st;
04344 }
04345 #endif
04346 #endif
04347
04350 inline bool Copy(void) gxFuncThrowsError {
04351 gxassert(_image);
04352 GX_GETHANDLE(h);
04353 GX_GETIMAGE(i);
04354 bool st = gx_imgtoclipboard(h, i) ? true : false;
04355 gxcondthrow(!st);
04356 return st;
04357 }
04358
04361 inline bool Paste(void) gxFuncThrowsError {
04362 gxassert(_image);
04363 GX_GETHANDLE(h);
04364 GX_GETIMAGE(i);
04365 bool st = gx_pasteimage(h, i) ? true : false;
04366 gxcondthrow(!st);
04367 return st;
04368 }
04369 #endif
04370
04375 inline bool FromVariant(
04376 gxVariant GX_REF_CLASS(variant)
04377 ) gxFuncThrowsError {
04378
04379 GX_GETIMAGE(i);
04380 #ifndef GX_DOTNET
04381 bool st = gx_imagefromvariant(&i, variant._variant) ? true : false;
04382 if(st) {
04383 gx_unrefimage(_image);
04384 _image=i;
04385 }
04386 #else
04387 bool st = gx_imagefromvariant(&i,
04388 variant ? variant->_variant : 0 ) ? true : false;
04389 if(st) {
04390 gx_unrefimage(_image);
04391 _set_image(i);
04392 }
04393 #endif
04394 gxcondthrow(!st);
04395 return st;
04396 }
04397
04402 inline GX_INDIRECTION1(gxVariant) ToVariant(gxi32 varid) gxFuncThrowsError {
04403
04404 GX_GETIMAGE(i);
04405 gxVARIANT vari;
04406 bool st = gx_imagetovariant(i, varid, &vari) != 0;
04407 gxcondthrow(!st);
04408 if(!st) return GX_NULLPTR;
04409 GX_INDIRECTION(gxVariant,vr) = gxnew gxVariant(vari);
04410 gx_unrefvariant(vari);
04411 if(!vr){gxSystem::SetError((int)GX_ENUM_PATH(GX_ERROR_CODES) GX_ENOMEM);gxthrow;}
04412 return vr;
04413 }
04414
04415 #if !defined(GX_SWIG) && !defined(GX_DOTNET)
04416
04422 inline gxi32 TestImageFileFormat(const wchar_t *filename) gxFuncThrowsError {
04423 gxassert(filename);
04424 gxi32 fileformat;
04425 bool st = gx_testimagefileformat(filename, &fileformat) ? true : false;
04426 if(!st) { gxthrow; return 0; }
04427 return fileformat;
04428 }
04429
04436 inline gxi32 TestImageFileFormat(const char *filename) gxFuncThrowsError {
04437 gxassert(filename);
04438 gxi32 fileformat;
04439 bool st = gx_testimagefileformat(filename, &fileformat) ? true : false;
04440 if(!st) { gxthrow; return 0; }
04441 return fileformat;
04442 }
04443
04450 inline gxi32 TestImageFileFormat(const void *buffer, gxi32 buflen) gxFuncThrowsError {
04451 gxassert(buffer && buflen>0);
04452 gxi32 fileformat;
04453 bool st = gx_testimagefileformat(buffer, buflen, &fileformat) ? true : false;
04454 if(!st) { gxthrow; return 0; }
04455 return fileformat;
04456 }
04457 #else
04458
04463 inline gxi32 TestImageFileFormat(gxInData buffer) gxFuncThrowsError {
04464 GX_GETDATA(buffer);
04465 gxi32 fileformat;
04466 bool st = gx_testimagefileformat(GX_DATAPTR(buffer), GX_DATALEN(buffer), &fileformat) ? true : false;
04467 GX_FREEDATA(buffer);
04468 if(!st) { gxthrow; return 0; }
04469 return fileformat;
04470 }
04471 #endif
04472
04473 #ifdef GX_UNICODE
04474
04480 inline gxi32 TestImageFileFormat(gxInStr filename) gxFuncThrowsError {
04481 GX_GETSTRING(_filename, filename);
04482 gxi32 fileformat;
04483 bool st = gx_testimagefileformat(_filename, &fileformat) ? true : false;
04484 if(!st) { gxthrow; return 0; }
04485 return fileformat;
04486 }
04487 #endif
04488
04489 #ifdef GX_ASCII
04490
04496 inline gxi32 TestImageFileFormat(gxInAStr filename) gxFuncThrowsError {
04497 GX_GETASTRING(_filename, filename);
04498 gxi32 fileformat;
04499 bool st = gx_testimagefileformat(_filename, &fileformat) ? true : false;
04500 if(!st) { gxthrow; return 0; }
04501 return fileformat;
04502 }
04503 #endif
04504
04505 };
04506
04507 #endif
04508
04509 #endif
04510
04511 #ifdef GX_NAMESPACES
04512 }
04513 #endif
04514 #ifdef __BORLANDC__
04515 #pragma warn .rch
04516 #endif
04517
04518 #endif
04519