use of com.ait.lienzo.client.core.image.filter.ImageDataFilterChain in project lienzo-core by ahome-it.
the class Picture method toJSONObject.
/**
* Serializes this shape as a {@link JSONObject}
*
* @return JSONObject
*/
@Override
public JSONObject toJSONObject() {
JSONObject attr = new JSONObject(getAttributes().getJSO());
if (getImageSerializationMode() == ImageSerializationMode.DATA_URL) {
String url = getImageProxy().getImageElementURL();
if (null == url) {
url = getAttributes().getURL();
}
if (url.startsWith("data:")) {
attr.put("url", new JSONString(url));
} else {
attr.put("url", new JSONString(toDataURL(false)));
}
}
JSONObject object = new JSONObject();
object.put("type", new JSONString(getShapeType().getValue()));
if (hasMetaData()) {
final MetaData meta = getMetaData();
if (false == meta.isEmpty()) {
object.put("meta", new JSONObject(meta.getJSO()));
}
}
object.put("attributes", attr);
ImageDataFilterChain chain = getImageProxy().getFilterChain();
if ((null != chain) && (chain.size() > 0)) {
JSONArray filters = new JSONArray();
JSONObject filter = new JSONObject();
filter.put("active", JSONBoolean.getInstance(chain.isActive()));
for (ImageDataFilter<?> ifilter : chain.getFilters()) {
if (null != ifilter) {
JSONObject make = ifilter.toJSONObject();
if (null != make) {
filters.set(filters.size(), make);
}
}
}
filter.put("filters", filters);
object.put("filter", filter);
}
return object;
}
use of com.ait.lienzo.client.core.image.filter.ImageDataFilterChain in project lienzo-core by ahome-it.
the class Movie method toJSONObject.
@Override
public JSONObject toJSONObject() {
JSONObject object = super.toJSONObject();
ImageDataFilterChain chain = m_filters;
if ((null != chain) && (chain.size() > 0)) {
JSONArray filters = new JSONArray();
JSONObject filter = new JSONObject();
filter.put("active", JSONBoolean.getInstance(chain.isActive()));
for (ImageDataFilter<?> ifilter : chain.getFilters()) {
if (null != ifilter) {
JSONObject make = ifilter.toJSONObject();
if (null != make) {
filters.set(filters.size(), make);
}
}
}
filter.put("filters", filters);
object.put("filter", filter);
}
return object;
}
Aggregations