İstemci tarafı arabelleğinden sunucu tarafı RGBA pixmap oluşturmaya çalışıyorum. Maç Hata 32 ve 24 bit ok CreatePixmap & CreateImage çalışır, ancak XPutImage sonuç sunucusu tarafından döndürülenSunucu tarafı için 32 bit görüntü nasıl yüklenir pixmap
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
sunucusu desteği 32 bitlik pixmaps'i (çıkış xdpyinfo: https://gist.github.com/2582961) yapar. Ubuntu 12.04 (X.Org sürümü: 1.11.3) ve OSX, X.app ile aynı davranış (X.Org sürümü: 1.10.3)
Neden kod başarısız oluyor?
#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);
}
}
Güncelleme: Bu Sonunda var gibi cevap arar: (kök penceresinin derinliğe sahiptir) yerine DefaultGC ait pixmap ile ilişkili kullanım GC bir geri dönme
#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);
}
}
Şimdi tavuk ve yumurta sorunum var - 32 bit pix oluşturmak için 32 bit gc'ye ve 32 bit gc oluşturmak için 32 bit çekilebilirliğe ihtiyacım var. Varsayılan görsel için 32 bit derinliğiniz var mı? –
Gelecek hafta tekrar işe geri döndüğümde size cevap vereceğim, çünkü şimdi tatile gidiyorum. Bunu iyi arayacağım mı? – filipehd
Teşekkürler! Bu hiçbir şekilde acil –