2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.gallery3d.filtershow.filters;
19 import com.android.gallery3d.R;
20 import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
22 public class FilterColorBorderRepresentation extends FilterRepresentation {
24 private int mBorderSize;
25 private int mBorderRadius;
27 public FilterColorBorderRepresentation(int color, int size, int radius) {
31 mBorderRadius = radius;
32 setFilterType(FilterRepresentation.TYPE_BORDER);
33 setTextId(R.string.borders);
34 setEditorId(ImageOnlyEditor.ID);
35 setShowParameterValue(false);
38 public String toString() {
39 return "FilterBorder: " + getName();
43 public FilterRepresentation clone() throws CloneNotSupportedException {
44 setFilterClass(ImageFilterParametricBorder.class);
45 FilterColorBorderRepresentation representation = (FilterColorBorderRepresentation) super.clone();
46 representation.setName(getName());
47 representation.setColor(getColor());
48 representation.setBorderSize(getBorderSize());
49 representation.setBorderRadius(getBorderRadius());
50 return representation;
53 public void useParametersFrom(FilterRepresentation a) {
54 if (a instanceof FilterColorBorderRepresentation) {
55 FilterColorBorderRepresentation representation = (FilterColorBorderRepresentation) a;
56 setName(representation.getName());
57 setColor(representation.getColor());
58 setBorderSize(representation.getBorderSize());
59 setBorderRadius(representation.getBorderRadius());
64 public boolean equals(FilterRepresentation representation) {
65 if (!super.equals(representation)) {
68 if (representation instanceof FilterColorBorderRepresentation) {
69 FilterColorBorderRepresentation border = (FilterColorBorderRepresentation) representation;
70 if (border.mColor == mColor
71 && border.mBorderSize == mBorderSize
72 && border.mBorderRadius == mBorderRadius) {
79 public boolean allowsMultipleInstances() {
84 public int getTextId() {
85 return R.string.borders;
88 public int getColor() {
92 public void setColor(int color) {
96 public int getBorderSize() {
100 public void setBorderSize(int borderSize) {
101 mBorderSize = borderSize;
104 public int getBorderRadius() {
105 return mBorderRadius;
108 public void setBorderRadius(int borderRadius) {
109 mBorderRadius = borderRadius;