Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-17363] Android/iOS: Added "MaskedImage" support to Android. Moved BLEND_MODE constants to "Ti.UI". #10013

Merged
merged 10 commits into from
May 17, 2018
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2018 by Axway, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
package ti.modules.titanium.ui;

import android.app.Activity;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.view.TiUIView;
import ti.modules.titanium.ui.widget.TiUIMaskedImage;

// clang-format off
@Kroll.proxy(creatableInModule = UIModule.class,
propertyAccessors = {
TiC.PROPERTY_IMAGE,
TiC.PROPERTY_MASK,
TiC.PROPERTY_MODE,
TiC.PROPERTY_TINT,
TiC.PROPERTY_TINT_COLOR
})
// clang-format on
public class MaskedImageProxy extends ViewProxy
{
public MaskedImageProxy()
{
defaultValues.put(TiC.PROPERTY_MODE, UIModule.BLEND_MODE_SOURCE_IN);
}

@Override
public TiUIView createView(Activity activity)
{
return new TiUIMaskedImage(this);
}

@Override
public String getApiName()
{
return "Ti.UI.MaskedImage";
}
}
57 changes: 57 additions & 0 deletions android/modules/ui/src/java/ti/modules/titanium/ui/UIModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,63 @@ public class UIModule extends KrollModule implements Handler.Callback
@Kroll.constant
public static final String AUTOFILL_TYPE_CARD_EXPIRATION_YEAR = View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR;

@Kroll.constant
public static final int BLEND_MODE_NORMAL = 0;
@Kroll.constant
public static final int BLEND_MODE_MULTIPLY = 1;
@Kroll.constant
public static final int BLEND_MODE_SCREEN = 2;
@Kroll.constant
public static final int BLEND_MODE_OVERLAY = 3;
@Kroll.constant
public static final int BLEND_MODE_DARKEN = 4;
@Kroll.constant
public static final int BLEND_MODE_LIGHTEN = 5;
@Kroll.constant
public static final int BLEND_MODE_COLOR_DODGE = 6;
@Kroll.constant
public static final int BLEND_MODE_COLOR_BURN = 7;
@Kroll.constant
public static final int BLEND_MODE_SOFT_LIGHT = 8;
@Kroll.constant
public static final int BLEND_MODE_HARD_LIGHT = 9;
@Kroll.constant
public static final int BLEND_MODE_DIFFERENCE = 10;
@Kroll.constant
public static final int BLEND_MODE_EXCLUSION = 11;
@Kroll.constant
public static final int BLEND_MODE_HUE = 12;
@Kroll.constant
public static final int BLEND_MODE_SATURATION = 13;
@Kroll.constant
public static final int BLEND_MODE_COLOR = 14;
@Kroll.constant
public static final int BLEND_MODE_LUMINOSITY = 15;
@Kroll.constant
public static final int BLEND_MODE_CLEAR = 16;
@Kroll.constant
public static final int BLEND_MODE_COPY = 17;
@Kroll.constant
public static final int BLEND_MODE_SOURCE_IN = 18;
@Kroll.constant
public static final int BLEND_MODE_SOURCE_OUT = 19;
@Kroll.constant
public static final int BLEND_MODE_SOURCE_ATOP = 20;
@Kroll.constant
public static final int BLEND_MODE_DESTINATION_OVER = 21;
@Kroll.constant
public static final int BLEND_MODE_DESTINATION_IN = 22;
@Kroll.constant
public static final int BLEND_MODE_DESTINATION_OUT = 23;
@Kroll.constant
public static final int BLEND_MODE_DESTINATION_ATOP = 24;
@Kroll.constant
public static final int BLEND_MODE_XOR = 25;
@Kroll.constant
public static final int BLEND_MODE_PLUS_DARKER = 26;
@Kroll.constant
public static final int BLEND_MODE_PLUS_LIGHTER = 27;

@Kroll.constant
public static final int INPUT_BORDERSTYLE_NONE = 0;
@Kroll.constant
Expand Down