• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Transparent Image with Tint Color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent Image with Tint Color


  • Subject: Re: Transparent Image with Tint Color
  • From: Kyle Sluder <email@hidden>
  • Date: Sun, 29 Sep 2013 18:54:06 -0700

> On Sep 29, 2013, at 5:01 PM, Paul Scott <email@hidden> wrote:

>
> So, I successfully update the image src attribute within the UIWebView page using imageWithRederingMode:UIImageRederingModeAlwaysTemplate. However, the image appears "unrendered" with the tint color. Why?

Because you misunderstand how template images work.

-imageWithRenderingMode just returns a shallow copy of your UIImage that returns the passed value when asked for its renderingMode. It does not create an image that draws itself in the tint color. How could it? The image has no idea what view's tint color to adopt at initialization or at drawing time.


> How do I get an image rendered in the tint color?

Start a bitmap context, set your template image as the image mask, set the full color to the appropriate tintColor, and fill the bounds of the context.

Construct a data URI out of the image you get by closing the bitmap context.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Transparent Image with Tint Color
      • From: Paul Scott <email@hidden>
References: 
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)
 >Re: Transparent Image with Tint Color (From: Paul Scott <email@hidden>)

  • Prev by Date: Re: Transparent Image with Tint Color
  • Next by Date: Re: Transparent Image with Tint Color
  • Previous by thread: Re: Transparent Image with Tint Color
  • Next by thread: Re: Transparent Image with Tint Color
  • Index(es):
    • Date
    • Thread