पर 32 बिट छवि को अपलोड करने के लिए मैं क्लाइंट-साइड बफर से सर्वर-साइड आरजीबीए पिक्समैप बनाने की कोशिश कर रहा हूं। CreatePixmap & CreateImage काम 32 और 24 बिट के लिए ठीक है, लेकिन मैच त्रुटि में XPutImage परिणाम सर्वर द्वारा लौटाएसर्वर-साइड पिक्समैप
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 72 (X_PutImage)
Serial number of failed request: 8
Current serial number in output stream: 8
सर्वर समर्थन 32 बिट पिक्समैप (उत्पादन xdpyinfo: https://gist.github.com/2582961) करता है। यूबंटू 12.04 (एक्स.ऑर्ग संस्करण: 1.11.3) और ओएसएक्स एक्स.एप (एक्स.ऑर्ग संस्करण: 1.10.3)
पर निम्नलिखित व्यवहार क्यों विफल रहता है?
#include <stdlib.h>
#include <X11/Xlib.h>
int main(int argc, char **argv)
{
int width = 100;
int height = 100;
int depth = 32; // works fine with depth = 24
int bitmap_pad = 32; // 32 for 24 and 32 bpp, 16, for 15&16
int bytes_per_line = 0; // number of bytes in the client image between the start of one scanline and the start of the next
Display *display=XOpenDisplay(0);
unsigned char *image32=(unsigned char *)malloc(width*height*4);
XImage *img = XCreateImage(display, CopyFromParent, depth, ZPixmap, 0, image32, width, height, bitmap_pad, bytes_per_line);
Pixmap p = XCreatePixmap(display, XDefaultRootWindow(display), width, height, depth);
XPutImage(display, p, DefaultGC(display, 0), img, 0, 0, 0, 0, width, height); // 0, 0, 0, 0 are src x,y and dst x,y
XEvent ev;
while (1) {
XNextEvent(display, &ev);
}
}
अद्यतन: यह जवाब है कि मैं अंत में मिल गया दिखता है: उपयोग जीसी DefaultGC के बजाय पिक्समैप के साथ जुड़े (जो जड़ खिड़की की गहराई है)
#include <stdlib.h>
#include <X11/Xlib.h>
int main(int argc, char **argv)
{
int width = 100;
int height = 100;
int depth = 32; // works fine with depth = 24
int bitmap_pad = 32; // 32 for 24 and 32 bpp, 16, for 15&16
int bytes_per_line = 0; // number of bytes in the client image between the start of one scanline and the start of the next
Display *display=XOpenDisplay(0);
unsigned char *image32=(unsigned char *)malloc(width*height*4);
XImage *img = XCreateImage(display, CopyFromParent, depth, ZPixmap, 0, image32, width, height, bitmap_pad, bytes_per_line);
Pixmap p = XCreatePixmap(display, XDefaultRootWindow(display), width, height, depth);
XGCValues gcvalues;
GC gc = XCreateGC(display, p, 0, &gcvalues);
XPutImage(display, p, gc, img, 0, 0, 0, 0, width, height); // 0, 0, 0, 0 are src x,y and dst x,y
XEvent ev;
while (1) {
XNextEvent(display, &ev);
}
}
अब मेरे पास चिकन और अंडे की समस्या है - 32 बिट जीसी बनाने के लिए 32 बिट पिक्समैप और 32 बिट ड्रॉबल बनाने के लिए मुझे 32 बिट जीसी की आवश्यकता है। क्या आपके पास डिफ़ॉल्ट दृश्य के लिए 32 बिट गहराई है? –
मैं अगले सप्ताह आपको जवाब दूंगा जब मैं फिर से काम पर वापस जाऊंगा, क्योंकि अब मैं छुट्टियों पर हूं। मैं ठीक हूँ? – filipehd
धन्यवाद! इसका कोई मतलब नहीं है –