(int width, int height)
| 1835 | /// |
| 1836 | /// new image instance scaled to the given height and width |
| 1837 | Image scaledImpl(int width, int height) { |
| 1838 | if (width == -1) { |
| 1839 | return scaledHeight(height); |
| 1840 | } |
| 1841 | if (height == -1) { |
| 1842 | return scaledWidth(width); |
| 1843 | } |
| 1844 | Dimension d = new Dimension(width, height); |
| 1845 | Image i = getCachedImage(d); |
| 1846 | if (i != null) { |
| 1847 | return i; |
| 1848 | } |
| 1849 | |
| 1850 | if (svgData != null) { |
| 1851 | try { |
| 1852 | i = createSVG(svgBaseURL, animated, svgData); |
| 1853 | } catch (IOException ex) { |
| 1854 | i = new Image(this.image); |
| 1855 | } |
| 1856 | } else { |
| 1857 | i = new Image(this.image); |
| 1858 | } |
| 1859 | i.scaleCache = scaleCache; |
| 1860 | i.scale(width, height); |
| 1861 | i.transform = this.transform; |
| 1862 | i.animated = animated; |
| 1863 | i.svgBaseURL = svgBaseURL; |
| 1864 | i.svgData = svgData; |
| 1865 | cacheImage(new Dimension(width, height), i); |
| 1866 | return i; |
| 1867 | } |
| 1868 | |
| 1869 | /// Resizes/crops the image so that its center fills the given dimensions. This is similar to `com.codename1.ui.plaf.Style#BACKGROUND_IMAGE_SCALED_FILL` |
| 1870 | /// |
no test coverage detected