/** * Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into * consideration when drawing the gradient. Notice that this method differs from * fillRadialGradient since it draws a square gradient at all times and can thus be cached Notice * that a radial gradient will result in a circular shape, to create a square use fillRect or draw * a larger shape and clip to the appropriate size. * * @param startColor the starting RGB color * @param endColor the ending RGB color * @param x the x coordinate * @param y the y coordinate * @param width the width of the region to be filled * @param height the height of the region to be filled * @param relativeX indicates the relative position of the gradient within the drawing region * @param relativeY indicates the relative position of the gradient within the drawing region * @param relativeSize indicates the relative size of the gradient within the drawing region */ public void fillRectRadialGradient( int startColor, int endColor, int x, int y, int width, int height, float relativeX, float relativeY, float relativeSize) { // people do that a lot sadly... if (startColor == endColor) { setColor(startColor); fillRect(x, y, width, height, (byte) 0xff); return; } impl.fillRectRadialGradient( nativeGraphics, startColor, endColor, x + xTranslate, y + yTranslate, width, height, relativeX, relativeY, relativeSize); }
/** * Draws a linear gradient in the given coordinates with the given colors, doesn't take alpha into * consideration when drawing the gradient * * @param startColor the starting RGB color * @param endColor the ending RGB color * @param x the x coordinate * @param y the y coordinate * @param width the width of the region to be filled * @param height the height of the region to be filled * @param horizontal indicating wheter it is a horizontal fill or vertical */ public void fillLinearGradient( int startColor, int endColor, int x, int y, int width, int height, boolean horizontal) { // people do that a lot sadly... if (startColor == endColor) { setColor(startColor); fillRect(x, y, width, height, (byte) 0xff); return; } impl.fillLinearGradient( nativeGraphics, startColor, endColor, x + xTranslate, y + yTranslate, width, height, horizontal); }