summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
index 1e75eb2ae..ca98069ba 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
@@ -29,12 +29,22 @@ public class ImageFilterParametricBorder extends ImageFilter {
private int mBorderColor = Color.WHITE;
private int mBorderSize = 10;
private int mBorderCornerRadius = 10;
+ private FilterColorBorderRepresentation mParameters = null;
public ImageFilterParametricBorder() {
setFilterType(TYPE_BORDER);
mName = "Border";
}
+ public void useRepresentation(FilterRepresentation representation) {
+ FilterColorBorderRepresentation parameters = (FilterColorBorderRepresentation) representation;
+ mParameters = parameters;
+ }
+
+ public FilterColorBorderRepresentation getParameters() {
+ return mParameters;
+ }
+
@Override
public int getTextId() {
return R.string.borders;
@@ -100,10 +110,13 @@ public class ImageFilterParametricBorder extends ImageFilter {
}
private void applyHelper(Canvas canvas, int w, int h) {
+ if (getParameters() == null) {
+ return;
+ }
Path border = new Path();
border.moveTo(0, 0);
- float bs = mBorderSize / 100.0f * w;
- float r = mBorderCornerRadius / 100.0f * w;
+ float bs = getParameters().getBorderSize() / 100.0f * w;
+ float r = getParameters().getBorderRadius() / 100.0f * w;
border.lineTo(0, h);
border.lineTo(w, h);
border.lineTo(w, 0);
@@ -113,7 +126,7 @@ public class ImageFilterParametricBorder extends ImageFilter {
Paint paint = new Paint();
paint.setAntiAlias(true);
- paint.setColor(mBorderColor);
+ paint.setColor(getParameters().getColor());
canvas.drawPath(border, paint);
}