클라이언트 측 버퍼에서 서버 측 RGBA 픽스맵을 만들려고합니다. 일치 오류 32 및 24 비트에 대한 확인 CreatePixmap & createImage의 작업,하지만 XPutImage 결과는 서버에서 반환32 비트 이미지를 서버 측 픽스맵에 업로드하는 방법
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 (X.Org 버전 : 1.11.3)와 X.app (X.Org 버전 : 1.10.3)를 사용하는 OSX에서 동일한 동작
왜 다음 코드가 실패합니까?
#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의 픽스맵과 관련된 사용 GC을 반환하는
#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 비트 gc가 필요하고 32 비트 gc를 만들려면 32 비트 드로어 블이 필요합니다. 기본 시각적으로 32 비트 깊이가 있습니까? –
다음 주에 내가 다시 일하러 갈 때 나는 당신에게 대답 할 것이고, 이제 나는 휴가 중이다. 나는 그걸 찾을거야? – filipehd
감사! 그게 절대로 급한 일이 아니야 –