Search in sources :

Example 1 with MoaAction

use of com.aviary.android.feather.library.moa.MoaAction in project mobile-android by photo.

the class BordersPanel method actionsForRoundedThumbnail.

static void actionsForRoundedThumbnail(final boolean isValid, INativeFilter filter) {
    MoaAction action = MoaActionFactory.action("ext-roundedborders");
    action.setValue("padding", mRoundedBordersPaddingPixelSize);
    action.setValue("roundPx", mRoundedBordersPixelSize);
    action.setValue("strokeColor", 0xffa6a6a6);
    action.setValue("strokeWeight", mRoundedBordersStrokePixelSize);
    if (!isValid) {
        action.setValue("overlaycolor", 0x99000000);
    }
    filter.getActions().add(action);
    // shadow
    action = MoaActionFactory.action("ext-roundedshadow");
    action.setValue("color", 0x99000000);
    action.setValue("radius", mShadowRadiusPixelSize);
    action.setValue("roundPx", mRoundedBordersPixelSize);
    action.setValue("offsetx", mShadowOffsetPixelSize);
    action.setValue("offsety", mShadowOffsetPixelSize);
    action.setValue("padding", mRoundedBordersPaddingPixelSize);
    filter.getActions().add(action);
}
Also used : MoaAction(com.aviary.android.feather.library.moa.MoaAction)

Example 2 with MoaAction

use of com.aviary.android.feather.library.moa.MoaAction in project mobile-android by photo.

the class TextPanel method onApplyCurrent.

/**
	 * Flatten the view on the current image
	 * 
	 * @param hv
	 *           the hv
	 */
private MoaActionList onApplyCurrent(final DrawableHighlightView hv) {
    MoaActionList actionList = MoaActionFactory.actionList();
    if (hv != null) {
        setIsChanged(true);
        final RectF cropRect = hv.getCropRectF();
        final Rect rect = new Rect((int) cropRect.left, (int) cropRect.top, (int) cropRect.right, (int) cropRect.bottom);
        final Matrix rotateMatrix = hv.getCropRotationMatrix();
        final int w = mBitmap.getWidth();
        final int h = mBitmap.getHeight();
        final float left = cropRect.left / w;
        final float top = cropRect.top / h;
        final float right = cropRect.right / w;
        final float bottom = cropRect.bottom / h;
        final Matrix matrix = new Matrix(mImageView.getImageMatrix());
        if (!matrix.invert(matrix))
            mLogger.error("unable to invert matrix");
        EditableDrawable editable = (EditableDrawable) hv.getContent();
        editable.endEdit();
        mImageView.invalidate();
        MoaAction action = MoaActionFactory.action("addtext");
        action.setValue("text", (String) editable.getText());
        action.setValue("fillcolor", new MoaColorParameter(mColor));
        action.setValue("outlinecolor", new MoaColorParameter(mStrokeColor));
        action.setValue("rotation", hv.getRotation());
        action.setValue("topleft", new MoaPointParameter(left, top));
        action.setValue("bottomright", new MoaPointParameter(right, bottom));
        actionList.add(action);
        final int saveCount = mCanvas.save(Canvas.MATRIX_SAVE_FLAG);
        mCanvas.concat(rotateMatrix);
        hv.getContent().setBounds(rect);
        hv.getContent().draw(mCanvas);
        mCanvas.restoreToCount(saveCount);
        mImageView.invalidate();
        onClearCurrent(hv);
    }
    onPreviewChanged(mPreview, false);
    return actionList;
}
Also used : RectF(android.graphics.RectF) Rect(android.graphics.Rect) Matrix(android.graphics.Matrix) MoaColorParameter(com.aviary.android.feather.library.moa.MoaColorParameter) MoaActionList(com.aviary.android.feather.library.moa.MoaActionList) EditableDrawable(com.aviary.android.feather.library.graphics.drawable.EditableDrawable) MoaPointParameter(com.aviary.android.feather.library.moa.MoaPointParameter) MoaAction(com.aviary.android.feather.library.moa.MoaAction) Paint(android.graphics.Paint)

Aggregations

MoaAction (com.aviary.android.feather.library.moa.MoaAction)2 Matrix (android.graphics.Matrix)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1 RectF (android.graphics.RectF)1 EditableDrawable (com.aviary.android.feather.library.graphics.drawable.EditableDrawable)1 MoaActionList (com.aviary.android.feather.library.moa.MoaActionList)1 MoaColorParameter (com.aviary.android.feather.library.moa.MoaColorParameter)1 MoaPointParameter (com.aviary.android.feather.library.moa.MoaPointParameter)1