Surface (surface)
图形系统的核心对象,表示一个 32 位预乘 ARGB 像素缓冲。
结构体
struct surface_t {
int width;
int height;
int stride;
int pixlen;
void * pixels;
struct render_t * r;
void * rctx;
void * g2d;
void * priv;
};
创建与加载
| 函数 | 说明 |
|---|---|
surface_alloc(width, height) | 创建空白 Surface |
surface_alloc_from_xfs(ctx, filename) | 从 XFS 加载图像 |
surface_alloc_from_buf(buf, len) | 从内存缓冲加载 |
surface_alloc_qrcode(pixsz, fmt, ...) | 生成二维码 Surface |
surface_free(s) | 释放 Surface |
surface_clone(s, x, y, w, h) | 克隆子区域 |
surface_extend(s, w, h, type) | 扩展尺寸 |