| 1915 | return self.image_dpi/72.0 |
| 1916 | |
| 1917 | def draw_image(self, gc, x, y, im, transform=None): |
| 1918 | # docstring inherited |
| 1919 | |
| 1920 | h, w = im.shape[:2] |
| 1921 | if w == 0 or h == 0: |
| 1922 | return |
| 1923 | |
| 1924 | if transform is None: |
| 1925 | # If there's no transform, alpha has already been applied |
| 1926 | gc.set_alpha(1.0) |
| 1927 | |
| 1928 | self.check_gc(gc) |
| 1929 | |
| 1930 | w = 72.0 * w / self.image_dpi |
| 1931 | h = 72.0 * h / self.image_dpi |
| 1932 | |
| 1933 | imob = self.file.imageObject(im) |
| 1934 | |
| 1935 | if transform is None: |
| 1936 | self.file.output(Op.gsave, |
| 1937 | w, 0, 0, h, x, y, Op.concat_matrix, |
| 1938 | imob, Op.use_xobject, Op.grestore) |
| 1939 | else: |
| 1940 | tr1, tr2, tr3, tr4, tr5, tr6 = transform.frozen().to_values() |
| 1941 | |
| 1942 | self.file.output(Op.gsave, |
| 1943 | 1, 0, 0, 1, x, y, Op.concat_matrix, |
| 1944 | tr1, tr2, tr3, tr4, tr5, tr6, Op.concat_matrix, |
| 1945 | imob, Op.use_xobject, Op.grestore) |
| 1946 | |
| 1947 | def draw_path(self, gc, path, transform, rgbFace=None): |
| 1948 | # docstring inherited |