2009-08-04 16:04:30 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-06-05 22:57:57 -04:00
|
|
|
package com.android.launcher3;
|
2009-08-04 16:04:30 -04:00
|
|
|
|
2015-04-28 22:01:31 -07:00
|
|
|
import android.animation.FloatArrayEvaluator;
|
2010-11-23 14:40:33 -08:00
|
|
|
import android.animation.ValueAnimator;
|
|
|
|
|
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
2015-04-28 22:01:31 -07:00
|
|
|
import android.annotation.TargetApi;
|
2010-09-27 11:15:43 -07:00
|
|
|
import android.content.res.Resources;
|
2009-08-04 16:04:30 -04:00
|
|
|
import android.graphics.Bitmap;
|
|
|
|
|
import android.graphics.Canvas;
|
2015-04-28 22:01:31 -07:00
|
|
|
import android.graphics.Color;
|
|
|
|
|
import android.graphics.ColorMatrix;
|
|
|
|
|
import android.graphics.ColorMatrixColorFilter;
|
2009-08-04 16:04:30 -04:00
|
|
|
import android.graphics.Paint;
|
2011-10-19 21:36:08 -07:00
|
|
|
import android.graphics.Point;
|
2011-04-15 12:07:39 -07:00
|
|
|
import android.graphics.Rect;
|
2015-04-28 22:01:31 -07:00
|
|
|
import android.os.Build;
|
2009-08-04 16:04:30 -04:00
|
|
|
import android.view.View;
|
2010-11-23 14:40:33 -08:00
|
|
|
import android.view.animation.DecelerateInterpolator;
|
2009-08-04 16:04:30 -04:00
|
|
|
|
2015-03-18 14:16:05 -07:00
|
|
|
import com.android.launcher3.util.Thunk;
|
|
|
|
|
|
2015-04-28 22:01:31 -07:00
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
2010-11-23 14:40:33 -08:00
|
|
|
public class DragView extends View {
|
2015-05-21 10:28:02 -07:00
|
|
|
public static int COLOR_CHANGE_DURATION = 120;
|
2015-04-28 22:01:31 -07:00
|
|
|
|
2015-03-18 14:16:05 -07:00
|
|
|
@Thunk static float sDragAlpha = 1f;
|
2012-02-13 18:29:29 -08:00
|
|
|
|
2009-08-04 16:04:30 -04:00
|
|
|
private Bitmap mBitmap;
|
2012-01-23 17:28:51 -08:00
|
|
|
private Bitmap mCrossFadeBitmap;
|
2015-06-02 09:38:28 -07:00
|
|
|
@Thunk Paint mPaint;
|
2009-08-04 16:04:30 -04:00
|
|
|
private int mRegistrationX;
|
|
|
|
|
private int mRegistrationY;
|
|
|
|
|
|
2011-10-19 21:36:08 -07:00
|
|
|
private Point mDragVisualizeOffset = null;
|
2011-04-15 12:07:39 -07:00
|
|
|
private Rect mDragRegion = null;
|
2011-07-07 16:38:18 -07:00
|
|
|
private DragLayer mDragLayer = null;
|
2011-07-20 15:45:11 -07:00
|
|
|
private boolean mHasDrawn = false;
|
2015-03-18 14:16:05 -07:00
|
|
|
@Thunk float mCrossFadeProgress = 0f;
|
2010-08-19 13:52:27 -07:00
|
|
|
|
2010-11-23 14:40:33 -08:00
|
|
|
ValueAnimator mAnim;
|
2015-03-18 14:16:05 -07:00
|
|
|
@Thunk float mOffsetX = 0.0f;
|
|
|
|
|
@Thunk float mOffsetY = 0.0f;
|
2012-03-01 16:09:54 -08:00
|
|
|
private float mInitialScale = 1f;
|
2013-11-13 15:47:05 -08:00
|
|
|
// The intrinsic icon scale factor is the scale factor for a drag icon over the workspace
|
|
|
|
|
// size. This is ignored for non-icons.
|
|
|
|
|
private float mIntrinsicIconScale = 1f;
|
2009-08-04 16:04:30 -04:00
|
|
|
|
2015-06-02 09:38:28 -07:00
|
|
|
@Thunk float[] mCurrentFilter;
|
2015-04-28 22:01:31 -07:00
|
|
|
private ValueAnimator mFilterAnimator;
|
|
|
|
|
|
2009-08-04 16:04:30 -04:00
|
|
|
/**
|
|
|
|
|
* Construct the drag view.
|
|
|
|
|
* <p>
|
|
|
|
|
* The registration point is the point inside our view that the touch events should
|
|
|
|
|
* be centered upon.
|
|
|
|
|
*
|
2011-07-07 16:38:18 -07:00
|
|
|
* @param launcher The Launcher instance
|
2009-08-04 16:04:30 -04:00
|
|
|
* @param bitmap The view that we're dragging around. We scale it up when we draw it.
|
|
|
|
|
* @param registrationX The x coordinate of the registration point.
|
|
|
|
|
* @param registrationY The y coordinate of the registration point.
|
|
|
|
|
*/
|
2015-05-14 00:07:08 -07:00
|
|
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
2011-07-07 16:38:18 -07:00
|
|
|
public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
|
2012-02-22 13:51:36 -08:00
|
|
|
int left, int top, int width, int height, final float initialScale) {
|
2011-07-07 16:38:18 -07:00
|
|
|
super(launcher);
|
|
|
|
|
mDragLayer = launcher.getDragLayer();
|
2012-03-01 16:09:54 -08:00
|
|
|
mInitialScale = initialScale;
|
2009-08-04 16:04:30 -04:00
|
|
|
|
2010-09-27 11:15:43 -07:00
|
|
|
final Resources res = getResources();
|
2012-02-13 18:29:29 -08:00
|
|
|
final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
|
|
|
|
|
final float scale = (width + scaleDps) / width;
|
2010-11-23 14:40:33 -08:00
|
|
|
|
2012-08-16 17:55:58 -07:00
|
|
|
// Set the initial scale to avoid any jumps
|
|
|
|
|
setScaleX(initialScale);
|
|
|
|
|
setScaleY(initialScale);
|
|
|
|
|
|
2010-11-23 14:40:33 -08:00
|
|
|
// Animate the view into the correct position
|
2013-03-13 12:55:46 +01:00
|
|
|
mAnim = LauncherAnimUtils.ofFloat(this, 0f, 1f);
|
2012-02-13 18:29:29 -08:00
|
|
|
mAnim.setDuration(150);
|
2010-11-23 14:40:33 -08:00
|
|
|
mAnim.addUpdateListener(new AnimatorUpdateListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationUpdate(ValueAnimator animation) {
|
|
|
|
|
final float value = (Float) animation.getAnimatedValue();
|
|
|
|
|
|
2015-02-26 11:26:19 -08:00
|
|
|
final int deltaX = (int) (-mOffsetX);
|
|
|
|
|
final int deltaY = (int) (-mOffsetY);
|
2010-11-23 14:40:33 -08:00
|
|
|
|
|
|
|
|
mOffsetX += deltaX;
|
|
|
|
|
mOffsetY += deltaY;
|
2012-02-22 13:51:36 -08:00
|
|
|
setScaleX(initialScale + (value * (scale - initialScale)));
|
|
|
|
|
setScaleY(initialScale + (value * (scale - initialScale)));
|
2012-02-21 15:48:35 -08:00
|
|
|
if (sDragAlpha != 1f) {
|
|
|
|
|
setAlpha(sDragAlpha * value + (1f - value));
|
|
|
|
|
}
|
2010-11-23 14:40:33 -08:00
|
|
|
|
|
|
|
|
if (getParent() == null) {
|
|
|
|
|
animation.cancel();
|
|
|
|
|
} else {
|
2012-02-13 18:29:29 -08:00
|
|
|
setTranslationX(getTranslationX() + deltaX);
|
|
|
|
|
setTranslationY(getTranslationY() + deltaY);
|
2010-11-23 14:40:33 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2009-08-04 16:04:30 -04:00
|
|
|
|
2012-02-13 18:29:29 -08:00
|
|
|
mBitmap = Bitmap.createBitmap(bitmap, left, top, width, height);
|
2011-04-15 12:07:39 -07:00
|
|
|
setDragRegion(new Rect(0, 0, width, height));
|
2009-08-04 16:04:30 -04:00
|
|
|
|
|
|
|
|
// The point in our scaled bitmap that the touch events are located
|
2010-11-23 14:40:33 -08:00
|
|
|
mRegistrationX = registrationX;
|
|
|
|
|
mRegistrationY = registrationY;
|
2011-01-17 15:29:27 -08:00
|
|
|
|
|
|
|
|
// Force a measure, because Workspace uses getMeasuredHeight() before the layout pass
|
|
|
|
|
int ms = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
|
|
|
|
measure(ms, ms);
|
2012-02-23 18:25:43 -08:00
|
|
|
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
|
2015-05-07 16:13:12 -07:00
|
|
|
|
2015-08-17 12:24:25 -07:00
|
|
|
if (Utilities.ATLEAST_LOLLIPOP) {
|
2015-05-07 16:13:12 -07:00
|
|
|
setElevation(getResources().getDimension(R.dimen.drag_elevation));
|
|
|
|
|
}
|
2011-01-17 15:29:27 -08:00
|
|
|
}
|
|
|
|
|
|
2013-11-13 15:47:05 -08:00
|
|
|
/** Sets the scale of the view over the normal workspace icon size. */
|
|
|
|
|
public void setIntrinsicIconScaleFactor(float scale) {
|
|
|
|
|
mIntrinsicIconScale = scale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getIntrinsicIconScaleFactor() {
|
|
|
|
|
return mIntrinsicIconScale;
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-17 15:29:27 -08:00
|
|
|
public float getOffsetY() {
|
|
|
|
|
return mOffsetY;
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
|
|
|
|
|
2010-08-19 13:52:27 -07:00
|
|
|
public int getDragRegionLeft() {
|
2011-04-15 12:07:39 -07:00
|
|
|
return mDragRegion.left;
|
2010-08-19 13:52:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDragRegionTop() {
|
2011-04-15 12:07:39 -07:00
|
|
|
return mDragRegion.top;
|
2010-08-19 13:52:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDragRegionWidth() {
|
2011-04-15 12:07:39 -07:00
|
|
|
return mDragRegion.width();
|
2010-08-19 13:52:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDragRegionHeight() {
|
2011-04-15 12:07:39 -07:00
|
|
|
return mDragRegion.height();
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-19 21:36:08 -07:00
|
|
|
public void setDragVisualizeOffset(Point p) {
|
|
|
|
|
mDragVisualizeOffset = p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Point getDragVisualizeOffset() {
|
|
|
|
|
return mDragVisualizeOffset;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-15 12:07:39 -07:00
|
|
|
public void setDragRegion(Rect r) {
|
|
|
|
|
mDragRegion = r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Rect getDragRegion() {
|
|
|
|
|
return mDragRegion;
|
2010-08-19 13:52:27 -07:00
|
|
|
}
|
|
|
|
|
|
2012-03-01 16:09:54 -08:00
|
|
|
public float getInitialScale() {
|
|
|
|
|
return mInitialScale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateInitialScaleToCurrentScale() {
|
|
|
|
|
mInitialScale = getScaleX();
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-04 16:04:30 -04:00
|
|
|
@Override
|
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
2009-11-04 13:48:32 -05:00
|
|
|
setMeasuredDimension(mBitmap.getWidth(), mBitmap.getHeight());
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onDraw(Canvas canvas) {
|
2012-04-13 14:44:29 -07:00
|
|
|
@SuppressWarnings("all") // suppress dead code warning
|
|
|
|
|
final boolean debug = false;
|
|
|
|
|
if (debug) {
|
2009-08-04 16:04:30 -04:00
|
|
|
Paint p = new Paint();
|
|
|
|
|
p.setStyle(Paint.Style.FILL);
|
2012-03-02 17:14:58 -08:00
|
|
|
p.setColor(0x66ffffff);
|
2009-08-04 16:04:30 -04:00
|
|
|
canvas.drawRect(0, 0, getWidth(), getHeight(), p);
|
|
|
|
|
}
|
2010-11-23 14:40:33 -08:00
|
|
|
|
2011-07-20 15:45:11 -07:00
|
|
|
mHasDrawn = true;
|
2012-01-23 17:28:51 -08:00
|
|
|
boolean crossFade = mCrossFadeProgress > 0 && mCrossFadeBitmap != null;
|
|
|
|
|
if (crossFade) {
|
|
|
|
|
int alpha = crossFade ? (int) (255 * (1 - mCrossFadeProgress)) : 255;
|
|
|
|
|
mPaint.setAlpha(alpha);
|
|
|
|
|
}
|
2009-08-04 16:04:30 -04:00
|
|
|
canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
|
2012-01-23 17:28:51 -08:00
|
|
|
if (crossFade) {
|
|
|
|
|
mPaint.setAlpha((int) (255 * mCrossFadeProgress));
|
|
|
|
|
canvas.save();
|
|
|
|
|
float sX = (mBitmap.getWidth() * 1.0f) / mCrossFadeBitmap.getWidth();
|
|
|
|
|
float sY = (mBitmap.getHeight() * 1.0f) / mCrossFadeBitmap.getHeight();
|
|
|
|
|
canvas.scale(sX, sY);
|
|
|
|
|
canvas.drawBitmap(mCrossFadeBitmap, 0.0f, 0.0f, mPaint);
|
|
|
|
|
canvas.restore();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCrossFadeBitmap(Bitmap crossFadeBitmap) {
|
|
|
|
|
mCrossFadeBitmap = crossFadeBitmap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void crossFade(int duration) {
|
2013-03-13 12:55:46 +01:00
|
|
|
ValueAnimator va = LauncherAnimUtils.ofFloat(this, 0f, 1f);
|
2012-01-23 17:28:51 -08:00
|
|
|
va.setDuration(duration);
|
|
|
|
|
va.setInterpolator(new DecelerateInterpolator(1.5f));
|
|
|
|
|
va.addUpdateListener(new AnimatorUpdateListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationUpdate(ValueAnimator animation) {
|
|
|
|
|
mCrossFadeProgress = animation.getAnimatedFraction();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
va.start();
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
|
|
|
|
|
2012-02-28 18:11:33 -08:00
|
|
|
public void setColor(int color) {
|
2012-02-23 18:25:43 -08:00
|
|
|
if (mPaint == null) {
|
|
|
|
|
mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
|
|
|
|
|
}
|
2012-02-28 18:11:33 -08:00
|
|
|
if (color != 0) {
|
2015-04-28 22:01:31 -07:00
|
|
|
ColorMatrix m1 = new ColorMatrix();
|
|
|
|
|
m1.setSaturation(0);
|
|
|
|
|
|
|
|
|
|
ColorMatrix m2 = new ColorMatrix();
|
2015-05-21 10:28:02 -07:00
|
|
|
setColorScale(color, m2);
|
2015-04-28 22:01:31 -07:00
|
|
|
m1.postConcat(m2);
|
|
|
|
|
|
2015-08-17 12:24:25 -07:00
|
|
|
if (Utilities.ATLEAST_LOLLIPOP) {
|
2015-04-28 22:01:31 -07:00
|
|
|
animateFilterTo(m1.getArray());
|
|
|
|
|
} else {
|
|
|
|
|
mPaint.setColorFilter(new ColorMatrixColorFilter(m1));
|
|
|
|
|
invalidate();
|
|
|
|
|
}
|
2012-02-28 18:11:33 -08:00
|
|
|
} else {
|
2015-08-17 12:24:25 -07:00
|
|
|
if (!Utilities.ATLEAST_LOLLIPOP || mCurrentFilter == null) {
|
2015-04-28 22:01:31 -07:00
|
|
|
mPaint.setColorFilter(null);
|
|
|
|
|
invalidate();
|
|
|
|
|
} else {
|
|
|
|
|
animateFilterTo(new ColorMatrix().getArray());
|
|
|
|
|
}
|
2012-02-28 18:11:33 -08:00
|
|
|
}
|
2015-04-28 22:01:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
|
|
|
private void animateFilterTo(float[] targetFilter) {
|
|
|
|
|
float[] oldFilter = mCurrentFilter == null ? new ColorMatrix().getArray() : mCurrentFilter;
|
|
|
|
|
mCurrentFilter = Arrays.copyOf(oldFilter, oldFilter.length);
|
|
|
|
|
|
|
|
|
|
if (mFilterAnimator != null) {
|
|
|
|
|
mFilterAnimator.cancel();
|
|
|
|
|
}
|
|
|
|
|
mFilterAnimator = ValueAnimator.ofObject(new FloatArrayEvaluator(mCurrentFilter),
|
|
|
|
|
oldFilter, targetFilter);
|
|
|
|
|
mFilterAnimator.setDuration(COLOR_CHANGE_DURATION);
|
|
|
|
|
mFilterAnimator.addUpdateListener(new AnimatorUpdateListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationUpdate(ValueAnimator animation) {
|
|
|
|
|
mPaint.setColorFilter(new ColorMatrixColorFilter(mCurrentFilter));
|
|
|
|
|
invalidate();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
mFilterAnimator.start();
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
|
|
|
|
|
2011-07-20 15:45:11 -07:00
|
|
|
public boolean hasDrawn() {
|
|
|
|
|
return mHasDrawn;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-02 18:03:00 -07:00
|
|
|
@Override
|
|
|
|
|
public void setAlpha(float alpha) {
|
|
|
|
|
super.setAlpha(alpha);
|
|
|
|
|
mPaint.setAlpha((int) (255 * alpha));
|
|
|
|
|
invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-04 16:04:30 -04:00
|
|
|
/**
|
|
|
|
|
* Create a window containing this view and show it.
|
|
|
|
|
*
|
|
|
|
|
* @param windowToken obtained from v.getWindowToken() from one of your views
|
2011-07-07 16:38:18 -07:00
|
|
|
* @param touchX the x coordinate the user touched in DragLayer coordinates
|
|
|
|
|
* @param touchY the y coordinate the user touched in DragLayer coordinates
|
2009-08-04 16:04:30 -04:00
|
|
|
*/
|
2011-07-07 16:38:18 -07:00
|
|
|
public void show(int touchX, int touchY) {
|
|
|
|
|
mDragLayer.addView(this);
|
2012-03-01 16:09:54 -08:00
|
|
|
|
|
|
|
|
// Start the pick-up animation
|
2011-07-07 16:38:18 -07:00
|
|
|
DragLayer.LayoutParams lp = new DragLayer.LayoutParams(0, 0);
|
|
|
|
|
lp.width = mBitmap.getWidth();
|
|
|
|
|
lp.height = mBitmap.getHeight();
|
|
|
|
|
lp.customPosition = true;
|
|
|
|
|
setLayoutParams(lp);
|
2012-02-13 18:29:29 -08:00
|
|
|
setTranslationX(touchX - mRegistrationX);
|
|
|
|
|
setTranslationY(touchY - mRegistrationY);
|
2012-06-29 15:17:04 -07:00
|
|
|
// Post the animation to skip other expensive work happening on the first frame
|
|
|
|
|
post(new Runnable() {
|
|
|
|
|
public void run() {
|
|
|
|
|
mAnim.start();
|
|
|
|
|
}
|
|
|
|
|
});
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
2011-06-30 12:09:54 -07:00
|
|
|
|
2012-02-13 18:29:29 -08:00
|
|
|
public void cancelAnimation() {
|
|
|
|
|
if (mAnim != null && mAnim.isRunning()) {
|
|
|
|
|
mAnim.cancel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void resetLayoutParams() {
|
|
|
|
|
mOffsetX = mOffsetY = 0;
|
|
|
|
|
requestLayout();
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-04 16:04:30 -04:00
|
|
|
/**
|
|
|
|
|
* Move the window containing this view.
|
|
|
|
|
*
|
2011-07-07 16:38:18 -07:00
|
|
|
* @param touchX the x coordinate the user touched in DragLayer coordinates
|
|
|
|
|
* @param touchY the y coordinate the user touched in DragLayer coordinates
|
2009-08-04 16:04:30 -04:00
|
|
|
*/
|
|
|
|
|
void move(int touchX, int touchY) {
|
2012-02-13 18:29:29 -08:00
|
|
|
setTranslationX(touchX - mRegistrationX + (int) mOffsetX);
|
|
|
|
|
setTranslationY(touchY - mRegistrationY + (int) mOffsetY);
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void remove() {
|
2012-02-13 18:29:29 -08:00
|
|
|
if (getParent() != null) {
|
|
|
|
|
mDragLayer.removeView(DragView.this);
|
|
|
|
|
}
|
2011-02-24 12:16:12 -08:00
|
|
|
}
|
2015-05-21 10:28:02 -07:00
|
|
|
|
|
|
|
|
public static void setColorScale(int color, ColorMatrix target) {
|
|
|
|
|
target.setScale(Color.red(color) / 255f, Color.green(color) / 255f,
|
|
|
|
|
Color.blue(color) / 255f, Color.alpha(color) / 255f);
|
|
|
|
|
}
|
2009-08-04 16:04:30 -04:00
|
|
|
}
|