Skip to content

MultiplyFilter has no effect on some views #20

@lunarraid

Description

@lunarraid
import ui.View as View;
import ui.ImageView as ImageView;
import ui.ImageScaleView as ImageScaleView;
from ui.filter import MultiplyFilter;


exports = Class( GC.Application, function()
{
    this.initUI = function()
    {
        // This app has only been tested in the Chrome Browser on OSX.

        var colorFilter = new MultiplyFilter( { r: 255, g: 255, b: 0 } );

        // Regular ImageView, filter works as expected

        var image = new ImageView({
            superview: this,
            image: "resources/images/round-rectangle.png",
            x: 0,
            y: 0,
            width: 128,
            height: 128
        });

        image.setFilter( colorFilter );

        // ImageScaleView with no slicing applied, filter works as expected

        var nonScaledImage = new ImageScaleView({
            superview: this,
            x: 128,
            y: 0,
            width: 128,
            height: 128,
            image: "resources/images/round-rectangle.png"
        });

        nonScaledImage.setFilter( colorFilter );

        // ImageScaleView with slicing, filter has no effect

        var scaledImage = new ImageScaleView({
            superview: this,
            x: 256,
            y: 0,
            width: 128,
            height: 128,
            image: "resources/images/round-rectangle.png",
            scaleMethod: "9slice",
            sourceSlices: {
                horizontal: { left: 30, center: 2, right: 30 },
                vertical: { top: 30, middle: 2, bottom: 30 }
            }
        });

        scaledImage.setFilter( colorFilter );

        // Regular View with a child inside. Filter has no effect, though I cannot tell
        // from the docs whether this is intended behavior or not. Including just in case.

        var container = new View({
            superview: this,
            x: 0,
            y: 128,
            width: 128,
            height: 128
        });

        container.setFilter( colorFilter );

        new ImageView({
            superview: container,
            image: "resources/images/round-rectangle.png",
            x: 0,
            y: 0,
            width: 128,
            height: 128
        });

    };
} );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions