-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
使用者可能使用不同的方式构建 img。比如:
#define ENA 0 /* Enable Alpha channel or not */
#define NX 256 /* Number of X points */
#define NY 256 /* Number of Y points */
#define NCH (3+ENA) /* Number of Channels */
enum Channel { R, G, B, A };
typedef uint8_t Pixel[NCH];
void fun(FILE *fp)
{
Pixel img[NX][NY];
unsigned x, y;
for (x = 0; x < NX; ++x) {
for (y = 0; y < NY; ++y) {
img[x][y][R] = x;
img[x][y][G] = y;
img[x][y][B] = 128;
}
}
svpng(fp, NX, NY, (unsigned char *) img, ENA);
}为了避免在 img 前的强制转换,也许可以将其参数类型定为 void *。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels