< prev index next >

src/java.desktop/share/classes/sun/java2d/pisces/Helpers.java

Print this page




 222             throw new InternalError("Unsupported curve type");
 223         }
 224     }
 225 
 226     static void isort(float[] a, int off, int len) {
 227         for (int i = off + 1; i < off + len; i++) {
 228             float ai = a[i];
 229             int j = i - 1;
 230             for (; j >= off && a[j] > ai; j--) {
 231                 a[j+1] = a[j];
 232             }
 233             a[j+1] = ai;
 234         }
 235     }
 236 
 237     // Most of these are copied from classes in java.awt.geom because we need
 238     // float versions of these functions, and Line2D, CubicCurve2D,
 239     // QuadCurve2D don't provide them.
 240     /**
 241      * Subdivides the cubic curve specified by the coordinates
 242      * stored in the <code>src</code> array at indices <code>srcoff</code>
 243      * through (<code>srcoff</code>&nbsp;+&nbsp;7) and stores the
 244      * resulting two subdivided curves into the two result arrays at the
 245      * corresponding indices.
 246      * Either or both of the <code>left</code> and <code>right</code>
 247      * arrays may be <code>null</code> or a reference to the same array
 248      * as the <code>src</code> array.
 249      * Note that the last point in the first subdivided curve is the
 250      * same as the first point in the second subdivided curve. Thus,
 251      * it is possible to pass the same array for <code>left</code>
 252      * and <code>right</code> and to use offsets, such as <code>rightoff</code>
 253      * equals (<code>leftoff</code> + 6), in order
 254      * to avoid allocating extra storage for this common point.
 255      * @param src the array holding the coordinates for the source curve
 256      * @param srcoff the offset into the array of the beginning of the
 257      * the 6 source coordinates
 258      * @param left the array for storing the coordinates for the first
 259      * half of the subdivided curve
 260      * @param leftoff the offset into the array of the beginning of the
 261      * the 6 left coordinates
 262      * @param right the array for storing the coordinates for the second
 263      * half of the subdivided curve
 264      * @param rightoff the offset into the array of the beginning of the
 265      * the 6 right coordinates
 266      * @since 1.7
 267      */
 268     static void subdivideCubic(float src[], int srcoff,
 269                                float left[], int leftoff,
 270                                float right[], int rightoff)
 271     {
 272         float x1 = src[srcoff + 0];
 273         float y1 = src[srcoff + 1];




 222             throw new InternalError("Unsupported curve type");
 223         }
 224     }
 225 
 226     static void isort(float[] a, int off, int len) {
 227         for (int i = off + 1; i < off + len; i++) {
 228             float ai = a[i];
 229             int j = i - 1;
 230             for (; j >= off && a[j] > ai; j--) {
 231                 a[j+1] = a[j];
 232             }
 233             a[j+1] = ai;
 234         }
 235     }
 236 
 237     // Most of these are copied from classes in java.awt.geom because we need
 238     // float versions of these functions, and Line2D, CubicCurve2D,
 239     // QuadCurve2D don't provide them.
 240     /**
 241      * Subdivides the cubic curve specified by the coordinates
 242      * stored in the {@code src} array at indices {@code srcoff}
 243      * through ({@code srcoff}&nbsp;+&nbsp;7) and stores the
 244      * resulting two subdivided curves into the two result arrays at the
 245      * corresponding indices.
 246      * Either or both of the {@code left} and {@code right}
 247      * arrays may be {@code null} or a reference to the same array
 248      * as the {@code src} array.
 249      * Note that the last point in the first subdivided curve is the
 250      * same as the first point in the second subdivided curve. Thus,
 251      * it is possible to pass the same array for {@code left}
 252      * and {@code right} and to use offsets, such as {@code rightoff}
 253      * equals ({@code leftoff} + 6), in order
 254      * to avoid allocating extra storage for this common point.
 255      * @param src the array holding the coordinates for the source curve
 256      * @param srcoff the offset into the array of the beginning of the
 257      * the 6 source coordinates
 258      * @param left the array for storing the coordinates for the first
 259      * half of the subdivided curve
 260      * @param leftoff the offset into the array of the beginning of the
 261      * the 6 left coordinates
 262      * @param right the array for storing the coordinates for the second
 263      * half of the subdivided curve
 264      * @param rightoff the offset into the array of the beginning of the
 265      * the 6 right coordinates
 266      * @since 1.7
 267      */
 268     static void subdivideCubic(float src[], int srcoff,
 269                                float left[], int leftoff,
 270                                float right[], int rightoff)
 271     {
 272         float x1 = src[srcoff + 0];
 273         float y1 = src[srcoff + 1];


< prev index next >