1916 break; 1917 1918 case PathIterator.SEG_CLOSE: 1919 closeSubpath(); 1920 break; 1921 } 1922 1923 1924 pathIter.next(); 1925 } 1926 } 1927 1928 /* 1929 * Fill the path defined by {@code pathIter} 1930 * with the specified color. 1931 * The path is provided in current user space. 1932 */ 1933 protected void deviceFill(PathIterator pathIter, Color color, 1934 AffineTransform tx, Shape clip) { 1935 1936 setTransform(tx); 1937 setClip(clip); 1938 setColor(color); 1939 convertToPSPath(pathIter); 1940 /* Specify the path to fill as the clip, this ensures that only 1941 * pixels which are inside the path will be filled, which is 1942 * what the Java 2D APIs specify 1943 */ 1944 mPSStream.println(GSAVE_STR); 1945 selectClipPath(); 1946 fillPath(); 1947 mPSStream.println(GRESTORE_STR + " " + NEWPATH_STR); 1948 } 1949 1950 /* 1951 * Run length encode byte array in a form suitable for decoding 1952 * by the PS Level 2 filter RunLengthDecode. 1953 * Array data to encode is inArr. Encoded data is written to outArr 1954 * outArr must be long enough to hold the encoded data but this 1955 * can't be known ahead of time. | 1916 break; 1917 1918 case PathIterator.SEG_CLOSE: 1919 closeSubpath(); 1920 break; 1921 } 1922 1923 1924 pathIter.next(); 1925 } 1926 } 1927 1928 /* 1929 * Fill the path defined by {@code pathIter} 1930 * with the specified color. 1931 * The path is provided in current user space. 1932 */ 1933 protected void deviceFill(PathIterator pathIter, Color color, 1934 AffineTransform tx, Shape clip) { 1935 1936 if (Double.isNaN(tx.getScaleX()) || 1937 Double.isNaN(tx.getScaleY()) || 1938 Double.isNaN(tx.getShearX()) || 1939 Double.isNaN(tx.getShearY()) || 1940 Double.isNaN(tx.getTranslateX()) || 1941 Double.isNaN(tx.getTranslateY())) { 1942 return; 1943 } 1944 setTransform(tx); 1945 setClip(clip); 1946 setColor(color); 1947 convertToPSPath(pathIter); 1948 /* Specify the path to fill as the clip, this ensures that only 1949 * pixels which are inside the path will be filled, which is 1950 * what the Java 2D APIs specify 1951 */ 1952 mPSStream.println(GSAVE_STR); 1953 selectClipPath(); 1954 fillPath(); 1955 mPSStream.println(GRESTORE_STR + " " + NEWPATH_STR); 1956 } 1957 1958 /* 1959 * Run length encode byte array in a form suitable for decoding 1960 * by the PS Level 2 filter RunLengthDecode. 1961 * Array data to encode is inArr. Encoded data is written to outArr 1962 * outArr must be long enough to hold the encoded data but this 1963 * can't be known ahead of time. |