Note that there are some explanatory texts on larger screens.

plurals
  1. POImage with image mask
    primarykey
    data
    text
    <p>I have a pdf document which has as background a colored(red rgb) rectangle and after that it is applied an image(rgb image) which contains another image as mask(monochrome).</p> <p>I cannot find the correct operator to apply on that with cairo library.</p> <p>Could you give some hints how should i do that?</p> <p>I have done the following: </p> <pre><code>//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); </code></pre> <p>The pdf contains that following:</p> <pre><code>5 0 obj &lt;&lt; /ImageMask true /Type/XObject/Subtype/Image /BitsPerComponent 1 /Width 2487 /Height 3512 /ColorSpace/DeviceGray /DecodeParms&lt;&lt;/Columns 2487/K -1&gt;&gt;/Filter/CCITTFaxDecode /Length 17518&gt;&gt; 6 0 obj &lt;&lt; /Mask 5 0 R /Type/XObject/Subtype/Image /BitsPerComponent 8 /Width 1244 /Height 1756 /ColorSpace /DeviceRGB /Filter/DCTDecode /Length 162581&gt;&gt; 7 0 obj &lt;&lt; /Length 107&gt;&gt; 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 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload