我想以最简单的方式做的是获得一个像对象一样的简单帧缓冲区。
详细说明,我希望能够编写像
这样的代码typedef struct {
...
uint32_t stride; // Number of items to skip to get to same pixel on row below
uint32_t *pixels; // Pixel data
...
} framebuffer_thing;
#define PX(x,y) ((stride * (y))+(x))
void updateFb(framebuffer_thing);
myfunc(framebuffer_thing f) {
for(i=0;i<100;i++) f.fb[PX(10+i,20+i)]=0xff000000+i*0x00010000; // To write pixels into my buffer
updateFb(f); // To update the display if necessary
}
理想情况下,我也希望从Python中交互使用它。有没有人知道执行此操作的代码已经有效,或者如何编写它?