@Override public ImageData filter(ImageData source, boolean copy) { if (null == source) { return null; } if (false == isActive()) { return source; } if (copy) { source = source.copy(); } int size = size(); for (int i = 0; i < size; i++) { ImageDataFilter<?> filter = m_filters.get(i); if ((null != filter) && (filter.isActive())) { ImageData imdata = filter.filter(source, false); if (null != imdata) { source = imdata; } } } return source; }
@Override public boolean isActive() { if ((super.isActive()) && (m_filters.size() > 0)) { for (int i = 0; i < m_filters.size(); i++) { ImageDataFilter<?> filter = m_filters.get(i); if ((null != filter) && (filter.isActive())) { return true; } } } return false; }
@Override public boolean isTransforming() { if (isActive()) { int size = size(); for (int i = 0; i < size; i++) { ImageDataFilter<?> filter = m_filters.get(i); if ((null != filter) && (filter.isTransforming()) && (filter.isActive())) { return true; } } } return false; }
@Override public JSONObject toJSONObject() { JSONObject object = super.toJSONObject(); JSONArray filters = new JSONArray(); for (ImageDataFilter<?> filter : m_filters) { if (null != filter) { JSONObject make = filter.toJSONObject(); if (null != make) { filters.set(filters.size(), make); } } } object.put("filters", filters); return object; }