0

In x11 I have obtained the binary blob by using XGetImage.

In GDK we have this function that adds alpha of 255 to the Pixbuf: https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Utilities.html#gdk-pixbuf-add-alpha

I was wondering if there is a convenient function like this in X11.

So I have a struct like this:

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;

And in the ximage.data field I have RGB binary data. Im helping a friend and I need to make that RGBA binary data.

Thanks

yatg
  • 1,121
  • 1
  • 9
  • 15

1 Answers1

0

Unfortually there is no such abstraction as in GDK.

You have to do it manually by iterating on the *char data member.

Thomas Leclercq
  • 425
  • 3
  • 10