Mercurial > geeqie.yaz
comparison src/print.c @ 121:045ac4c27e62
Fri Dec 1 14:27:55 2006 John Ellis <johne@verizon.net>
* print.c (print_job_ps_page_image): Use a white mask when printing
transparent images, fixes bug #1426596.
author | gqview |
---|---|
date | Fri, 01 Dec 2006 19:41:45 +0000 |
parents | 17acca639a86 |
children | 71e1ebee420e |
comparison
equal
deleted
inserted
replaced
120:f0ecfb80be38 | 121:045ac4c27e62 |
---|---|
65 /* default dpi to use for printing ps image data */ | 65 /* default dpi to use for printing ps image data */ |
66 #define PRINT_PS_DPI_DEFAULT 300.0 | 66 #define PRINT_PS_DPI_DEFAULT 300.0 |
67 #define PRINT_PS_DPI_MIN 150.0 | 67 #define PRINT_PS_DPI_MIN 150.0 |
68 /* method to use when scaling down image data */ | 68 /* method to use when scaling down image data */ |
69 #define PRINT_PS_MAX_INTERP GDK_INTERP_BILINEAR | 69 #define PRINT_PS_MAX_INTERP GDK_INTERP_BILINEAR |
70 /* color to use as mask when printing transparent images */ | |
71 #define PRINT_PS_MASK_R 255 | |
72 #define PRINT_PS_MASK_G 255 | |
73 #define PRINT_PS_MASK_B 255 | |
70 | 74 |
71 /* padding between objects */ | 75 /* padding between objects */ |
72 #define PRINT_TEXT_PADDING 3.0 | 76 #define PRINT_TEXT_PADDING 3.0 |
73 | 77 |
74 /* locale for postscript portability */ | 78 /* locale for postscript portability */ |
1230 gint rowstride; | 1234 gint rowstride; |
1231 guchar *pix; | 1235 guchar *pix; |
1232 gint i, j; | 1236 gint i, j; |
1233 gint c; | 1237 gint c; |
1234 guchar *p; | 1238 guchar *p; |
1239 guchar bps_buf[3]; | |
1235 gint ret; | 1240 gint ret; |
1236 | 1241 |
1237 if (!pixbuf) return TRUE; | 1242 if (!pixbuf) return TRUE; |
1238 | 1243 |
1239 f = print_job_ps_fd(pw); | 1244 f = print_job_ps_fd(pw); |
1278 for (j = 0; j < sh; j++) | 1283 for (j = 0; j < sh; j++) |
1279 { | 1284 { |
1280 p = pix + j * rowstride; | 1285 p = pix + j * rowstride; |
1281 for (i = 0; i < sw; i++) | 1286 for (i = 0; i < sw; i++) |
1282 { | 1287 { |
1283 print_job_ps_page_image_pixel(f, p); | 1288 if (bps == 3) |
1289 { | |
1290 print_job_ps_page_image_pixel(f, p); | |
1291 } | |
1292 else | |
1293 { | |
1294 bps_buf[0] = (p[0] * p[3] + PRINT_PS_MASK_R * (256 - p[3])) >> 8; | |
1295 bps_buf[1] = (p[1] * p[3] + PRINT_PS_MASK_G * (256 - p[3])) >> 8; | |
1296 bps_buf[2] = (p[2] * p[3] + PRINT_PS_MASK_B * (256 - p[3])) >> 8; | |
1297 print_job_ps_page_image_pixel(f, bps_buf); | |
1298 } | |
1284 p+=bps; | 1299 p+=bps; |
1285 c++; | 1300 c++; |
1286 if (c > 11) | 1301 if (c > 11) |
1287 { | 1302 { |
1288 fprintf(f, "\n"); | 1303 fprintf(f, "\n"); |