当前位置: 动力学知识库 > 问答 > 编程问答 >

c - X11 - Graphics Rendering Improvement

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: