[cairo] Pixel consistency? (testing)

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 18 06:39:15 PDT 2009


I've done a bit more work in this direction, and I'd like to know if
this would be more useful to you than the script output.

In
http://cgit.freedesktop.org/~ickle/cairo/commit/?h=wip/stroke-to-path&id=af99ead4347ac39f920fb41b3b03f087e4c0fcef
is a very simple XML surface that is merely a (hierarchical) sequence of
backend operations:

%!CairoScript
<< /content //COLOR_ALPHA /width 48 /height 48 >> surface context
<< /width 48 /height 48 /format //ARGB32 /source <|!$hOEGb"0;!=]#/!5bE':MgS#TE"rlz!.\,Q,QIfF~> >> image dup /s6 exch def pattern
  set-source
paint
62.625 4.625 0 62.625 4.625 10.625 radial
  0 0 0 0 0.560784 add-color-stop
  1 0 0 0 0 add-color-stop
  [0.465144 0 0 1.143301 51.810401 -38.238731] set-matrix
  set-source
//EVEN_ODD set-fill-rule
n 46.09375 37.492188 m 46.09375 42.625 35.867188 46.785156 23.25 46.785156 c 10.632812 46.785156 0.40625 42.625 0.40625 37.492188 c 0.40625 32.359375 10.632812 28.199219 23.25 28.199219 c 35.867188 28.199219 46.09375 32.359375 46.09375 37.492188 c h 46.09375 37.492188 m
fill+
62.199219 -8.726562 0 62.199219 -8.726562 9.753906 radial
  0 0.560784 0.694118 0.862745 1 add-color-stop
  1 0.203922 0.396078 0.643137 1 add-color-stop
  [0.414436 0.000000000000000807 -0.000000000000000807 0.414427 52.416639 -13.694174] set-matrix
  set-source
//WINDING set-fill-rule
n 43.503906 23.199219 m 43.503906 34.1875 34.597656 43.097656 23.609375 43.097656 c 12.617188 43.097656 3.710938 34.1875 3.710938 23.199219 c 3.710938 12.210938 12.617188 3.300781 23.609375 3.300781 c 34.597656 3.300781 43.503906 12.210938 43.503906 23.199219 c h 43.503906 23.199219 m
fill+
0.12549 0.290196 0.529412 rgb set-source
2.149872 2.149872 scale
0.465144 set-line-width
4 set-miter-limit
stroke+

becomes:

<surface content='COLOR_ALPHA' width='48' height='48'>
  <paint op='OVER'>
    <source extend='EXTEND_NONE' filter='FILTER_GOOD'>
      <image width='48' height='48' format='ARGB32'>M,6r;%14!\!!!!.8Ou6I!!!!Q!!!!Q#R18/!*96tLB%;S#%C4q6id5errE(l]r.%o!!"*46pXdcJaL8S!<<*"Jft)sDFd"nzz0*W[U!!/,G^h3WI!!#SZ:.26O@"J</image>
    </source>
  </paint>
  <fill op='OVER' fill_rule='EVEN_ODD'>
    <source extend='EXTEND_PAD' filter='FILTER_GOOD'>
      <matrix>0.465144 0 0 1.143301 51.810402 -38.238731</matrix>
      <radial x1='62.625' y1='4.625' r1='0' x2='62.625' y2='4.625' r2='10.625'>
        <stop offset='0'>0 0 0 0.560784</stop>
        <stop offset='1'>0 0 0 0</stop>
      </radial>
    </source>
    <path tolerance='0.1' antialias='ANTIALIAS_DEFAULT'> 46.09375 37.492188 m 46.09375 42.625 35.867188 46.785156 23.25 46.785156 c 10.632812 46.785156 0.40625 42.625 0.40625 37.492188 c 0.40625 32.359375 10.632812 28.199219 23.25 28.199219 c 35.867188 28.199219 46.09375 32.359375 46.09375 37.492188 c h 46.09375 37.492188 m</path>
  </fill>
  <fill op='OVER' fill_rule='WINDING'>
    <source extend='EXTEND_PAD' filter='FILTER_GOOD'>
      <matrix>0.414436 0.000000000000000807 -0.000000000000000807 0.414427 52.416637 -13.694174</matrix>
      <radial x1='62.199219' y1='-8.726562' r1='0' x2='62.199219' y2='-8.726562' r2='9.753906'>
        <stop offset='0'>0.560784 0.694118 0.862745 1</stop>
        <stop offset='1'>0.203922 0.396078 0.643137 1</stop>
      </radial>
    </source>
    <path tolerance='0.1' antialias='ANTIALIAS_DEFAULT'> 43.503906 23.199219 m 43.503906 34.1875 34.597656 43.097656 23.609375 43.097656 c 12.617188 43.097656 3.710938 34.1875 3.710938 23.199219 c 3.710938 12.210938 12.617188 3.300781 23.609375 3.300781 c 34.597656 3.300781 43.503906 12.210938 43.503906 23.199219 c h 43.503906 23.199219 m</path>
  </fill>
  <stroke op='OVER' width='0.465144' cap='LINE_CAP_BUTT' join='LINE_JOIN_MITER' miter='4'>
    <source extend='EXTEND_PAD' filter='FILTER_GOOD'>
      <solid>0.12549 0.290196 0.529412 1</solid>
    </source>
    <matrix>2.149872 0 0 2.149872 0 0</matrix>
    <path tolerance='0.1' antialias='ANTIALIAS_DEFAULT'> 43.503906 23.199219 m 43.503906 34.1875 34.597656 43.097656 23.609375 43.097656 c 12.617188 43.097656 3.710938 34.1875 3.710938 23.199219 c 3.710938 12.210938 12.617188 3.300781 23.609375 3.300781 c 34.597656 3.300781 43.503906 12.210938 43.503906 23.199219 c h 43.503906 23.199219 m</path>
  </stroke>
</surface>

The idea is that this is much easier to interpret than SVG (in
particular with a view to state bisection, we should be able to operate
on each operation independently) and has no impedance-mismatch - i.e. it
should be able to express natively everything Cairo can do. I'm writing
it so that I can track down a regression, but it may prove useful in
your test suite.
-ickle



More information about the cairo mailing list