… | |
… | |
65 | gdk_pixbuf_get_height (pb) |
65 | gdk_pixbuf_get_height (pb) |
66 | ); |
66 | ); |
67 | |
67 | |
68 | img->render_pixbuf (pb, 0, 0, img->w, img->h, 0, 0); |
68 | img->render_pixbuf (pb, 0, 0, img->w, img->h, 0, 0); |
69 | |
69 | |
|
|
70 | g_object_unref (pb); |
|
|
71 | |
70 | return img; |
72 | return img; |
71 | } |
73 | } |
72 | |
74 | |
73 | rxvt_img::~rxvt_img () |
75 | rxvt_img::~rxvt_img () |
74 | { |
76 | { |
… | |
… | |
291 | |
293 | |
292 | int rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
294 | int rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
293 | int channels = gdk_pixbuf_get_n_channels (pixbuf); |
295 | int channels = gdk_pixbuf_get_n_channels (pixbuf); |
294 | unsigned char *row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
296 | unsigned char *row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
295 | char *line = ximage->data; |
297 | char *line = ximage->data; |
296 | |
|
|
297 | rgba c (0, 0, 0); |
|
|
298 | |
|
|
299 | if (channels == 4 && alpha_mask == 0) |
|
|
300 | { |
|
|
301 | //pix_colors[Color_bg].get (c); |
|
|
302 | //TODO |
|
|
303 | c.r = 0xffff; c.g = 0xc0c0; c.b = 0xcbcb;//D |
|
|
304 | c.r >>= 8; |
|
|
305 | c.g >>= 8; |
|
|
306 | c.b >>= 8; |
|
|
307 | } |
|
|
308 | |
298 | |
309 | for (int y = 0; y < height; y++) |
299 | for (int y = 0; y < height; y++) |
310 | { |
300 | { |
311 | for (int x = 0; x < width; x++) |
301 | for (int x = 0; x < width; x++) |
312 | { |
302 | { |
… | |
… | |
315 | unsigned char r, g, b, a; |
305 | unsigned char r, g, b, a; |
316 | |
306 | |
317 | if (channels == 4) |
307 | if (channels == 4) |
318 | { |
308 | { |
319 | a = pixel[3]; |
309 | a = pixel[3]; |
320 | r = (pixel[0] * a + c.r * (0xff - a)) / 0xff; |
310 | r = pixel[0] * a / 0xff; |
321 | g = (pixel[1] * a + c.g * (0xff - a)) / 0xff; |
311 | g = pixel[1] * a / 0xff; |
322 | b = (pixel[2] * a + c.b * (0xff - a)) / 0xff; |
312 | b = pixel[2] * a / 0xff; |
323 | } |
313 | } |
324 | else |
314 | else |
325 | { |
315 | { |
326 | a = 0xff; |
316 | a = 0xff; |
327 | r = pixel[0]; |
317 | r = pixel[0]; |