1

色付き(赤のrgb)の長方形を背景にしたpdfドキュメントがあり、その後、マスク(モノクロ)として別の画像を含む画像(rgb画像)が適用されます。

cairoライブラリで適用する正しい演算子が見つかりません。

どうすればいいのか、ヒントを教えていただけますか?

私は次のことをしました:

//load the image from file 
image = cairo_image_surface_create_from_png(".\image.png");

image_width = cairo_image_surface_get_width(image);     
image_height = cairo_image_surface_get_height(image);     
cairo_set_source_surface(cr, wndImage, 0, 0); 

//create a rectangle and color with red    
cairo_rectangle(cr, 0, 0, w, h);     
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);    
cairo_fill(cr);    
cairo_paint(cr); 

//load the mask from file and applied the image and mask to the destination    
mask = cairo_image_surface_create_from_png(".\mask.png");     
cairo_set_source_surface(cr, image, 0, 0);     
cairo_mask_surface(cr, mask, 0, 0);
cairo_paint (cr);

PDFには次のものが含まれています。

5 0 obj 
<< 
/ImageMask true 
/Type/XObject/Subtype/Image
/BitsPerComponent 1
/Width 2487
/Height 3512
/ColorSpace/DeviceGray 
/DecodeParms<</Columns 2487/K -1>>/Filter/CCITTFaxDecode /Length 17518>>

6 0 obj 
<< 
/Mask 5 0 R 
/Type/XObject/Subtype/Image
/BitsPerComponent 8
/Width 1244
/Height 1756
/ColorSpace /DeviceRGB 
/Filter/DCTDecode /Length 162581>> 

7 0 obj << /Length 107>> stream 
1 0 0 rg 
0 -3.12 595 846 re 
f 
q 
597.12 0 0 842.88 0 0 cm 
/I2 Do Q 0 g 0 G 0 Tr 0 Tc 0 Tw 100 Tz 1 w [] 0 d endstream endobj
4

0 に答える 0