Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3205] iOS : Masking an Image with Color

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusResolved
ResolutionDone
Resolution Date2015-09-30T01:05:31.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios
ReporterJoseph Sachs
AssigneeShak Hossain
Created2015-04-19T12:43:22.000+0000
Updated2016-03-08T07:57:36.000+0000

Description

Ability to *mask an Image with an array of Colors*, as seen here (attached an image as well to see the effect): https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/dq_images.html#//apple_ref/doc/uid/TP30001066-CH212-CJBHCADE
CGImageRef myColorMaskedImage;
const CGFloat myMaskingColors[6] = {124, 255,  68, 222, 0, 165};
myColorMaskedImage = CGImageCreateWithMaskingColors (image,
                                        myMaskingColors);
CGContextDrawImage (context, myContextRect, myColorMaskedImage);
The Current Titanium.UI.MaskedImage: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.MaskedImage does not allow to mask an image with a color.

Attachments

FileDateSize
chroma_key.gif2015-04-19T12:43:22.000+000010916
ImageMasking.zip2015-04-19T13:11:25.000+000010467987

Comments

  1. Joseph Sachs 2015-04-19

    Sample Code attached. Uses ImageMask with modes.
  2. Harish Mridha 2015-04-20

    Thanks Joseph Sachs , We have tested this issue with TiSDK 3.5.2 GA and 4.0.0 Beta2 on iOS. Its a New Feature and working fine . . *modes*
        var modes = [
               Ti.UI.iOS.BLEND_MODE_CLEAR,
               Ti.UI.iOS.BLEND_MODE_COLOR,
               Ti.UI.iOS.BLEND_MODE_COLOR_BURN,
               Ti.UI.iOS.BLEND_MODE_COLOR_DODGE,
               Ti.UI.iOS.BLEND_MODE_COPY,
               Ti.UI.iOS.BLEND_MODE_DARKEN,
               Ti.UI.iOS.BLEND_MODE_DESTINATION_ATOP,
               Ti.UI.iOS.BLEND_MODE_DESTINATION_IN,
               Ti.UI.iOS.BLEND_MODE_DESTINATION_OUT,
               Ti.UI.iOS.BLEND_MODE_DESTINATION_OVER,
               Ti.UI.iOS.BLEND_MODE_DIFFERENCE,
               Ti.UI.iOS.BLEND_MODE_EXCLUSION,
               Ti.UI.iOS.BLEND_MODE_HARD_LIGHT,
               Ti.UI.iOS.BLEND_MODE_HUE,
               Ti.UI.iOS.BLEND_MODE_LIGHTEN,
               Ti.UI.iOS.BLEND_MODE_LUMINOSITY, // Grayscale
               Ti.UI.iOS.BLEND_MODE_MULTIPLY,
               Ti.UI.iOS.BLEND_MODE_NORMAL,
               Ti.UI.iOS.BLEND_MODE_OVERLAY,
               Ti.UI.iOS.BLEND_MODE_PLUS_DARKER,
               Ti.UI.iOS.BLEND_MODE_PLUS_LIGHTER,
               Ti.UI.iOS.BLEND_MODE_SATURATION,
               Ti.UI.iOS.BLEND_MODE_SCREEN,
               Ti.UI.iOS.BLEND_MODE_SOFT_LIGHT,
               Ti.UI.iOS.BLEND_MODE_SOURCE_ATOP, // Masks underneath 
               Ti.UI.iOS.BLEND_MODE_SOURCE_IN,
               Ti.UI.iOS.BLEND_MODE_SOURCE_OUT,
               Ti.UI.iOS.BLEND_MODE_XOR
           ];
       
    *Log*
       
       [INFO] :   Application started
       [INFO] :   ImageMasking/1.0 (3.5.1.96875c9)
       [INFO] :   0
       [INFO] :   Mode: 16 - idx in Array: 0
       [INFO] :   Mode: 14 - idx in Array: 1
       [INFO] :   Mode: 7 - idx in Array: 2
       [INFO] :   Mode: 6 - idx in Array: 3
       [INFO] :   Mode: 17 - idx in Array: 4
       [INFO] :   Mode: 4 - idx in Array: 5
       [INFO] :   Mode: 24 - idx in Array: 6
       [INFO] :   Mode: 22 - idx in Array: 7
       [INFO] :   Mode: 23 - idx in Array: 8
       [INFO] :   Mode: 21 - idx in Array: 9
       [INFO] :   Mode: 10 - idx in Array: 10
       [INFO] :   Mode: 11 - idx in Array: 11
       [INFO] :   Mode: 9 - idx in Array: 12
       [INFO] :   Mode: 12 - idx in Array: 13
       [INFO] :   Mode: 5 - idx in Array: 14
       [INFO] :   Mode: 15 - idx in Array: 15
       [INFO] :   Mode: 1 - idx in Array: 16
       [INFO] :   Mode: 0 - idx in Array: 17
       [INFO] :   Mode: 3 - idx in Array: 18
       [INFO] :   Mode: 26 - idx in Array: 19
       [INFO] :   Mode: 27 - idx in Array: 20
       [INFO] :   Mode: 13 - idx in Array: 21
       
       

JSON Source