| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,7 +84,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms, | |||
| 84 | 84 | ||
| 85 | 85 | def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, | |
| 86 | 86 | coordinates, offsets, offsetTrans, facecolors, | |
| 87 | - antialiased, showedges): | ||
| 87 | + antialiased, edgecolors): | ||
| 88 | 88 | cliprect = gc.get_clip_rectangle() | |
| 89 | 89 | clippath, clippath_transform = gc.get_clip_path() | |
| 90 | 90 | gc.draw_quad_mesh(master_transform, | |
@@ -98,7 +98,7 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, | |||
| 98 | 98 | offsetTrans, | |
| 99 | 99 | facecolors, | |
| 100 | 100 | antialiased, | |
| 101 | - showedges) | ||
| 101 | + edgecolors) | ||
| 102 | 102 | ||
| 103 | 103 | def new_gc(self): | |
| 104 | 104 | self.gc.save() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1652,7 +1652,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1652 | 1652 | PyObject* offset_transform; | |
| 1653 | 1653 | PyObject* facecolors; | |
| 1654 | 1654 | int antialiased; | |
| 1655 | - int showedges; | ||
| 1655 | + PyObject* edgecolors; | ||
| 1656 | 1656 | ||
| 1657 | 1657 | CGContextRef cr = self->cr; | |
| 1658 | 1658 | ||
@@ -1662,7 +1662,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1662 | 1662 | return NULL; | |
| 1663 | 1663 | } | |
| 1664 | 1664 | ||
| 1665 | - if(!PyArg_ParseTuple(args, "OOOOiiOOOOii", | ||
| 1665 | + if(!PyArg_ParseTuple(args, "OOOOiiOOOOiO", | ||
| 1666 | 1666 | &master_transform, | |
| 1667 | 1667 | &cliprect, | |
| 1668 | 1668 | &clippath, | |
@@ -1674,7 +1674,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1674 | 1674 | &offset_transform, | |
| 1675 | 1675 | &facecolors, | |
| 1676 | 1676 | &antialiased, | |
| 1677 | - &showedges)) return NULL; | ||
| 1677 | + &edgecolors)) return NULL; | ||
| 1678 | 1678 | ||
| 1679 | 1679 | int ok = 1; | |
| 1680 | 1680 | CGContextSaveGState(cr); | |
@@ -1777,7 +1777,9 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1777 | 1777 | ||
| 1778 | 1778 | size_t Npaths = meshWidth * meshHeight; | |
| 1779 | 1779 | size_t Nfacecolors = (size_t) PyArray_DIM(facecolors, 0); | |
| 1780 | - if ((Nfacecolors == 0 && !showedges) || Npaths == 0) | ||
| 1780 | + size_t Nedgecolors = (size_t) PyArray_DIM(edgecolors, 0); | ||
| 1781 | + | ||
| 1782 | + if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0) | ||
| 1781 | 1783 | { | |
| 1782 | 1784 | /* Nothing to do here */ | |
| 1783 | 1785 | goto exit; | |
@@ -1797,17 +1799,18 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1797 | 1799 | const double b = *(double*)PyArray_GETPTR2(facecolors, 0, 2); | |
| 1798 | 1800 | const double a = *(double*)PyArray_GETPTR2(facecolors, 0, 3); | |
| 1799 | 1801 | CGContextSetRGBFillColor(cr, r, g, b, a); | |
| 1800 | - if (antialiased && !showedges) | ||
| 1802 | + if (antialiased && Nedgecolors == 0) | ||
| 1801 | 1803 | { | |
| 1802 | 1804 | CGContextSetRGBStrokeColor(cr, r, g, b, a); | |
| 1803 | 1805 | } | |
| 1804 | 1806 | } | |
| 1805 | 1807 | ||
| 1806 | - if (showedges) | ||
| 1808 | + if (Nedgecolors == 0) | ||
| 1807 | 1809 | { | |
| 1808 | - CGContextSetRGBStrokeColor(cr, 0, 0, 0, 1); | ||
| 1810 | + edgecolors = facecolors; | ||
| 1809 | 1811 | } | |
| 1810 | 1812 | ||
| 1813 | + | ||
| 1811 | 1814 | double x, y; | |
| 1812 | 1815 | for (ih = 0; ih < meshHeight; ih++) | |
| 1813 | 1816 | { | |
@@ -1854,15 +1857,30 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1854 | 1857 | CGContextAddLines(cr, points, 4); | |
| 1855 | 1858 | CGContextClosePath(cr); | |
| 1856 | 1859 | ||
| 1860 | + if (Nedgecolors > 0) | ||
| 1861 | + { | ||
| 1862 | + npy_intp ei = i % Nedgecolors; | ||
| 1863 | + const double e_r = *(double*)PyArray_GETPTR2(edgecolors, ei, 0); | ||
| 1864 | + const double e_g = *(double*)PyArray_GETPTR2(edgecolors, ei, 1); | ||
| 1865 | + const double e_b = *(double*)PyArray_GETPTR2(edgecolors, ei, 2); | ||
| 1866 | + const double e_a = *(double*)PyArray_GETPTR2(edgecolors, ei, 3); | ||
| 1867 | + | ||
| 1868 | + CGContextSetRGBStrokeColor(cr, e_r, e_g, e_b, e_a); | ||
| 1869 | + } | ||
| 1870 | + else | ||
| 1871 | + { | ||
| 1872 | + CGContextSetRGBStrokeColor(cr, 0, 0, 0, 1); | ||
| 1873 | + } | ||
| 1874 | + | ||
| 1857 | 1875 | if (Nfacecolors > 1) | |
| 1858 | 1876 | { | |
| 1859 | 1877 | npy_intp fi = i % Nfacecolors; | |
| 1860 | 1878 | const double r = *(double*)PyArray_GETPTR2(facecolors, fi, 0); | |
| 1861 | 1879 | const double g = *(double*)PyArray_GETPTR2(facecolors, fi, 1); | |
| 1862 | 1880 | const double b = *(double*)PyArray_GETPTR2(facecolors, fi, 2); | |
| 1863 | 1881 | const double a = *(double*)PyArray_GETPTR2(facecolors, fi, 3); | |
| 1864 | - CGContextSetRGBFillColor(cr, r, g, b, a); | ||
| 1865 | - if (showedges) | ||
| 1882 | + | ||
| 1883 | + if (Nedgecolors > 0) | ||
| 1866 | 1884 | { | |
| 1867 | 1885 | CGContextDrawPath(cr, kCGPathFillStroke); | |
| 1868 | 1886 | } | |
@@ -1878,7 +1896,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1878 | 1896 | } | |
| 1879 | 1897 | else if (Nfacecolors==1) | |
| 1880 | 1898 | { | |
| 1881 | - if (showedges || antialiased) | ||
| 1899 | + if (Nedgecolors > 0 || antialiased) | ||
| 1882 | 1900 | { | |
| 1883 | 1901 | CGContextDrawPath(cr, kCGPathFillStroke); | |
| 1884 | 1902 | } | |
@@ -1887,7 +1905,7 @@ static BOOL _clip(CGContextRef cr, PyObject* object) | |||
| 1887 | 1905 | CGContextFillPath(cr); | |
| 1888 | 1906 | } | |
| 1889 | 1907 | } | |
| 1890 | - else if (showedges) | ||
| 1908 | + else if (Nedgecolors > 0) | ||
| 1891 | 1909 | { | |
| 1892 | 1910 | CGContextStrokePath(cr); | |
| 1893 | 1911 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments