Changeset 521 for GraphicTest/Packages/bgrabitmap/bgrapolygon.pas
- Timestamp:
- Apr 17, 2019, 12:58:41 AM (5 years ago)
- Location:
- GraphicTest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest
- Property svn:ignore
-
old new 8 8 GraphicTest.lps 9 9 GraphicTest.dbg 10 heaptrclog.trc
-
- Property svn:ignore
-
GraphicTest/Packages/bgrabitmap/bgrapolygon.pas
r494 r521 56 56 color: TExpandedPixel; 57 57 bounds: TRect; 58 end; 59 procedure AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel); 58 fillMode: TFillMode; 59 fillModeOverride: boolean; 60 end; 61 function AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel): integer; overload; 60 62 function CheckRectangleBorderBounds(var x1, y1, x2, y2: single; w: single): boolean; 61 63 procedure InternalAddStroke(const APoints: array of TPointF; AClosed: boolean; AData: Pointer); … … 67 69 constructor Create; 68 70 destructor Destroy; override; 69 procedure AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel);70 procedure AddShape(AShape: TBGRACustomFillInfo; ATexture: IBGRAScanner);71 procedure AddPolygon(const points: array of TPointF; AColor: TBGRAPixel);72 procedure AddPolygon(const points: array of TPointF; ATexture: IBGRAScanner);73 procedure AddPathStroke(APath: TBGRAPath; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); 74 procedure AddPathStroke(APath: TBGRAPath; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); 75 procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); 76 procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); 77 procedure AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel);78 procedure AddPathFill(APath: TBGRAPath; ATexture: IBGRAScanner);79 procedure AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel);80 procedure AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner);81 procedure AddPolylineStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);82 procedure AddPolylineStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);83 procedure AddPolygonStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker);84 procedure AddPolygonStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker);85 procedure AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2, c3: TBGRAPixel);86 procedure AddTriangleLinearMapping(pt1, pt2, pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF);71 function AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel): integer; overload; 72 function AddShape(AShape: TBGRACustomFillInfo; ATexture: IBGRAScanner): integer; overload; 73 function AddPolygon(const points: array of TPointF; AColor: TBGRAPixel): integer; overload; 74 function AddPolygon(const points: array of TPointF; ATexture: IBGRAScanner): integer; overload; 75 procedure AddPathStroke(APath: TBGRAPath; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); overload; 76 procedure AddPathStroke(APath: TBGRAPath; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); overload; 77 procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker); overload; 78 procedure AddPathStroke(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker); overload; 79 function AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel): integer; overload; 80 function AddPathFill(APath: TBGRAPath; ATexture: IBGRAScanner): integer; overload; 81 function AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; AColor: TBGRAPixel): integer; overload; 82 function AddPathFill(APath: TBGRAPath; AMatrix: TAffineMatrix; ATexture: IBGRAScanner): integer; overload; 83 function AddPolylineStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload; 84 function AddPolylineStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload; 85 function AddPolygonStroke(const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload; 86 function AddPolygonStroke(const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker): integer; overload; 87 function AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2, c3: TBGRAPixel): integer; 88 function AddTriangleLinearMapping(pt1, pt2, pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF): integer; 87 89 procedure AddQuadLinearColor(pt1, pt2, pt3, pt4: TPointF; c1, c2, c3, c4: TBGRAPixel); 88 90 procedure AddQuadLinearMapping(pt1, pt2, pt3, pt4: TPointF; texture: IBGRAScanner; tex1, tex2, {%H-}tex3, tex4: TPointF; 89 91 ACulling: TFaceCulling = fcNone); 90 92 procedure AddQuadPerspectiveMapping(pt1, pt2, pt3, pt4: TPointF; texture: IBGRAScanner; tex1, tex2, tex3, tex4: TPointF); 91 procedure AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel); 92 procedure AddEllipse(x, y, rx, ry: single; ATexture: IBGRAScanner); 93 procedure AddEllipseBorder(x, y, rx, ry, w: single; AColor: TBGRAPixel); 94 procedure AddEllipseBorder(x, y, rx, ry, w: single; ATexture: IBGRAScanner); 95 procedure AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []); 96 procedure AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []); 97 procedure AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []); 98 procedure AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []); 99 procedure AddRectangle(x1, y1, x2, y2: single; AColor: TBGRAPixel); 100 procedure AddRectangle(x1, y1, x2, y2: single; ATexture: IBGRAScanner); 101 procedure AddRectangleBorder(x1, y1, x2, y2, w: single; AColor: TBGRAPixel); 102 procedure AddRectangleBorder(x1, y1, x2, y2, w: single; ATexture: IBGRAScanner); 93 function AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel): integer; overload; 94 function AddEllipse(x, y, rx, ry: single; ATexture: IBGRAScanner): integer; overload; 95 function AddEllipseBorder(x, y, rx, ry, w: single; AColor: TBGRAPixel): integer; overload; 96 function AddEllipseBorder(x, y, rx, ry, w: single; ATexture: IBGRAScanner): integer; overload; 97 function AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []): integer; overload; 98 function AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []): integer; overload; 99 function AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions= []): integer; overload; 100 function AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions= []): integer; overload; 101 function AddRectangle(x1, y1, x2, y2: single; AColor: TBGRAPixel): integer; overload; 102 function AddRectangle(x1, y1, x2, y2: single; ATexture: IBGRAScanner): integer; overload; 103 function AddRectangleBorder(x1, y1, x2, y2, w: single; AColor: TBGRAPixel): integer; overload; 104 function AddRectangleBorder(x1, y1, x2, y2, w: single; ATexture: IBGRAScanner): integer; overload; 105 procedure OverrideFillMode(AShapeIndex: integer; AFillMode: TFillMode); 103 106 procedure Draw(dest: TBGRACustomBitmap; ADrawMode: TDrawMode = dmDrawWithTransparency); 107 property ShapeCount: integer read nbShapes; 104 108 end; 105 109 106 110 procedure FillPolyAliased(bmp: TBGRACustomBitmap; points: array of TPointF; 107 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode );111 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true); 108 112 procedure FillPolyAliasedWithTexture(bmp: TBGRACustomBitmap; points: array of TPointF; 109 scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode );113 scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean = true); 110 114 procedure FillPolyAntialias(bmp: TBGRACustomBitmap; points: array of TPointF; 111 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean = false );115 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 112 116 procedure FillPolyAntialiasWithTexture(bmp: TBGRACustomBitmap; points: array of TPointF; 113 scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean = false );117 scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 114 118 115 119 procedure FillEllipseAntialias(bmp: TBGRACustomBitmap; x, y, rx, ry: single; … … 123 127 scan: IBGRAScanner; LinearBlend: boolean = false); 124 128 129 procedure BorderEllipse(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single; 130 c: TBGRAPixel; EraseMode: boolean; drawmode: TDrawMode); 131 procedure BorderEllipseWithTexture(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single; 132 scan: IBGRAScanner; drawmode: TDrawMode); 133 125 134 procedure FillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry: single; 126 options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false );135 options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 127 136 procedure FillRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry: single; 128 options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false );137 options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 129 138 130 139 procedure BorderRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single; 131 options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false );140 options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 132 141 procedure BorderRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single; 133 options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false );142 options: TRoundRectangleOptions; scan: IBGRAScanner; LinearBlend: boolean = false; APixelCenteredCoordinates: boolean = true); 134 143 135 144 procedure BorderAndFillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, rx, ry, w: single; 136 options: TRoundRectangleOptions; bordercolor,fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean );145 options: TRoundRectangleOptions; bordercolor,fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean; APixelCenteredCoordinates: boolean = true); 137 146 138 147 implementation … … 163 172 miny, maxy, minx, maxx, 164 173 densMinX, densMaxX: integer; 174 joinDensity, nextJoinDensity: boolean; 165 175 166 176 density: PDensity; … … 312 322 if optimised then 313 323 begin 324 nextJoinDensity := false; 314 325 for i := 0 to firstScan.nbinter div 2 - 1 do 315 326 begin 327 joinDensity := nextJoinDensity; 316 328 x1 := firstScan.inter[i+i].interX; 317 329 x1b := lastScan.inter[i+i].interX; 318 330 x2 := firstScan.inter[i+i+1].interX; 319 331 x2b := lastScan.inter[i+i+1].interX; 332 nextJoinDensity := not ((i+i+2 >= firstScan.nbInter) or 333 ((firstScan.inter[i+i+2].interX >= x2+1) and 334 (lastScan.inter[i+i+2].interX >= x2b+1))); 320 335 if (abs(x1-x1b)<oneOver512) and (abs(x2-x2b)<oneOver512) and 321 ((i+i+2 >= firstScan.nbInter) or 322 ((firstScan.inter[i+i+2].interX >= x2+1) and 323 (lastScan.inter[i+i+2].interX >= x2b+1))) then 336 not joinDensity and not nextJoinDensity then 324 337 begin 325 338 x1 := (x1+x1b)*0.5; 326 339 x2 := (x2+x2b)*0.5; 340 341 if x1 < minx then x1 := minx; 327 342 ix1 := floor(x1); 328 ix2 := floor(x2); 329 if ix1 < minx then ix1 := minx; 343 344 if x2 >= maxx+1 then 345 begin 346 x2 := maxx+1; 347 ix2 := maxx; 348 end else 349 ix2 := floor(x2); 330 350 if ix2 > maxx then ix2 := maxx; 351 331 352 if ix1>ix2 then continue; 332 353 if ix1=ix2 then … … 600 621 601 622 procedure FillPolyAliased(bmp: TBGRACustomBitmap; points: array of TPointF; 602 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode );623 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean); 603 624 var 604 625 info: TCustomFillPolyInfo; … … 607 628 exit; 608 629 609 info := TOnePassFillPolyInfo.Create(points );630 info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates); 610 631 FillShapeAliased(bmp, info, c, EraseMode, nil, NonZeroWinding, drawmode); 611 632 info.Free; … … 613 634 614 635 procedure FillPolyAliasedWithTexture(bmp: TBGRACustomBitmap; 615 points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode );636 points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; drawmode: TDrawMode; APixelCenteredCoordinates: boolean); 616 637 var 617 638 info: TCustomFillPolyInfo; … … 620 641 exit; 621 642 622 info := TOnePassFillPolyInfo.Create(points );643 info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates); 623 644 FillShapeAliased(bmp, info, BGRAPixelTransparent,False,scan, NonZeroWinding, drawmode); 624 645 info.Free; … … 626 647 627 648 procedure FillPolyAntialias(bmp: TBGRACustomBitmap; points: array of TPointF; 628 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean );649 c: TBGRAPixel; EraseMode: boolean; NonZeroWinding: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 629 650 var 630 651 info: TCustomFillPolyInfo; … … 633 654 exit; 634 655 635 info := TOnePassFillPolyInfo.Create(points );656 info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates); 636 657 FillShapeAntialias(bmp, info, c, EraseMode, nil, NonZeroWinding, LinearBlend); 637 658 info.Free; … … 639 660 640 661 procedure FillPolyAntialiasWithTexture(bmp: TBGRACustomBitmap; 641 points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean );662 points: array of TPointF; scan: IBGRAScanner; NonZeroWinding: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 642 663 var 643 664 info: TCustomFillPolyInfo; … … 646 667 exit; 647 668 648 info := TOnePassFillPolyInfo.Create(points );669 info := TOnePassFillPolyInfo.Create(points, APixelCenteredCoordinates); 649 670 FillShapeAntialiasWithTexture(bmp, info, scan, NonZeroWinding, LinearBlend); 650 671 info.Free; … … 703 724 { TBGRAMultishapeFiller } 704 725 705 procedure TBGRAMultishapeFiller.AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel);726 function TBGRAMultishapeFiller.AddShape(AInfo: TBGRACustomFillInfo; AInternalInfo: boolean; ATexture: IBGRAScanner; AInternalTexture: TObject; AColor: TBGRAPixel): integer; 706 727 begin 707 728 if length(shapes) = nbShapes then 708 729 setlength(shapes, (length(shapes)+1)*2); 709 with shapes[nbShapes] do 730 result := nbShapes; 731 inc(nbShapes); 732 733 with shapes[result] do 710 734 begin 711 735 info := AInfo; … … 714 738 internalTexture:= AInternalTexture; 715 739 color := GammaExpansion(AColor); 716 end;717 inc(nbShapes);740 fillModeOverride:= false; 741 end; 718 742 end; 719 743 … … 740 764 const APoints: array of TPointF; AClosed: boolean; AData: Pointer); 741 765 var pts: ArrayOfTPointF; 766 idxShape: Integer; 742 767 begin 743 768 with TPathStrokeData(AData^) do … … 748 773 pts := Stroker.ComputePolylineAutoCycle(APoints, Width); 749 774 if Texture <> nil then 750 AddPolygon(pts, Texture)775 idxShape := AddPolygon(pts, Texture) 751 776 else 752 AddPolygon(pts, Color); 777 idxShape := AddPolygon(pts, Color); 778 OverrideFillMode(idxShape, fmWinding); 753 779 end; 754 780 end; … … 777 803 end; 778 804 779 procedure TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo; AColor: TBGRAPixel); 780 begin 781 AddShape(AShape,False,nil,nil,AColor); 782 end; 783 784 procedure TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo; 785 ATexture: IBGRAScanner); 786 begin 787 AddShape(AShape,False,ATexture,nil,BGRAPixelTransparent); 788 end; 789 790 procedure TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF; 791 AColor: TBGRAPixel); 792 begin 793 if length(points) <= 2 then exit; 794 AddShape(TOnePassFillPolyInfo.Create(points),True,nil,nil,AColor); 795 end; 796 797 procedure TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF; 798 ATexture: IBGRAScanner); 799 begin 800 if length(points) <= 2 then exit; 801 AddShape(TOnePassFillPolyInfo.Create(points),True,ATexture,nil,BGRAPixelTransparent); 805 function TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo; 806 AColor: TBGRAPixel): integer; 807 begin 808 result := AddShape(AShape,False,nil,nil,AColor); 809 end; 810 811 function TBGRAMultishapeFiller.AddShape(AShape: TBGRACustomFillInfo; 812 ATexture: IBGRAScanner): integer; 813 begin 814 result := AddShape(AShape,False,ATexture,nil,BGRAPixelTransparent); 815 end; 816 817 function TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF; 818 AColor: TBGRAPixel): integer; 819 begin 820 if length(points) <= 2 then exit(-1); 821 result := AddShape(TOnePassFillPolyInfo.Create(points),True,nil,nil,AColor); 822 end; 823 824 function TBGRAMultishapeFiller.AddPolygon(const points: array of TPointF; 825 ATexture: IBGRAScanner): integer; 826 begin 827 if length(points) <= 2 then exit(-1); 828 result := AddShape(TOnePassFillPolyInfo.Create(points),True,ATexture,nil,BGRAPixelTransparent); 802 829 end; 803 830 … … 838 865 end; 839 866 840 procedure TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel);841 begin 842 AddPolygon(APath.ToPoints, AColor);843 end; 844 845 procedureTBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;846 ATexture: IBGRAScanner) ;847 begin 848 AddPolygon(APath.ToPoints, ATexture);849 end; 850 851 procedureTBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;852 AMatrix: TAffineMatrix; AColor: TBGRAPixel) ;853 begin 854 AddPolygon(APath.ToPoints(AMatrix), AColor);855 end; 856 857 procedureTBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath;858 AMatrix: TAffineMatrix; ATexture: IBGRAScanner) ;859 begin 860 AddPolygon(APath.ToPoints(AMatrix), ATexture);861 end; 862 863 procedureTBGRAMultishapeFiller.AddPolylineStroke(867 function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; AColor: TBGRAPixel): integer; 868 begin 869 result := AddPolygon(APath.ToPoints, AColor); 870 end; 871 872 function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; 873 ATexture: IBGRAScanner): integer; 874 begin 875 result := AddPolygon(APath.ToPoints, ATexture); 876 end; 877 878 function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; 879 AMatrix: TAffineMatrix; AColor: TBGRAPixel): integer; 880 begin 881 result := AddPolygon(APath.ToPoints(AMatrix), AColor); 882 end; 883 884 function TBGRAMultishapeFiller.AddPathFill(APath: TBGRAPath; 885 AMatrix: TAffineMatrix; ATexture: IBGRAScanner): integer; 886 begin 887 result := AddPolygon(APath.ToPoints(AMatrix), ATexture); 888 end; 889 890 function TBGRAMultishapeFiller.AddPolylineStroke( 864 891 const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; 865 AStroker: TBGRACustomPenStroker) ;866 begin 867 AddPolygon(AStroker.ComputePolyline(points,AWidth,AColor), AColor);868 end; 869 870 procedureTBGRAMultishapeFiller.AddPolylineStroke(892 AStroker: TBGRACustomPenStroker): integer; 893 begin 894 result := AddPolygon(AStroker.ComputePolyline(points,AWidth,AColor), AColor); 895 end; 896 897 function TBGRAMultishapeFiller.AddPolylineStroke( 871 898 const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; 872 AStroker: TBGRACustomPenStroker); 873 begin 874 AddPolygon(AStroker.ComputePolyline(points,AWidth), ATexture); 875 end; 876 877 procedure TBGRAMultishapeFiller.AddPolygonStroke( 878 const points: array of TPointF; AColor: TBGRAPixel; AWidth: single; 879 AStroker: TBGRACustomPenStroker); 880 begin 881 AddPolygon(AStroker.ComputePolygon(points,AWidth), AColor); 882 end; 883 884 procedure TBGRAMultishapeFiller.AddPolygonStroke( 885 const points: array of TPointF; ATexture: IBGRAScanner; AWidth: single; 886 AStroker: TBGRACustomPenStroker); 887 begin 888 AddPolygon(AStroker.ComputePolygon(points,AWidth), ATexture); 889 end; 890 891 procedure TBGRAMultishapeFiller.AddTriangleLinearColor(pt1, pt2, pt3: TPointF; c1, c2, 892 c3: TBGRAPixel); 899 AStroker: TBGRACustomPenStroker): integer; 900 begin 901 result := AddPolygon(AStroker.ComputePolyline(points,AWidth), ATexture); 902 end; 903 904 function TBGRAMultishapeFiller.AddPolygonStroke(const points: array of TPointF; 905 AColor: TBGRAPixel; AWidth: single; AStroker: TBGRACustomPenStroker): integer; 906 begin 907 result := AddPolygon(AStroker.ComputePolygon(points,AWidth), AColor); 908 end; 909 910 function TBGRAMultishapeFiller.AddPolygonStroke(const points: array of TPointF; 911 ATexture: IBGRAScanner; AWidth: single; AStroker: TBGRACustomPenStroker 912 ): integer; 913 begin 914 result := AddPolygon(AStroker.ComputePolygon(points,AWidth), ATexture); 915 end; 916 917 function TBGRAMultishapeFiller.AddTriangleLinearColor(pt1, pt2, pt3: TPointF; 918 c1, c2, c3: TBGRAPixel): integer; 893 919 var grad: TBGRAGradientTriangleScanner; 894 920 begin 895 921 if (c1 = c2) and (c2 = c3) then 896 AddPolygon([pt1,pt2,pt3],c1)922 result := AddPolygon([pt1,pt2,pt3],c1) 897 923 else 898 924 begin 899 925 grad := TBGRAGradientTriangleScanner.Create(pt1,pt2,pt3, c1,c2,c3); 900 AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,grad,grad,BGRAPixelTransparent);901 end; 902 end; 903 904 procedure TBGRAMultishapeFiller.AddTriangleLinearMapping(pt1, pt2, 905 pt3: TPointF; texture: IBGRAScanner; tex1, tex2, tex3: TPointF);926 result := AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,grad,grad,BGRAPixelTransparent); 927 end; 928 end; 929 930 function TBGRAMultishapeFiller.AddTriangleLinearMapping(pt1, pt2, pt3: TPointF; 931 texture: IBGRAScanner; tex1, tex2, tex3: TPointF): integer; 906 932 var 907 933 mapping: TBGRATriangleLinearMapping; 908 934 begin 909 935 mapping := TBGRATriangleLinearMapping.Create(texture, pt1,pt2,pt3, tex1, tex2, tex3); 910 AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,mapping,mapping,BGRAPixelTransparent);936 result := AddShape(TOnePassFillPolyInfo.Create([pt1,pt2,pt3]),True,mapping,mapping,BGRAPixelTransparent); 911 937 end; 912 938 … … 952 978 end; 953 979 954 procedure TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single; AColor: TBGRAPixel 955 );956 begin 957 AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,nil,nil,AColor);958 end; 959 960 procedureTBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single;961 ATexture: IBGRAScanner) ;962 begin 963 AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,ATexture,nil,BGRAPixelTransparent);964 end; 965 966 procedureTBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;967 AColor: TBGRAPixel) ;968 begin 969 AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,nil,nil,AColor);970 end; 971 972 procedureTBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single;973 ATexture: IBGRAScanner) ;974 begin 975 AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,ATexture,nil,BGRAPixelTransparent);976 end; 977 978 procedure TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; 979 AColor: TBGRAPixel; options: TRoundRectangleOptions);980 begin 981 AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,nil,nil,AColor);982 end; 983 984 procedure TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, ry: single; 985 ATexture: IBGRAScanner; options: TRoundRectangleOptions);986 begin 987 AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,980 function TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single; 981 AColor: TBGRAPixel): integer; 982 begin 983 result := AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,nil,nil,AColor); 984 end; 985 986 function TBGRAMultishapeFiller.AddEllipse(x, y, rx, ry: single; 987 ATexture: IBGRAScanner): integer; 988 begin 989 result := AddShape(TFillEllipseInfo.Create(x,y,rx,ry),True,ATexture,nil,BGRAPixelTransparent); 990 end; 991 992 function TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single; 993 AColor: TBGRAPixel): integer; 994 begin 995 result := AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,nil,nil,AColor); 996 end; 997 998 function TBGRAMultishapeFiller.AddEllipseBorder(x, y, rx, ry, w: single; 999 ATexture: IBGRAScanner): integer; 1000 begin 1001 result := AddShape(TFillBorderEllipseInfo.Create(x,y,rx,ry,w),True,ATexture,nil,BGRAPixelTransparent); 1002 end; 1003 1004 function TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, 1005 ry: single; AColor: TBGRAPixel; options: TRoundRectangleOptions): integer; 1006 begin 1007 result := AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True,nil,nil,AColor); 1008 end; 1009 1010 function TBGRAMultishapeFiller.AddRoundRectangle(x1, y1, x2, y2, rx, 1011 ry: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions): integer; 1012 begin 1013 result := AddShape(TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry,options),True, 988 1014 ATexture,nil,BGRAPixelTransparent); 989 1015 end; 990 1016 991 procedure TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx,992 ry, w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions);993 begin 994 AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,1017 function TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, 1018 w: single; AColor: TBGRAPixel; options: TRoundRectangleOptions): integer; 1019 begin 1020 result := AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True, 995 1021 nil,nil,AColor); 996 1022 end; 997 1023 998 procedureTBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry,999 w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions) ;1000 begin 1001 AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True,1024 function TBGRAMultishapeFiller.AddRoundRectangleBorder(x1, y1, x2, y2, rx, ry, 1025 w: single; ATexture: IBGRAScanner; options: TRoundRectangleOptions): integer; 1026 begin 1027 result := AddShape(TFillBorderRoundRectInfo.Create(x1, y1, x2, y2, rx, ry,w,options),True, 1002 1028 ATexture,nil,BGRAPixelTransparent); 1003 1029 end; 1004 1030 1005 procedureTBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;1006 AColor: TBGRAPixel) ;1007 begin 1008 AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],AColor);1009 end; 1010 1011 procedureTBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single;1012 ATexture: IBGRAScanner) ;1013 begin 1014 AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],ATexture);1015 end; 1016 1017 procedure TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, 1018 w: single; AColor: TBGRAPixel);1031 function TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single; 1032 AColor: TBGRAPixel): integer; 1033 begin 1034 result := AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],AColor); 1035 end; 1036 1037 function TBGRAMultishapeFiller.AddRectangle(x1, y1, x2, y2: single; 1038 ATexture: IBGRAScanner): integer; 1039 begin 1040 result := AddPolygon([PointF(x1,y1),PointF(x2,y1),PointF(x2,y2),PointF(x1,y2)],ATexture); 1041 end; 1042 1043 function TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, w: single; 1044 AColor: TBGRAPixel): integer; 1019 1045 var hw : single; 1020 1046 begin 1021 1047 hw := w/2; 1022 1048 if not CheckRectangleBorderBounds(x1,y1,x2,y2,w) then 1023 AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,AColor) else1024 AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,1049 result := AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,AColor) else 1050 result := AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF, 1025 1051 PointF(x1+hw,y2-hw),PointF(x2-hw,y2-hw),PointF(x2-hw,y1+hw),PointF(x1+hw,y1+hw)],AColor); 1026 1052 end; 1027 1053 1028 procedure TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, 1029 w: single; ATexture: IBGRAScanner);1054 function TBGRAMultishapeFiller.AddRectangleBorder(x1, y1, x2, y2, w: single; 1055 ATexture: IBGRAScanner): integer; 1030 1056 var hw : single; 1031 1057 begin 1032 1058 hw := w/2; 1033 1059 if not CheckRectangleBorderBounds(x1,y1,x2,y2,w) then 1034 AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,ATexture) else1035 AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF,1060 result := AddRectangle(x1-hw,y1-hw,x2+hw,y2+hw,ATexture) else 1061 result := AddPolygon([PointF(x1-hw,y1-hw),PointF(x2+hw,y1-hw),PointF(x2+hw,y2+hw),PointF(x1-hw,y2+hw),EmptyPointF, 1036 1062 PointF(x1+hw,y2-hw),PointF(x2-hw,y2-hw),PointF(x2-hw,y1+hw),PointF(x1+hw,y1+hw)],ATexture); 1063 end; 1064 1065 procedure TBGRAMultishapeFiller.OverrideFillMode(AShapeIndex: integer; 1066 AFillMode: TFillMode); 1067 begin 1068 if AShapeIndex < 0 then exit; 1069 if AShapeIndex >= nbShapes then raise exception.Create('Index out of bounds'); 1070 shapes[AShapeIndex].fillMode := AFillMode; 1071 shapes[AShapeIndex].fillModeOverride := true; 1037 1072 end; 1038 1073 … … 1116 1151 begin 1117 1152 //find intersections 1118 info.ComputeAndSort(cury, inter, nbInter, FillMode=fmWinding);1153 info.ComputeAndSort(cury, inter, nbInter, fillMode=fmWinding); 1119 1154 nbInter := nbInter and not 1; //even 1120 1155 end; … … 1150 1185 if ix2 > densMaxx then densMaxx := ix2; 1151 1186 1152 FillWord(density[ix1-minx],ix2-ix1+1,256); 1187 if ix2 >= ix1 then 1188 FillWord(density[ix1-minx],ix2-ix1+1,256); 1153 1189 end; 1154 1190 end else 1155 1191 {$DEFINE INCLUDE_FILLDENSITY} 1156 1192 {$i density256.inc} 1157 1193 end; … … 1174 1210 bounds: TRect; 1175 1211 1176 xb, yb, yc, j,k: integer;1212 xb, yb, yc, k: integer; 1177 1213 pdest: PBGRAPixel; 1178 1214 1179 1215 curSum,nextSum: ^TCardinalSum; 1180 1216 sums: array of TCardinalSum; 1217 curAlpha: byte; 1181 1218 1182 1219 pdens: PDensity; 1183 w: cardinal;1220 w: UInt32or64; 1184 1221 ec: TExpandedPixel; 1185 1222 count: integer; … … 1188 1225 begin 1189 1226 if nbShapes = 0 then exit; 1227 for k := 0 to nbShapes-1 do 1228 if not shapes[k].fillModeOverride then shapes[k].fillMode:= fillMode; 1229 1190 1230 useAA := Antialiasing and (ADrawMode in [dmDrawWithTransparency,dmLinearBlend]); 1191 1231 if nbShapes = 1 then 1192 1232 begin 1193 1233 if useAA then 1194 FillShapeAntialias(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture, FillMode = fmWinding, ADrawMode=dmLinearBlend) else1195 FillShapeAliased(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture, FillMode = fmWinding, ADrawMode,1234 FillShapeAntialias(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,shapes[0].fillMode = fmWinding, ADrawMode=dmLinearBlend) else 1235 FillShapeAliased(dest,shapes[0].info,GammaCompression(shapes[0].color),False,shapes[0].texture,shapes[0].fillMode = fmWinding, ADrawMode, 1196 1236 AliasingIncludeBottomRight); 1197 1237 exit; … … 1235 1275 AliasingOfs := PointF(-0.0001,-0.0001); 1236 1276 1237 setlength(sums,maxx-minx+ 2); //more for safety1277 setlength(sums,maxx-minx+1); 1238 1278 setlength(shapeRowsList, nbShapes); 1239 1279 … … 1267 1307 end; 1268 1308 1269 rowminx := minx; 1270 rowmaxx := maxx; 1309 if rowminx < minx then rowminx := minx; 1310 if rowmaxx > maxx then rowmaxx := maxx; 1311 1271 1312 if rowminx <= rowmaxx then 1272 1313 begin 1273 if rowminx < minx then rowminx := minx;1274 if rowmaxx > maxx then rowmaxx := maxx;1275 1276 1314 FillChar(sums[rowminx-minx],(rowmaxx-rowminx+1)*sizeof(sums[0]),0); 1277 1315 … … 1298 1336 ec.green := (sumG+sumA shr 1) div sumA; 1299 1337 ec.blue := (sumB+sumA shr 1) div sumA; 1300 if sumA > 255 then sumA := 255;1301 ec.alpha := sumA shl 8 + sumA;1338 if sumA > 255 then curAlpha := 255 else curAlpha := sumA; 1339 ec.alpha := curAlpha shl 8 + curAlpha; 1302 1340 count := 1; 1303 1341 while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB) … … 1309 1347 end; 1310 1348 if count = 1 then 1311 DrawExpandedPixelInlineNoAlphaCheck(pdest,ec, sumA) else1349 DrawExpandedPixelInlineNoAlphaCheck(pdest,ec,curAlpha) else 1312 1350 DrawExpandedPixelsInline(pdest, ec, count ); 1313 1351 inc(pdest,count-1); … … 1330 1368 ec.green := (sumG+sumA shr 1) div sumA; 1331 1369 ec.blue := (sumB+sumA shr 1) div sumA; 1332 if sumA > 255 then sumA := 255;1333 ec.alpha := sumA shl 8 + sumA;1370 if sumA > 255 then curAlpha := 255 else curAlpha := sumA; 1371 ec.alpha := curAlpha shl 8 + curAlpha; 1334 1372 count := 1; 1335 1373 while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB) … … 1342 1380 if count = 1 then 1343 1381 DrawPixelInlineNoAlphaCheck(pdest,GammaCompression(ec)) else 1382 begin 1344 1383 DrawPixelsInline(pdest, GammaCompression(ec), count ); 1345 inc(pdest,count-1); 1384 inc(pdest,count-1); 1385 end; 1346 1386 end; 1347 1387 end; … … 1362 1402 ec.green := (sumG+sumA shr 1) div sumA; 1363 1403 ec.blue := (sumB+sumA shr 1) div sumA; 1364 if sumA > 255 then sumA := 255;1365 ec.alpha := sumA shl 8 + sumA;1404 if sumA > 255 then curAlpha := 255 else curAlpha := sumA; 1405 ec.alpha := curAlpha shl 8 + curAlpha; 1366 1406 count := 1; 1367 1407 while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB) … … 1392 1432 ec.green := (sumG+sumA shr 1) div sumA; 1393 1433 ec.blue := (sumB+sumA shr 1) div sumA; 1394 if sumA > 255 then sumA := 255;1395 ec.alpha := sumA shl 8 + sumA;1434 if sumA > 255 then curAlpha := 255 else curAlpha := sumA; 1435 ec.alpha := curAlpha shl 8 + curAlpha; 1396 1436 count := 1; 1397 1437 while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB) … … 1422 1462 ec.green := (sumG+sumA shr 1) div sumA; 1423 1463 ec.blue := (sumB+sumA shr 1) div sumA; 1424 if sumA > 255 then sumA := 255;1425 ec.alpha := sumA shl 8 + sumA;1464 if sumA > 255 then curAlpha := 255 else curAlpha := sumA; 1465 ec.alpha := curAlpha shl 8 + curAlpha; 1426 1466 count := 1; 1427 1467 while (xb < rowmaxx) and (nextSum^.sumA = sumA) and (nextSum^.sumB = sumB) … … 1454 1494 end; 1455 1495 1496 procedure BorderEllipse(bmp: TBGRACustomBitmap; x, y, rx, ry, w: single; 1497 c: TBGRAPixel; EraseMode: boolean; drawmode: TDrawMode); 1498 var 1499 info: TFillBorderEllipseInfo; 1500 begin 1501 if ((rx = 0) and (ry = 0)) or (w=0) or (x = EmptySingle) or (y = EmptySingle) then 1502 exit; 1503 info := TFillBorderEllipseInfo.Create(x, y, rx, ry, w); 1504 FillShapeAliased(bmp, info, c, EraseMode, nil, False, drawmode); 1505 info.Free; 1506 end; 1507 1508 procedure BorderEllipseWithTexture(bmp: TBGRACustomBitmap; x, y, rx, ry, 1509 w: single; scan: IBGRAScanner; drawmode: TDrawMode); 1510 var 1511 info: TFillBorderEllipseInfo; 1512 begin 1513 if ((rx = 0) and (ry = 0)) or (w=0) or (x = EmptySingle) or (y = EmptySingle) then 1514 exit; 1515 info := TFillBorderEllipseInfo.Create(x, y, rx, ry, w); 1516 FillShapeAliased(bmp, info, BGRAPixelTransparent, False, scan, false, drawmode); 1517 info.Free; 1518 end; 1519 1456 1520 procedure FillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, y2, 1457 rx, ry: single; options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean );1521 rx, ry: single; options: TRoundRectangleOptions; c: TBGRAPixel; EraseMode: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 1458 1522 var 1459 1523 info: TFillRoundRectangleInfo; 1460 1524 begin 1461 1525 if (x1 = x2) or (y1 = y2) then exit; 1462 info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options );1526 info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options, APixelCenteredCoordinates); 1463 1527 FillShapeAntialias(bmp, info, c, EraseMode,nil, False, LinearBlend); 1464 1528 info.Free; … … 1467 1531 procedure FillRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, 1468 1532 y1, x2, y2, rx, ry: single; options: TRoundRectangleOptions; 1469 scan: IBGRAScanner; LinearBlend: boolean );1533 scan: IBGRAScanner; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 1470 1534 var 1471 1535 info: TFillRoundRectangleInfo; 1472 1536 begin 1473 1537 if (x1 = x2) or (y1 = y2) then exit; 1474 info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options );1538 info := TFillRoundRectangleInfo.Create(x1, y1, x2, y2, rx, ry, options, APixelCenteredCoordinates); 1475 1539 FillShapeAntialiasWithTexture(bmp, info, scan, False, LinearBlend); 1476 1540 info.Free; … … 1479 1543 procedure BorderRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, x2, 1480 1544 y2, rx, ry, w: single; options: TRoundRectangleOptions; c: TBGRAPixel; 1481 EraseMode: boolean; LinearBlend: boolean );1545 EraseMode: boolean; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 1482 1546 var 1483 1547 info: TFillShapeInfo; … … 1493 1557 exit; 1494 1558 end; 1495 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options );1559 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates); 1496 1560 FillShapeAntialias(bmp, info, c, EraseMode, nil, False, LinearBlend); 1497 1561 info.Free; … … 1500 1564 procedure BorderRoundRectangleAntialiasWithTexture(bmp: TBGRACustomBitmap; x1, 1501 1565 y1, x2, y2, rx, ry, w: single; options: TRoundRectangleOptions; 1502 scan: IBGRAScanner; LinearBlend: boolean );1566 scan: IBGRAScanner; LinearBlend: boolean; APixelCenteredCoordinates: boolean); 1503 1567 var 1504 1568 info: TFillBorderRoundRectInfo; … … 1514 1578 exit; 1515 1579 end; 1516 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options );1580 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates); 1517 1581 FillShapeAntialiasWithTexture(bmp, info, scan, False, LinearBlend); 1518 1582 info.Free; … … 1521 1585 procedure BorderAndFillRoundRectangleAntialias(bmp: TBGRACustomBitmap; x1, y1, 1522 1586 x2, y2, rx, ry, w: single; options: TRoundRectangleOptions; bordercolor, 1523 fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean );1587 fillcolor: TBGRAPixel; bordertexture,filltexture: IBGRAScanner; EraseMode: boolean; APixelCenteredCoordinates: boolean); 1524 1588 var 1525 1589 info: TFillBorderRoundRectInfo; … … 1527 1591 begin 1528 1592 if (rx = 0) or (ry = 0) then exit; 1529 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options );1593 info := TFillBorderRoundRectInfo.Create(x1, y1, x2,y2, rx, ry, w, options, APixelCenteredCoordinates); 1530 1594 if not EraseMode then 1531 1595 begin
Note:
See TracChangeset
for help on using the changeset viewer.