问题描述:

I am currently rendering an array of unsigned integers to a 2D image on a window, however, it is far too slow for what I want to accomplish with it. Here is my code:

int x = 0;

int y = 0;

GC gc;

XGCValues gcv;

gc = XCreateGC(display, drawable, GCForeground, &gcv);

while (y < height) {

while (x < width) {

XSetForeground(display, gc, AlphaBlend(pixels[(width*y)+x], backcolor));

XDrawPoint(display, drawable, gc, x, y);

x++;

}

x = 0;

y++;

}

XFlush(display);

I was wondering if anyone show me a much faster method for doing this while still using my unsigned integer array as the base image to draw to the window as well as keeping it within the X11 API. I want to keep it as freestanding as possible. I don't want to use OpenGL, SDL or any other extra graphics libraries I do not need. Thank you.

相关阅读:
Top