当arm目标的crosscopilation时Imlib2错误

时间:2013-03-04 12:36:11

标签: embedded arm x11 cross-compiling embedded-linux

我正在尝试将x11移植到arm处理器。所以我使用Imlib2库为jpeg图片。我已成功交叉编译Imlib2库与x windows到arm.My示例程序也成功构建。但是当我运行二进制jpeg没有正确显示。(它显示图像上传错误);

include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <Imlib2.h>
int main(int argc, char **argv)
{
    Imlib_Image img;
    Display *dpy;
    Pixmap pix;
    Window root;
    Screen *scn;
    int width, height;
    const char *filename = NULL;

    if (argc < 2)
        return 0;
    filename = argv[1];

    img = imlib_load_image(filename);
    printf("img values %x",img);

    if (!img) {
        fprintf(stderr, "%s:Unable to load image\n", filename);
        return 0;
    }
    imlib_context_set_image(img);
    width = imlib_image_get_width();
    height = imlib_image_get_height();

    dpy = XOpenDisplay(NULL);
    if (!dpy)
        return 0;
    scn = DefaultScreenOfDisplay(dpy);
    root = DefaultRootWindow(dpy);

    pix = XCreatePixmap(dpy, root, width, height,
        DefaultDepthOfScreen(scn));
printf("caal");
    imlib_context_set_display(dpy);
    imlib_context_set_visual(DefaultVisualOfScreen(scn));
    imlib_context_set_colormap(DefaultColormapOfScreen(scn));
    imlib_context_set_drawable(pix);

    imlib_render_image_on_drawable(0, 0);

    Window w = XCreateSimpleWindow(dpy, root, 0, 0, width, height, 0, None, None);
    XSelectInput(dpy, w, ExposureMask); 
    XMapWindow(dpy, w);
    //XCopyPlane(dpy, pix, w, gc, 0, 0, width, height, 0, 0, DefaultDepthOfScreen(scn));
    XFlush(dpy);




    XSetWindowBackgroundPixmap(dpy, w, pix);
    XClearWindow(dpy, root);

    XEvent ev;
    while (XNextEvent(dpy, &ev)) { 

        if( ev.type == Expose )
        {
            //XCopyPlane(dpy, pix, w, gc, 0, 0, width, height, 0, 0, DefaultDepthOfScreen(scn));
            printf("Expose called\n");
        }
    }
    sleep(20);

    XFreePixmap(dpy, pix);
    imlib_free_image();
    XCloseDisplay(dpy);
    return 0;

    fprintf(stderr, "usage: %s <image_file>\n", argv[0]);
    return 1;
}

0 个答案:

没有答案