Java Code Examples for android.graphics.Paint.setShader()

The following are Jave code examples for showing how to use setShader() of the android.graphics.Paint class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PresenterLite   File: ShapedImageView.java   View Source Code Vote up 7 votes
private Bitmap rotatedOval(Bitmap bitmap) {
    Bitmap bmp;
    float width = bitmap.getWidth();
    float height = bitmap.getHeight();

    bmp = Bitmap.createBitmap((int) width, (int) height, Bitmap.Config.ARGB_8888);
    BitmapShader shader = new BitmapShader(bitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);

    Canvas canvas = new Canvas(bmp);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setShader(shader);

    Path oval = new Path();
    Matrix matrix = new Matrix();
    RectF ovalRect = new RectF(width / OVAL_FACTOR, 0, width - (width / OVAL_FACTOR), height);

    oval.addOval(ovalRect, Path.Direction.CW);
    matrix.postRotate(ROTATION, width / 2, height / 2);
    oval.transform(matrix, oval);
    canvas.drawPath(oval, paint);

    return bmp;
}
 
Example 2
Project: LQRWeChat   File: BubbleImageView.java   View Source Code Vote up 6 votes
private void setup() {
    if (mBitmap == null) {
        return;
    }

    mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP,
            Shader.TileMode.CLAMP);

    mBitmapPaint = new Paint();
    mBitmapPaint.setAntiAlias(true);
    mBitmapPaint.setShader(mBitmapShader);

    mBitmapHeight = mBitmap.getHeight();
    mBitmapWidth = mBitmap.getWidth();

    updateShaderMatrix();
    invalidate();
}
 
Example 3
Project: terminal-seekbar   File: TerminalSeekBar.java   View Source Code Vote up 6 votes
/**
 * getting the fields initialized ...
 */
private void initialize() {

    absLeft = getPaddingLeft() + mPaddingSize;
    absRight = getWidth() - getPaddingRight() - mPaddingSize;
    absTop = getPaddingTop() + mPaddingSize;
    absBottom = getHeight() - getPaddingBottom() - mPaddingSize;

    thumbRadius = thumbHeight / 2;
    mPaddingSize = (int) thumbRadius;
    barWidth = absRight - absLeft;

    mSeekBarRect = new Rect(absLeft, absTop, absRight, absTop + barHeight);

    mSeekBarGradient = new LinearGradient(0, 0, mSeekBarRect.width(), 0, mBarColor, mBarColor, Shader.TileMode.MIRROR);
    mBarRectPaint = new Paint();
    mBarRectPaint.setShader(mSeekBarGradient);
    mBarRectPaint.setAntiAlias(true);

    terminalRadius = barHeight / 2 + 5;

}
 
Example 4
Project: spline   File: HueDrawable.java   View Source Code Vote up 6 votes
@Override
public void draw(Canvas canvas) {
    Rect b = getBounds();

    Paint huePaint = new Paint();
    huePaint.setShader(new LinearGradient(0, 0, b.width(), 0,
            new int[]{
                    0xFFFF0000,
                    0xFFFFFF00,
                    0xFF00FF00,
                    0xFF00FFFF,
                    0xFF0000FF,
                    0xFFFF00FF,
                    0xFFFF0000
            },
            null,
            Shader.TileMode.REPEAT)
    );
    canvas.drawRect(b, huePaint);
}
 
Example 5
Project: Sega   File: CircleTransform.java   View Source Code Vote up 6 votes
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
    if (toTransform == null) return null;

    int size = Math.min(toTransform.getWidth(), toTransform.getHeight());
    int x = (toTransform.getWidth() - size) / 2;
    int y = (toTransform.getHeight() - size) / 2;

    // TODO this could be acquired from the pool too
    Bitmap squared = Bitmap.createBitmap(toTransform, x, y, size, size);

    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);
    return result;
}
 
Example 6
Project: GitHub   File: GlideCircleTransform.java   View Source Code Vote up 6 votes
private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
    if (source == null) return null;

    int size = Math.min(source.getWidth(), source.getHeight());
    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;

    Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);

    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);
    return result;
}
 
