- GrReadArea(drawable, srcX, srcY, width, height,
- pixels);
-
-
- for(x = 0; x < sinfo.cols; x++) {
-
- pp = (unsigned char *)pixels +
- ((x + (y * sinfo.cols)) *
- sizeof(GR_PIXELVAL));
-
- switch(sinfo.pixtype) {
- /* FIXME: These may need modifying on big endian. */
- case MWPF_TRUECOLOR0888:
- case MWPF_TRUECOLOR888:
- rgb[0] = pp[2];
- rgb[1] = pp[1];
- rgb[2] = pp[0];
- break;
- case MWPF_PALETTE:
- rgb[0] = palette->palette[pp[0]].r;
- rgb[1] = palette->palette[pp[0]].g;
- rgb[2] = palette->palette[pp[0]].b;
- break;
- case MWPF_TRUECOLOR565:
- rgb[0] = pp[1] & 0xf8;
- rgb[1] = ((pp[1] & 0x07) << 5) |
- ((pp[0] & 0xe0) >> 3);
- rgb[2] = (pp[0] & 0x1f) << 3;
- break;
- case MWPF_TRUECOLOR555:
- rgb[0] = (pp[1] & 0x7c) << 1;
- rgb[1] = ((pp[1] & 0x03) << 6) |
- ((pp[0] & 0xe0) >> 2);
- rgb[2] = (pp[0] & 0x1f) << 3;
- break;
- case MWPF_TRUECOLOR332:
- rgb[0] = pp[0] & 0xe0;
- rgb[1] = (pp[0] & 0x1c) << 3;
- rgb[2] = (pp[0] & 0x03) << 6;
- break;
- default:
- fprintf(stderr, "Unsupported pixel "
- "format\n");
- return 1;
- }
-
- image.SetRGB(x, y, rgb[0], rgb[1], rgb[2]);
-
- }
+ GrReadArea(drawable, srcX, srcY, width, height,
+ pixels);
+
+
+ for(x = 0; x < sinfo.cols; x++) {
+
+ pp = (unsigned char *)pixels +
+ ((x + (y * sinfo.cols)) *
+ sizeof(GR_PIXELVAL));
+
+ switch(sinfo.pixtype) {
+ /* FIXME: These may need modifying on big endian. */
+ case MWPF_TRUECOLOR0888:
+ case MWPF_TRUECOLOR888:
+ rgb[0] = pp[2];
+ rgb[1] = pp[1];
+ rgb[2] = pp[0];
+ break;
+ case MWPF_PALETTE:
+ rgb[0] = palette->palette[pp[0]].r;
+ rgb[1] = palette->palette[pp[0]].g;
+ rgb[2] = palette->palette[pp[0]].b;
+ break;
+ case MWPF_TRUECOLOR565:
+ rgb[0] = pp[1] & 0xf8;
+ rgb[1] = ((pp[1] & 0x07) << 5) |
+ ((pp[0] & 0xe0) >> 3);
+ rgb[2] = (pp[0] & 0x1f) << 3;
+ break;
+ case MWPF_TRUECOLOR555:
+ rgb[0] = (pp[1] & 0x7c) << 1;
+ rgb[1] = ((pp[1] & 0x03) << 6) |
+ ((pp[0] & 0xe0) >> 2);
+ rgb[2] = (pp[0] & 0x1f) << 3;
+ break;
+ case MWPF_TRUECOLOR332:
+ rgb[0] = pp[0] & 0xe0;
+ rgb[1] = (pp[0] & 0x1c) << 3;
+ rgb[2] = (pp[0] & 0x03) << 6;
+ break;
+ default:
+ fprintf(stderr, "Unsupported pixel "
+ "format\n");
+ return 1;
+ }
+
+ image.SetRGB(x, y, rgb[0], rgb[1], rgb[2]);
+
+ }