在x11中,我通过使用XGetImage获得了二进制blob。
在GDK中,我们有这个函数可以将255的alpha加到Pixbuf中:https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Utilities.html#gdk-pixbuf-add-alpha
我想知道在X11中是否有像这样方便的函数。
所以我有一个这样的结构:
typedef struct _XImage {
int width, height; /* size of image */
int xoffset; /* number of pixels offset in X direction */
int format; /* XYBitmap, XYPixmap, ZPixmap */
char *data; /* pointer to image data */
int byte_order; /* data byte order, LSBFirst, MSBFirst */
int bitmap_unit; /* quant. of scanline 8, 16, 32 */
int bitmap_bit_order; /* LSBFirst, MSBFirst */
int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
int depth; /* depth of image */
int bytes_per_line; /* accelerator to next scanline */
int bits_per_pixel; /* bits per pixel (ZPixmap) */
unsigned long red_mask; /* bits in z arrangement */
unsigned long green_mask;
unsigned long blue_mask;
XPointer obdata; /* hook for the object routines to hang on */
struct funcs { /* image manipulation routines */
struct _XImage *(*create_image)();
int (*destroy_image)();
unsigned long (*get_pixel)();
int (*put_pixel)();
struct _XImage *(*sub_image)();
int (*add_pixel)();
} f;
} XImage;在ximage.data字段中,我有RGB二进制数据。我正在帮助一个朋友,我需要创建RGBA二进制数据。
谢谢
发布于 2016-01-12 20:08:28
不幸的是,没有像GDK中那样的抽象。
您必须通过迭代*char数据成员来手动完成此操作。
https://stackoverflow.com/questions/31481664
复制相似问题