• 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: CGContextShowTextAtPoint doesn't show text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGContextShowTextAtPoint doesn't show text


  • Subject: Re: CGContextShowTextAtPoint doesn't show text
  • From: glenn andreas <email@hidden>
  • Date: Tue, 09 Aug 2011 09:53:24 -0500

On Aug 9, 2011, at 9:48 AM, Gabriel Zachmann wrote:

> Thanks a lot for your response ...
>
>> I've found the Core Graphics text handling methods to be gnarly and awkward the few times I've attempted to use them, and always ended up going some other route to render text.
>
> Could you please point me to a few of them?
>
>>
>> In your case, the choice seems simple - just use CATextLayer. Why not?
>
> Can CATextLayer render text with a shadow?
> Like this:
>  CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
>
> I really need the shadow to be able to discern it from a background layer, the color of which is unknown and changes fairly often.


CATextLayer is a subclass of CALayer, which has a wide variety of shadowing options:

/** Shadow properties. **/

/* The color of the shadow. Defaults to opaque black. Colors created
 * from patterns are currently NOT supported. Animatable. */

@property CGColorRef shadowColor;

/* The opacity of the shadow. Defaults to 0. Specifying a value outside the
 * [0,1] range will give undefined results. Animatable. */

@property float shadowOpacity;

/* The shadow offset. Defaults to (0, -3). Animatable. */

@property CGSize shadowOffset;

/* The blur radius used to create the shadow. Defaults to 3. Animatable. */

@property CGFloat shadowRadius;

/* When non-null this path defines the outline used to construct the
 * layer's shadow instead of using the layer's composited alpha
 * channel. The path is rendered using the non-zero winding rule.
 * Specifying the path explicitly using this property will usually
 * improve rendering performance, as will sharing the same path
 * reference across multiple layers. Defaults to null. Animatable. */

@property CGPathRef shadowPath;



So not only does it have a shadow that you can change, you can even animate the shadow.

Glenn Andreas                      email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL

_______________________________________________

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

References: 
 >CGContextShowTextAtPoint doesn't show text (From: Gabriel Zachmann <email@hidden>)
 >Re: CGContextShowTextAtPoint doesn't show text (From: Graham Cox <email@hidden>)
 >Re: CGContextShowTextAtPoint doesn't show text (From: Gabriel Zachmann <email@hidden>)

  • Prev by Date: Re: CGContextShowTextAtPoint doesn't show text
  • Next by Date: Re: Using #define a good way for String constants, like enums for NSIntegers?
  • Previous by thread: Re: CGContextShowTextAtPoint doesn't show text
  • Next by thread: Re: CGContextShowTextAtPoint doesn't show text
  • Index(es):
    • Date
    • Thread