• 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
Filling bezier path with the image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Filling bezier path with the image


  • Subject: Filling bezier path with the image
  • From: Vinay Prabhu <email@hidden>
  • Date: Thu, 26 Jul 2007 19:48:00 +0530 (IST)

Hi,

I am trying to fill the NSBezierPath with the NSImage.
i.e, drawing NSImage inside the clipping region of the NSBezierPath.

NSAffineTransform* affineTransform = [NSAffineTransform transform];
[affineTransform  scaleXBy:XScale yBy:YScale];
[affineTransform  rotateByDegrees:iRotationAngle];
[affineTransform  translateXBy:XTranslate yBy:YTranslate];

[graphicsPath transformUsingAffineTransform:affineTransform];

//Drawing
NSImage* myImage = [self getImage];
[[NSColor colorWithPatternImage:myImage] set];//I have tried here, "setFill" API also

[graphicsPath fill];

[[NSColor redColor] set];
[graphicsPath stroke];

[self saveTheImage];

In the above code, the stroking of the bezier path works properly. Stroke appears as I am intended.
I was expecting the image to be drawn inside the stroked region, but the image is not drawn inside the path. Part of the image is drawn outside the clipping region.

I have even tried the NSAffineTransform's "concat" API, but the result is same as above code!!!.
I am wondering. how stroke is working properly?

Anything wrong in the above code?
Is there any easy way to draw NSImage in the clipping region of the NSBezierPath?

Thanks & Regards
Vinay
_______________________________________________

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: Filling bezier path with the image
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: Document-based cocoa application with 2 .nibs
  • Next by Date: Re: commitEditing returns selectorNotRecognized
  • Previous by thread: Re: commitEditing returns selectorNotRecognized
  • Next by thread: Re: Filling bezier path with the image
  • Index(es):
    • Date
    • Thread