• 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: - [UIImage draw9PartImage:inRect:] equivalent in Cocoa/Quartz?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: - [UIImage draw9PartImage:inRect:] equivalent in Cocoa/Quartz?


  • Subject: Re: - [UIImage draw9PartImage:inRect:] equivalent in Cocoa/Quartz?
  • From: Vince DeMarco <email@hidden>
  • Date: Thu, 07 Feb 2008 16:51:36 -0800


On Feb 5, 2008, at 4:24 PM, Todd Ditchendorf wrote:

The UIImage class in UIKit has a wonderful collection of methods for programatically slicing a single small sample image into 3 or 9 parts and stretching the middle parts allowing very simple rounded rect effects.

http://ericasadun.com/iPhoneDocs113/interface_u_i_image.html


This capability has also recently been added to WebKit's CSS support via -webkit-border-image I believe.


My question: Is there any similar method or function available to Cocoa on the desktop? Either a cocoa method or a function in the Quartz APIs, or elsewhere?

thanks!

todd

Look at NSCell.h


/* Draw an image from two end caps and a fill. The end caps are scaled proportionally to match the thickness of the destination frame. In the horizontal case\
, the startCap is drawn into the left part of the destination, the endCap is drawn into the right part of the destination, and the fill is tiled over the remai\
ning area. The caps and the fill should all be the same height. The vertical case is similar.


This is an appropriate way to draw the bezel of a button that can be resized in one dimension.
*/
APPKIT_EXTERN void NSDrawThreePartImage(NSRect frame, NSImage *startCap, NSImage *centerFill, NSImage *endCap, BOOL vertical, NSCompositingOperation op, CGFloa\
t alphaFraction, BOOL flipped) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


/* Draw an image from nine pieces. When drawn, the destination rect is partitioned into nine rectangular regions: the corner pieces are the natural size of th\
e corner images, the edge pieces are the natural size of the edge fill images in the direction perpendicular to the edge and flush with the corners. The cente\
r rect fills the remaining space. The supplied images and fills are drawn into the corresponding regions, with fill images tiled at their natural dimensions. \
Images that share a border should have the same thickness in that dimension.


This method is appropriate for the bezel of a control, like a box, that can be resized in both dimensions.
*/
APPKIT_EXTERN void NSDrawNinePartImage(NSRect frame, NSImage *topLeftCorner, NSImage *topEdgeFill, NSImage *topRightCorner, NSImage *leftEdgeFill, NSImage *cen\
terFill, NSImage *rightEdgeFill, NSImage *bottomLeftCorner, NSImage *bottomEdgeFill, NSImage *bottomRightCorner, NSCompositingOperation op, CGFloat alphaFracti\
on, BOOL flipped) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;












_______________________________________________

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: 
 >- [UIImage draw9PartImage:inRect:] equivalent in Cocoa/Quartz? (From: Todd Ditchendorf <email@hidden>)

  • Prev by Date: Re: Server Address from Mounted SMB Volume
  • Next by Date: no method found returning 'id'
  • Previous by thread: - [UIImage draw9PartImage:inRect:] equivalent in Cocoa/Quartz?
  • Next by thread: Garbage Collection in Objective-C++
  • Index(es):
    • Date
    • Thread