• 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
[ANN] v 0.3 of MPWDrawingContext, a pleasant Objective-C drawing context updated with blocks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] v 0.3 of MPWDrawingContext, a pleasant Objective-C drawing context updated with blocks


  • Subject: [ANN] v 0.3 of MPWDrawingContext, a pleasant Objective-C drawing context updated with blocks
  • From: Marcel Weiher <email@hidden>
  • Date: Mon, 21 Jan 2013 20:48:32 +0100

Hi folks,

just a heads-up that I just pushed v 0.3 of MPWDrawingContext to github:    https://github.com/mpw/MPWDrawingContext

The major enhancements have to do with using blocks for bracketing operations ( save/restore graphics state, shadow on/off, transparency layer begin/end) and delayed/repeated drawing, including patterns.  Especially the latter manages to unify a lot of slightly different code-paths and removes a lot of boilerplate.   You can let the context automatically choose the 'best' representation for repeated drawing or control the choice yourself with minimal changes to code.

In addition, there's support for using single object arguments to messages like moveto:, lineto: and translate:, in addition to the versions taking two floats (moveto:: , lineto::, translate:: ).

More here:   http://blog.metaobject.com/2013/01/more-objective-c-drawing-context.html

Hope this is useful.

Marcel


On Jun 16, 2012, at 21:37 , Marcel Weiher <email@hidden> wrote:

> MPWDrawingContext is a light-weight Objective-C wrapper around CoreGraphics CGContextRef and corresponding functions.
>
> Code is on Github:    https://github.com/mpw/MPWDrawingContext
>
> Infrequently Asked Questions:
>
> Why would anyone need an Objective-C drawing context?
>
> In short, while CoreGraphics is an awesome graphics subsystem, not having OO features makes CGContext closed to extension by anyone but Apple, and somewhat unpleasant to use, IMHO.
>
> I explain a bit more about the motivation on my blog:   http://blog.metaobject.com/2012/06/pleasant-objective-c-drawing-context.html
[...]
> Who cares about less code?
>
> Well, it\s not just less code, it's more pleasant code as well:
>
> 	[[[[[context moveto:0 :0] lineto:100 :0] lineto:50 :50] closepath] stroke];
>
> vs.
>
> 	CGContextMoveToPoint( context, 0, 0 );
> 	CGContextAddLineToPoint( context, 100, 0);
> 	CGContextAddLineToPoint( context, 50, 50 );
> 	CGContextClosePath( context );
> 	CGContextFillPath( context );
>
> And
>
> 	bitmapContext = [MPWCGDrawingContext rgbBitmapContext:NSMakeSize( 595, 842 )];
>
> vs.
>
> 	bitmapContext = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0,
>                            CGColorSpaceCreateDeviceRGB(),
>                            kCGImageAlphaPremultipliedLast)  | kCGBitmapByteOrderDefault );
>
>
> No it's not!
>
> OK :-)
>
>
> Marcel
>

_______________________________________________

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

  • Prev by Date: Re: How to avoid warning?
  • Next by Date: How can I get rid of this warning message?
  • Previous by thread: Re: How to avoid warning?
  • Next by thread: How can I get rid of this warning message?
  • Index(es):
    • Date
    • Thread