@Override
public ImageFilter clone() throws CloneNotSupportedException {
ImageFilterGradient filter = (ImageFilterGradient) super.clone();
- for (int i = 0; i < mColors.length; i++) {
- filter.addColor(mColors[i], mPositions[i]);
- }
+ System.arraycopy(mColors, 0, filter.mColors, 0, mColors.length);
+ System.arraycopy(mPositions, 0, filter.mPositions, 0, mPositions.length);
return filter;
}
public void setActionUp() {
mMode = MODES.UP;
+ updatePreset();
}
public void setNoAction() {
mMode = MODES.NONE;
}
+ private void updatePreset() {
+ ImagePreset copy = new ImagePreset(getImagePreset());
+ copy.setStraightenRotation(mImageRotation, mImageRotationZoomFactor);
+ setImagePreset(copy);
+ }
+
public boolean onTouchEvent(MotionEvent event) {
switch (event.getActionMasked()) {
case (MotionEvent.ACTION_DOWN):
mImageRotationZoomFactor = (float) (rw / boundsRect.width());
- ImagePreset copy = new ImagePreset(getImagePreset());
- Log.v(LOGTAG, "creating a new image preset with rotation " + mImageRotation
- + " and zoom factor: " + mImageRotationZoomFactor);
-
- copy.setStraightenRotation(mImageRotation, mImageRotationZoomFactor);
- setImagePreset(copy);
-
if (mMode == MODES.MOVE) {
canvas.save();
canvas.clipPath(path);