CairoCanvas: Allow saving TCairoSVGCanvas to a stream. Support Pen.Mode pmXor. Issues #35425,#30293. Patch from Anton Kavalenka.

git-svn-id: trunk@61052 -
This commit is contained in:
juha 2019-04-24 19:45:35 +00:00
parent 0a6a5d2b43
commit c966415648

View File

@ -246,9 +246,9 @@ begin
cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
end; end;
pmCopy: cairo_set_operator(cr, CAIRO_OPERATOR_OVER); pmCopy: cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
pmXor: cairo_set_operator(cr, CAIRO_OPERATOR_XOR); { pmXor: cairo_set_operator(cr, CAIRO_OPERATOR_XOR);
pmNotXor: cairo_set_operator(cr, CAIRO_OPERATOR_XOR); pmNotXor: cairo_set_operator(cr, CAIRO_OPERATOR_XOR);
{ pmNop, pmNop,
pmNot, pmNot,
pmCopy, pmCopy,
pmNotCopy, pmNotCopy,
@ -1614,7 +1614,10 @@ end;
function TCairoSvgCanvas.CreateCairoHandle: HDC; function TCairoSvgCanvas.CreateCairoHandle: HDC;
begin begin
//Sizes are in Points, 72DPI (1pt = 1/72") //Sizes are in Points, 72DPI (1pt = 1/72")
sf := cairo_svg_surface_create(PChar(FOutputFileName), PaperWidth*ScaleX, PaperHeight*ScaleY); if fStream<>nil then
sf := cairo_svg_surface_create_for_stream(@WriteToStream, fStream, PaperWidth*ScaleX, PaperHeight*ScaleY)
else
sf := cairo_svg_surface_create(PChar(FOutputFileName), PaperWidth*ScaleX, PaperHeight*ScaleY);
result := {%H-}HDC(cairo_create(sf)); result := {%H-}HDC(cairo_create(sf));
end; end;