Example 7
Project: PureNews   File: GlideCircleTransform.java   View Source Code Vote up 6 votes
private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
    if (source == null) return null;

    int size = Math.min(source.getWidth(), source.getHeight());
    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;

    Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);

    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);
    return result;
}
 
Example 8
Project: GitHub   File: GlideCircleTransform.java   View Source Code Vote up 6 votes
private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
    if (source == null) return null;

    int size = Math.min(source.getWidth(), source.getHeight());
    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;

    Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);

    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);
    return result;
}
 
Example 9
Project: Cybernet-VPN   File: CircleTransformation.java   View Source Code Vote up 5 votes
@Override
public Bitmap transform(Bitmap source) {
    int size = Math.min(source.getWidth(), source.getHeight());

    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;

    Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
    if (squaredBitmap != source) {
        source.recycle();
    }

    Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());

    Canvas canvas = new Canvas(bitmap);

    Paint avatarPaint = new Paint();
    BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
    avatarPaint.setShader(shader);

    Paint outlinePaint = new Paint();
    outlinePaint.setColor(Color.WHITE);
    outlinePaint.setStyle(Paint.Style.STROKE);
    outlinePaint.setStrokeWidth(STROKE_WIDTH);
    outlinePaint.setAntiAlias(true);

    float r = size / 2f;
    canvas.drawCircle(r, r, r, avatarPaint);
    canvas.drawCircle(r, r, r - STROKE_WIDTH / 2, outlinePaint);

    squaredBitmap.recycle();
    return bitmap;
}
 
Example 10
Project: GitHub   File: CircleProgressBar.java   View Source Code Vote up 5 votes
public OvalShadow(int shadowRadius, int circleDiameter) {
    super();
    mShadowPaint = new Paint();
    mShadowRadius = shadowRadius;
    mCircleDiameter = circleDiameter;
    mRadialGradient = new RadialGradient(mCircleDiameter / 2, mCircleDiameter / 2,
            mShadowRadius, new int[]{
            FILL_SHADOW_COLOR, Color.TRANSPARENT
    }, null, Shader.TileMode.CLAMP);
    mShadowPaint.setShader(mRadialGradient);
}
 
Example 11
Project: GitHub   File: TransformationUtils.java   View Source Code Vote up 5 votes
/**
 * Creates a bitmap from a source bitmap and rounds the corners.
 *
 * @param inBitmap the source bitmap to use as a basis for the created bitmap.
 * @param width the width of the generated bitmap.
 * @param height the height of the generated bitmap.
 * @param roundingRadius the corner radius to be applied (in device-specific pixels).
 * @return a {@link Bitmap} similar to inBitmap but with rounded corners.
 * @throws IllegalArgumentException if roundingRadius, width or height is 0 or less.
 */
public static Bitmap roundedCorners(@NonNull BitmapPool pool, @NonNull Bitmap inBitmap,
    int width, int height, int roundingRadius) {
  Preconditions.checkArgument(width > 0, "width must be greater than 0.");
  Preconditions.checkArgument(height > 0, "height must be greater than 0.");
  Preconditions.checkArgument(roundingRadius > 0, "roundingRadius must be greater than 0.");

  // Alpha is required for this transformation.
  Bitmap toTransform = getAlphaSafeBitmap(pool, inBitmap);
  Bitmap result = pool.get(width, height, Bitmap.Config.ARGB_8888);

  result.setHasAlpha(true);

  BitmapShader shader = new BitmapShader(toTransform, Shader.TileMode.CLAMP,
      Shader.TileMode.CLAMP);
  Paint paint = new Paint();
  paint.setAntiAlias(true);
  paint.setShader(shader);
  RectF rect = new RectF(0, 0, result.getWidth(), result.getHeight());
  BITMAP_DRAWABLE_LOCK.lock();
  try {
    Canvas canvas = new Canvas(result);
    canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
    canvas.drawRoundRect(rect, roundingRadius, roundingRadius, paint);
    clear(canvas);
  } finally {
    BITMAP_DRAWABLE_LOCK.unlock();
  }

  if (!toTransform.equals(inBitmap)) {
    pool.put(toTransform);
  }

  return result;
}
 
