/** \file * \brief Image Resource. * * See Copyright Notice in "iup.h" */ #include #include #include #include #include #include "iup.h" #include "iup_object.h" #include "iup_attrib.h" #include "iup_str.h" #include "iup_image.h" #include "iup_drvinfo.h" #include "iupmot_drv.h" #include "iupmot_color.h" void iupdrvImageGetRawData(void* handle, unsigned char* imgdata) { Pixmap pixmap = (Pixmap)handle; int w, h, y, x, bpp; XImage *xi; if (!iupdrvImageGetInfo(handle, &w, &h, &bpp)) return; if (bpp==8) return; xi = XGetImage(iupmot_display, pixmap, 0, 0, w, h, ULONG_MAX, ZPixmap); if (xi) { /* planes are separated in imgdata */ int planesize = w*h; unsigned char *r = imgdata, *g = imgdata+planesize, *b = imgdata+2*planesize; for (y=0; ycurrentwidth, height = ih->currentheight; unsigned char *imgdata = (unsigned char*)iupAttribGetStr(ih, "WID"); Pixmap pixmap; unsigned char bg_r=0, bg_g=0, bg_b=0; GC gc; Pixel color2pixel[256]; bpp = iupAttribGetInt(ih, "BPP"); iupStrToRGB(bgcolor, &bg_r, &bg_g, &bg_b); if (bpp == 8) { int i, colors_count = 0; iupColor colors[256]; iupImageInitColorTable(ih, colors, &colors_count); for (i=0;icurrentwidth, height = ih->currentheight, line_size = (width+7)/8, size_bytes = line_size*height; unsigned char *imgdata = (unsigned char*)iupAttribGetStr(ih, "WID"); char *sbits, *mbits, *sb, *mb; Pixmap source, mask; XColor fg, bg; unsigned char r, g, b; Cursor cursor; bpp = iupAttribGetInt(ih, "BPP"); if (bpp > 8) return NULL; sbits = (char*)malloc(2*size_bytes); if (!sbits) return NULL; memset(sbits, 0, 2*size_bytes); mbits = sbits + size_bytes; sb = sbits; mb = mbits; for (y=0; ycurrentwidth, height = ih->currentheight, line_size = (width+7)/8, size_bytes = line_size*height; unsigned char *imgdata = (unsigned char*)iupAttribGetStr(ih, "WID"); char *bits, *sb; Pixmap mask; unsigned char colors[256]; bpp = iupAttribGetInt(ih, "BPP"); if (bpp > 8) return NULL; bits = (char*)malloc(size_bytes); if (!bits) return NULL; memset(bits, 0, size_bytes); iupImageInitNonBgColors(ih, colors); sb = bits; for (y=0; y