locked
how to set png image color in winjs app

    Question

  • Hi I am working on a window 8 app with the help of html and javascript. Where I have to show some png images received from a api and have to set their color as received from the api. I have googled a lot but did not find a solution. Although I know in xaml it can be done some how like this

    <Rectangle Fill="{Binding Path=widget.logo, Converter={StaticResource PSWidgetLogoColorConverter1}}" Height="60" Width="60">
                                            <Rectangle.OpacityMask>
                                                <ImageBrush ImageSource="{Binding Path=widget.logo,Converter={StaticResource PSWidgetImageConverter1}}"/>
                                            </Rectangle.OpacityMask>
                                        </Rectangle>

    but can't figure out how to do it here.

    Your valuable suggestions are welcome pls help.


    Saturday, August 31, 2013 8:10 PM

Answers

  • Hi Yeshveer88,

    Normally, CSS in WinJS is the one which can apply the style to the control as XAML does in C#, you could start from here: http://msdn.microsoft.com/en-us/library/windows/apps/hh700358.aspx

    In your case, We do not have "Rectangle" in HTML, but we could use "Div" instead, and Rectangle.Fill could be replaced by backgroundColor or backgroundImage. I'm not sure how you convert your image but I think you could also write a similar code in Javascript.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, September 2, 2013 1:16 AM
    Moderator