Example 12
Project: UIWidget   File: GlideManager.java   View Source Code Vote up 5 votes
private Bitmap roundCrop(BitmapPool pool, Bitmap source) {
    Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
    }

    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
    canvas.drawRoundRect(rectF, radius, radius, paint);
    return result;
}
 
Example 13
Project: Pilem   File: GrayscaleTransformation.java   View Source Code Vote up 5 votes
@Override
public Bitmap transform(Bitmap source) {
    Bitmap result = createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
    Bitmap noise;

    try {
        noise = picasso.load(R.mipmap.noise).get();
    } catch (IOException e) {
        throw new RuntimeException("Failed to apply transformation! Missing resource.");
    }

    BitmapShader shader = new BitmapShader(noise, REPEAT, REPEAT);

    ColorMatrix colorMatrix = new ColorMatrix();
    colorMatrix.setSaturation(0);
    ColorMatrixColorFilter filter = new ColorMatrixColorFilter(colorMatrix);

    Paint paint = new Paint(ANTI_ALIAS_FLAG);
    paint.setColorFilter(filter);

    Canvas canvas = new Canvas(result);
    canvas.drawBitmap(source, 0, 0, paint);

    paint.setColorFilter(null);
    paint.setShader(shader);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));

    canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), paint);

    source.recycle();
    noise.recycle();

    return result;
}
 
Example 14
Project: microMathematics   File: SaturationBar.java   View Source Code Vote up 5 votes
private void init(AttributeSet attrs, int defStyle) {
	final TypedArray a = getContext().obtainStyledAttributes(attrs,
			R.styleable.ColorBars, defStyle, 0);
	final Resources b = getContext().getResources();

	mBarThickness = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_thickness,
			b.getDimensionPixelSize(R.dimen.bar_thickness));
	mBarLength = a.getDimensionPixelSize(R.styleable.ColorBars_bar_length,
			b.getDimensionPixelSize(R.dimen.bar_length));
	mPreferredBarLength = mBarLength;
	mBarPointerRadius = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_pointer_radius,
			b.getDimensionPixelSize(R.dimen.bar_pointer_radius));
	mBarPointerHaloRadius = a.getDimensionPixelSize(
			R.styleable.ColorBars_bar_pointer_halo_radius,
			b.getDimensionPixelSize(R.dimen.bar_pointer_halo_radius));
	mOrientation = a.getBoolean(
			R.styleable.ColorBars_bar_orientation_horizontal,
			ORIENTATION_DEFAULT);

	a.recycle();

	mBarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPaint.setShader(shader);

	mBarPointerPosition = mBarLength + mBarPointerHaloRadius;

	mBarPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPointerHaloPaint.setColor(Color.BLACK);
	mBarPointerHaloPaint.setAlpha(0x50);

	mBarPointerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mBarPointerPaint.setColor(0xff81ff00);

	mPosToSatFactor = 1 / ((float) mBarLength);
	mSatToPosFactor = ((float) mBarLength) / 1;
}
 
Example 15
Project: DeepImagePreview-Project   File: CircleTransform.java   View Source Code Vote up 5 votes
@Override
public Bitmap transform(Bitmap source) {
    int size = Math.min(source.getWidth(), source.getHeight());

    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;

    Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
    if (squaredBitmap != source) {
        source.recycle();
    }

    Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());

    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();
    BitmapShader shader = new BitmapShader(squaredBitmap,
            BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
    paint.setShader(shader);
    paint.setAntiAlias(true);

    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);

    squaredBitmap.recycle();
    return bitmap;
}
 
Example 16
Project: MeetMusic   File: ScanView.java   View Source Code Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Paint mPaint = new Paint();
    mPaint.setAntiAlias(true);
    Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    Rect rectd = new Rect((viewSize / 10) * 4, (viewSize / 10) * 4, viewSize - (viewSize / 10) * 4, viewSize - (viewSize / 10) * 4);
    canvas.drawBitmap(bitmap, rect, rectd, mPaint);

    circlePaint = new Paint();
    circlePaint.setStyle(Paint.Style.STROKE);
    circlePaint.setAntiAlias(true);
    circlePaint.setStrokeWidth((viewSize / 10));

    circlePaint.setColor(Color.parseColor(circlrColor1));
    canvas.drawCircle(viewSize / 2, viewSize / 2, (viewSize / 10) * 2.5f, circlePaint);

    circlePaint.setColor(Color.parseColor(circlrColor2));
    canvas.drawCircle(viewSize / 2, viewSize / 2, (viewSize / 10) * 3.5f, circlePaint);

    circlePaint.setColor(Color.parseColor(circlrColor3));
    canvas.drawCircle(viewSize / 2, viewSize / 2, (viewSize / 10) * 4.5f, circlePaint);

    sectorPaint = new Paint();
    sectorPaint.setAntiAlias(true);
    sectorPaint.setStyle(Paint.Style.STROKE);
    sectorPaint.setStrokeWidth((viewSize / 10) * 3);
    Shader sectorShader = new SweepGradient(viewSize / 2, viewSize / 2,
            new int[]{Color.TRANSPARENT, Color.argb(0,Color.red(accentColor),Color.green(accentColor),Color.blue(accentColor)),
                    Color.argb(255,Color.red(accentColor),Color.green(accentColor),Color.blue(accentColor))},
            new float[]{0, 0.875f, 1f});
    sectorPaint.setShader(sectorShader);

    if (threadFlag) {
        canvas.concat(matrix);
        canvas.drawCircle(viewSize / 2, viewSize / 2, (viewSize / 10) * 3.5f, sectorPaint);
    }
}
 
Example 17
Project: DreamDrawable   File: RoundDrawable.java   View Source Code Vote up 5 votes
public RoundDrawable(Bitmap bitmap) {
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBitmap = bitmap;

    mShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
    mPaint.setShader(mShader);

    mMatrix = new Matrix();
}
 
Example 18
Project: Amazing   File: FadingView.java   View Source Code Vote up 4 votes
private void initPaint() {
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setShader(new LinearGradient(0, 0, 0, height, 0XD0000000, 0X10000000, Shader.TileMode.CLAMP));
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
}
 
Example 19
Project: xlight_android_native   File: ColorPicker.java   View Source Code Vote up 4 votes
private void init(AttributeSet attrs, int defStyle) {
	final TypedArray a = getContext().obtainStyledAttributes(attrs,
			R.styleable.ColorPicker, defStyle, 0);
	final Resources b = getContext().getResources();

	mColorWheelThickness = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_wheel_thickness,
			b.getDimensionPixelSize(R.dimen.color_wheel_thickness));
	mColorWheelRadius = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_wheel_radius,
			b.getDimensionPixelSize(R.dimen.color_wheel_radius));
	mPreferredColorWheelRadius = mColorWheelRadius;
	mColorCenterRadius = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_center_radius,
			b.getDimensionPixelSize(R.dimen.color_center_radius));
	mPreferredColorCenterRadius = mColorCenterRadius;
	mColorCenterHaloRadius = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_center_halo_radius,
			b.getDimensionPixelSize(R.dimen.color_center_halo_radius));
	mPreferredColorCenterHaloRadius = mColorCenterHaloRadius;
	mColorPointerRadius = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_pointer_radius,
			b.getDimensionPixelSize(R.dimen.color_pointer_radius));
	mColorPointerHaloRadius = a.getDimensionPixelSize(
			R.styleable.ColorPicker_color_pointer_halo_radius,
			b.getDimensionPixelSize(R.dimen.color_pointer_halo_radius));

	a.recycle();

	mAngle = (float) (-Math.PI / 2);

	Shader s = new SweepGradient(0, 0, COLORS, null);

	mColorWheelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mColorWheelPaint.setShader(s);
	mColorWheelPaint.setStyle(Paint.Style.STROKE);
	mColorWheelPaint.setStrokeWidth(mColorWheelThickness);

	mPointerHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mPointerHaloPaint.setColor(Color.BLACK);
	mPointerHaloPaint.setAlpha(0x50);

	mPointerColor = new Paint(Paint.ANTI_ALIAS_FLAG);
	mPointerColor.setColor(calculateColor(mAngle));

	mCenterNewPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mCenterNewPaint.setColor(calculateColor(mAngle));
	mCenterNewPaint.setStyle(Paint.Style.FILL);

	mCenterOldPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mCenterOldPaint.setColor(calculateColor(mAngle));
	mCenterOldPaint.setStyle(Paint.Style.FILL);

	mCenterHaloPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mCenterHaloPaint.setColor(Color.BLACK);
	mCenterHaloPaint.setAlpha(0x00);
	
	mCenterNewColor = calculateColor(mAngle);
	mCenterOldColor = calculateColor(mAngle);
	mShowCenterOldColor = true;
}
 
