@@ -0,0 +1,2846 @@
+/*%0A * Designed and developed by 2017 skydoves (Jaewoong Eum)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.skydoves.colorpickerview;%0A%0Aimport android.content.res.Resources;%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Color;%0Aimport android.graphics.ColorFilter;%0Aimport android.graphics.Paint;%0Aimport android.graphics.PixelFormat;%0Aimport android.graphics.RadialGradient;%0Aimport android.graphics.Shader;%0Aimport android.graphics.SweepGradient;%0Aimport android.graphics.drawable.BitmapDrawable;%0Aimport androidx.annotation.NonNull;%0Aimport androidx.annotation.Nullable;%0A%0A/**%0A * ColorHuePalette is an default drawable palette build by HSV (hue, saturation ,value) color model%0A * for alternating representations of the RGB color model.%0A */%0Apublic class ColorHuePalette extends BitmapDrawable %7B%0A%0A  private Paint huePaint;%0A  private Paint saturationPaint;%0A%0A  public ColorHuePalette(Resources resources, Bitmap bitmap) %7B%0A    super(resources, bitmap);%0A    this.huePaint = new Paint(Paint.ANTI_ALIAS_FLAG);%0A    this.saturationPaint = new Paint(Paint.ANTI_ALIAS_FLAG);%0A  %7D%0A%0A  @Override%0A  public void draw(@NonNull Canvas canvas) %7B%0A    int width = getBounds().width();%0A    int height = getBounds().height();%0A    float centerX = width * 0.5f;%0A    float centerY = height * 0.5f;%0A    float radius = Math.min(width, height) * 0.5f;%0A%0A    Shader sweepShader =%0A        new SweepGradient(%0A            centerX,%0A            centerY,%0A            new int%5B%5D %7B%0A              Color.RED, Color.MAGENTA, Color.BLUE, Color.CYAN, Color.GREEN, Color.YELLOW, Color.RED%0A            %7D,%0A            new float%5B%5D %7B0.000f, 0.166f, 0.333f, 0.499f, 0.666f, 0.833f, 0.999f%7D);%0A%0A    huePaint.setShader(sweepShader);%0A%0A    Shader saturationShader =%0A        new RadialGradient(%0A            centerX, centerY, radius, Color.WHITE, 0x00FFFFFF, Shader.TileMode.CLAMP);%0A    saturationPaint.setShader(saturationShader);%0A%0A    canvas.drawCircle(centerX, centerY, radius, huePaint);%0A    canvas.drawCircle(centerX, centerY, radius, saturationPaint);%0A  %7D%0A%0A  @Override%0A  public void setAlpha(int alpha) %7B%0A    huePaint.setAlpha(alpha);%0A  %7D%0A%0A  @Override%0A  public void setColorFilter(@Nullable ColorFilter colorFilter) %7B%0A    huePaint.setColorFilter(colorFilter);%0A  %7D%0A%0A  @Override%0A  public int getOpacity() %7B%0A    return PixelFormat.OPAQUE;%0A  %7D%0A%7D%0A

Implement a ColorHsvPalette, default drawable palette build by HSV (hue, saturation ,value) color model