<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">I did some more research and ltrace'd
      pdftocairo --pdf and --png.</div>
    <div class="moz-cite-prefix">There is no obvious difference in the
      cairo call that generate the highlight.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Next, I compared the cairo commands
      producing the first highlight ("small") with those of the second
      highlight ("Virtual Mechanics"). Apart from some differing
      address, the only major difference is an additional
      cairo_pattern_destroy:<br>
    </div>
    <div class="moz-cite-prefix"><font face="monospace"><br>
      </font></div>
    <font face="monospace">[...cairo_clip, etc....]<br>
      // CairoOutputDev::beginTransparencyGroup<br>
      //
<a class="moz-txt-link-freetext" href="https://github.com/freedesktop/poppler/blob/bc4a0d9a2abfcd75d9b0ee4be3f7600905fe6001/poppler/CairoOutputDev.cc#L906">https://github.com/freedesktop/poppler/blob/bc4a0d9a2abfcd75d9b0ee4be3f7600905fe6001/poppler/CairoOutputDev.cc#L906</a><br>
      cairo_get_matrix(0x56e2e080, 0x56eabc08, 2, 0xf7095466) 
                     = 0x56eabc08<br>
      cairo_push_group(0x56e2e080, 0x56eabc08, 2,
      0xf7095466)                 = 0<br>
      cairo_set_operator(0x56e2e080, 2, 2,
      0xf7095466)                        = 0<br>
      cairo_save(0x56e2e080, 0, 0xf79509a9,
      0xf7b55184)                       = 0<br>
      cairo_pattern_reference(0x56e2e830, 0, 0xf79509a9,
      0xf7b55184)          = 0x56e2e830<br>
      cairo_pattern_reference(0x56e2e830, 0, 0xf79509a9,
      0xf7b55184)          = 0x56e2e830<br>
      cairo_pattern_get_type(0x56e2e830, 0x56eac04c, 0xffd4a260,
      0xf791e9f8)  = 0<br>
      cairo_pattern_destroy(0x56e2e830, 0x56eac04c, 0xffd4a260,
      0xf791e9f8)   = 10<br>
      <br>
      cairo_pattern_create_rgba(0, 0x3ff00000, 0,
      0x3ff00000)                 = 0x56eab410<br>
      cairo_new_path(0x56e2e080, 0, 0,
      7)                                     = 0<br>
      cairo_move_to(0x56e2e080, 0x28f5c290, 0x405b5f5c,
      0x51eb851f)           = 0<br>
      cairo_curve_to(0x56e2e080, 0xcccccccd, 0x405acccc,
      0xc28f5c29)          = 0<br>
      cairo_line_to(0x56e2e080, 0xeb851eb8, 0x40614851,
      0x8f5c28f6)           = 0<br>
      cairo_curve_to(0x56e2e080, 0x9999999a, 0x40619199,
      0x1eb851eb)          = 0<br>
      cairo_set_fill_rule(0x56e2e080, 0, 0x56eabfd0,
      0x56eabbb0)              = 0<br>
      cairo_set_source(0x56e2e080, 0x56eab410, 0x56eabfd0,
      0x56eabbb0)        = 0<br>
      cairo_fill(0x56e2e080, 0x56eab410, 0x56eabfd0,
      0x56eabbb0)              = 0<br>
      cairo_restore(0x56e2e080, 744, 0xf78ea873,
      0x56594bdc)                  = 0<br>
      cairo_pattern_destroy(0x56eab410, 744, 0xf78ea873,
      0x56594bdc)          = 0<br>
      cairo_pattern_destroy(0x56e2e830, 744, 0xf78ea873,
      0x56594bdc)          = 9<br>
      <br>
      cairo_set_operator(0x56e2e080, 2, 2,
      0x565abb00)                        = 0<br>
      // Next line is only present for the second highlight  ->
      CairoOutputDev::endTransparencyGroup<br>
        cairo_pattern_destroy(0x56e30cd0, 0xf78ffab0, 0xf78f46b9,
      0xf7b55184)   = 0<br>
      cairo_pop_group(0x56e2e080, 0xf78ffab0, 0xf78f46b9,
      0xf7b55184)         = 0x56e30cd0  // (retval same for both!)<br>
      cairo_restore(0x56e2e080, 0xf78ffab0, 0xf78f25e9,
      0x56594bdc)           = 0<br>
      cairo_pattern_destroy(0x56e2e830, 0xf78ffab0, 0xf78f25e9,
      0x56594bdc)   = 8<br>
      cairo_pattern_destroy(0x56e2e830, 0xf78ffab0, 0xf78f25e9,
      0x56594bdc)   = 7<br>
      <br>
      // CairoOutputDev::paintTransparencyGroup<br>
      cairo_set_operator(0x56e2e080, 14, 0xf7b55184,
      0x565abb00)              = 0<br>
      cairo_save(0x56e2e080, 0xffd4a6e4, 0xf78f4889,
      0x56597a6c)              = 0<br>
      cairo_set_matrix(0x56e2e080, 0x56eabc08, 0xf78f4889,
      0x56597a6c)        = 0<br>
      cairo_set_source(0x56e2e080, 0x56e30cd0, 0xf78f4889,
      0x56597a6c)        = 0<br>
      cairo_paint_with_alpha(0x56e2e080, 0, 0x3ff00000,
      0x56597a6c)           = 0<br>
      cairo_status(0x56e2e080, 0, 0x3ff00000,
      0x56597a6c)                     = 0<br>
      _ZdlPvj(0x56eabc00, 60, 0x3ff00000,
      0x56597a6c)                         = 0<br>
      cairo_restore(0x56e2e080, 60, 0x3ff00000,
      0x56597a6c)                   = 0<br>
      <br>
      cairo_restore(0x56e2e080, 32, 0xf78f25e9,
      0x56594bdc)                   = 0<br>
      cairo_pattern_destroy(0x56e2e830, 32, 0xf78f25e9,
      0x56594bdc)           = 6<br>
      cairo_pattern_destroy(0x56e2e830, 32, 0xf78f25e9,
      0x56594bdc)           = 5<br>
      <br>
      cairo_set_operator(0x56e2e080, 2, 0xf7b55184,
      0x565abb00)               = 0<br>
      cairo_restore(0x56e2e080, 744, 0xffd4add4,
      0x56594bdc)                  = 0<br>
      cairo_pattern_destroy(0x56e2e830, 744, 0xffd4add4,
      0x56594bdc)          = 4<br>
      cairo_pattern_destroy(0x56e2e830, 744, 0xffd4add4,
      0x56594bdc)          = 3</font><br>
    <br>
    <div class="moz-cite-prefix">I believe cairo_set_operator(,14,) in
      paintTransparencyGroup should output a gs change in BOTH cases,
      but it's only for the first case when using a PDF surface; OTOH,
      when the context is backed by a Image surface,
      CAIRO_OPERATOR_MULTIPLY is honored also for the second
      highlight...</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">  Tobias<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 03/11/2022 14:53, Tobias Hoffmann
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:a4f6fb9a-d16d-30b3-d483-846356c81b81@thax.hardliners.org">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">
        <div class="moz-cite-prefix">cairo 1.16.0 also exhibits the
          problem.<br>
        </div>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">AFAICT the difference between "small"
        and "Virtual Mechanics" in the content stream (obj 4) is that
        only for the "small" an additional "/b14 gs" command is present:<br>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">[...]<br>
      </div>
      <div class="moz-cite-prefix">q<br>
        106.926 93.812 33.621 13.883 re W n<br>
        /b14 gs<br>
        q<br>
        1 0 0 1 106 93 cm<br>
        /a0 gs /x7 Do<br>
        Q<br>
        Q q<br>
        148.605 117.57 83.879 14.02 re W n<br>
        q<br>
        1 0 0 1 148 117 cm<br>
        /a0 gs /x8 Do<br>
        Q<br>
        Q</div>
      <div class="moz-cite-prefix">[...]</div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">The ExtGState definitions says:</div>
      <div class="moz-cite-prefix">/a0 <<<br>
          /CA 1<br>
          /ca 1<br>
        >></div>
      <div class="moz-cite-prefix">/b14 <<<br>
          /BM /Multiply<br>
        >></div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">Adding /b14 gs to drawing of the
        second XObject (i.e. /x8) fixes the output.</div>
      <div class="moz-cite-prefix"><br>
      </div>
      Maybe someone with more knowledge about cairo's pdf surface and/or
      pdftocairo can help here?
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">  Tobias<br>
      </div>
      <br>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">On 03/11/2022 13:47, Beckmann Urs
        (ID) wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:f46755f73b634df9bfd19577f0ae8b1e@id.ethz.ch">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
        <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal"><span lang="EN-US">Dear Cairo developers<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">The attached pdf
              small-sample-with-comments.pdf gives incorrect output from
              pdftocairo -pdf.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">The yellow stripe
              covers the text “Virtual Mechanics”, instead of being
              transparent. Text “small” instead remains correctly not
              covered after pdftocairo -pdf.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">pdftocairo -png and
              pdftocairo -ps give correct results. It looks like the
              problem comes from cairo pdf output engine.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Tested with
              cairo-version 1.17.4<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Kind regards<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Urs<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
      </blockquote>
      <p><br>
      </p>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>