Example 20
Project: terminal-seekbar   File: TerminalSeekBar.java   View Source Code Vote up 4 votes
@Override
protected void onDraw(Canvas canvas)
{
    initialize();
    float colorPosition = (float) barCurrentValue / mMaxValue * barWidth;

    Paint colorPaint = new Paint();
    colorPaint.setAntiAlias(true);
    colorPaint.setColor(mBarColor);

    //required for the thumb (inner radiant to be transparent when the seek bar thumb is on the terminal)
    int[] toAlpha = new int[]{Color.argb(0, 0, 0, 0),Color.argb(255, 0, 0, 0),Color.argb(0, 0, 0, 0)};

    //refreshing the background
    canvas.drawBitmap(mTransparentBitmap,0,0,null);

    //drawing the seek bar
    canvas.drawRect(mSeekBarRect, mBarRectPaint);

    //drawing the seek bar thumb
    float thumbX = colorPosition + absLeft;
    float thumbY = mSeekBarRect.top + mSeekBarRect.height() / 2;
    canvas.drawCircle(thumbX, thumbY, barHeight / 2 + 5, colorPaint);


    Paint terminalColor = new Paint();
    terminalColor.setAntiAlias(true);
    terminalColor.setColor(Color.RED);

    if (mTerminals != null)
    {
        int i = 0;
        //drawing all the terminals
        for (Terminal terminal : mTerminals) {

            float terminalPosX = getTerminalAbsoluteX(terminal.getPosition());
            float terminalPosY = mSeekBarRect.top + mSeekBarRect.height() / 2;

            //drawing the outer blinking glow of the terminal
            if (terminalBackDrawables !=null) {
                terminalBackDrawables.get(i).setCx(terminalPosX);
                terminalBackDrawables.get(i).setCy(terminalPosY);
                terminalBackDrawables.get(i).setRadius(terminalRadius + TERMINAL_BAR_PADDING);
                terminalBackDrawables.get(i).setColor(terminal.getColor());
                //logout("Color on the view from terminal " + terminal.getColor());
                terminalBackDrawables.get(i).draw(canvas);
                i++;
            }
            ////drawing the clear Terminal
            canvas.drawCircle(terminalPosX, terminalPosY, terminalRadius, terminal.getPaint());
        }
    }


    RadialGradient thumbShader  = new RadialGradient(thumbX, thumbY, thumbRadius, toAlpha, null, Shader.TileMode.MIRROR);
    Paint thumbGradientPaint = new Paint();
    thumbGradientPaint.setAntiAlias(true);
    thumbGradientPaint.setShader(thumbShader);

    //drawing the seek bar thumb
    canvas.drawCircle(thumbX, thumbY, (thumbHeight / 2), thumbGradientPaint);

    super.onDraw(canvas);
    animateBlink();
}