private void simpleNonCyclicFillRaster(int pixels[],int off,int adjust,int x,int y,int w,int h){
  float rowX=(a00 * x) + (a01 * y) + constA;
  float rowY=(a10 * x) + (a11 * y) + constB;
  float gDeltaDelta=this.gDeltaDelta;
  adjust+=w;
  int rgbclip=gradient[fastGradientArraySize];
  for (int j=0; j < h; j++) {
    float gRel=(rowX * rowX + rowY * rowY) / radiusSq;
    float gDelta=(2 * (a00 * rowX + a10 * rowY) / radiusSq + gDeltaDelta / 2);
    int i=0;
    while (i < w && gRel >= 1.0f) {
      pixels[off + i]=rgbclip;
      gRel+=gDelta;
      gDelta+=gDeltaDelta;
      i++;
    }
    while (i < w && gRel < 1.0f) {
      int gIndex;
      if (gRel <= 0) {
        gIndex=0;
      }
 else {
        float fIndex=gRel * SQRT_LUT_SIZE;
        int iIndex=(int)(fIndex);
        float s0=sqrtLut[iIndex];
        float s1=sqrtLut[iIndex + 1] - s0;
        fIndex=s0 + (fIndex - iIndex) * s1;
        gIndex=(int)(fIndex * fastGradientArraySize);
      }
      pixels[off + i]=gradient[gIndex];
      gRel+=gDelta;
      gDelta+=gDeltaDelta;
      i++;
    }
    while (i < w) {
      pixels[off + i]=rgbclip;
      i++;
    }
    off+=adjust;
    rowX+=a01;
    rowY+=a11;
  }
}

private void simpleNonCyclicFillRaster ( int pixels [ ] , int off , int adjust , int x , int y , int w , int h ) { float rowX = ( a00 * x ) + ( a01 * y ) + constA ; float rowY = ( a10 * x ) + ( a11 * y ) + constB ; float gDeltaDelta = this . gDeltaDelta ; adjust += w ; int rgbclip = gradient [ fastGradientArraySize ] ; for ( int j = 0 ; j < h ; j ++ ) { float gRel = ( rowX * rowX + rowY * rowY ) / radiusSq ; float gDelta = ( 2 * ( a00 * rowX + a10 * rowY ) / radiusSq + gDeltaDelta / 2 ) ; int i = 0 ; while ( i < w && gRel >= 1.0f ) { pixels [ off + i ] = rgbclip ; gRel += gDelta ; gDelta += gDeltaDelta ; i ++ ; } while ( i < w && gRel < 1.0f ) { int gIndex ; if ( gRel <= 0 ) { gIndex = 0 ; } else { float fIndex = gRel * SQRT_LUT_SIZE ; int iIndex = ( int ) ( fIndex ) ; float s0 = sqrtLut [ iIndex ] ; float s1 = sqrtLut [ iIndex + 1 ] - s0 ; fIndex = s0 + ( fIndex - iIndex ) * s1 ; gIndex = ( int ) ( fIndex * fastGradientArraySize ) ; } pixels [ off + i ] = gradient [ gIndex ] ; gRel += gDelta ; gDelta += gDeltaDelta ; i ++ ; } while ( i < w ) { pixels [ off + i ] = rgbclip ; i ++ ; } off += adjust ; rowX += a01 ; rowY += a11 ; } }
this code works in the simplest of cases , where the focus = = center point , the gradient is noncyclic , and the gradient lookup method is fast ( single array index , no conversion necessary ) .
