RE: Weird problem with NSBezierpath fill method
RE: Weird problem with NSBezierpath fill method
- Subject: RE: Weird problem with NSBezierpath fill method
- From: Vinay Prabhu <email@hidden>
- Date: Thu, 9 Nov 2006 19:35:39 +0530
- Importance: Normal
The fill method does nothing,
I want to create a alpha layer of the image.
First I am filling the color values (0, 0, 0, 0) to all pixels in the rect.
Next, I am trying to fill the region enclosed in the path with the color
values (1, 1, 1, 1).
The "fill" method works fine if the bezier path is a simple rect. But if it
is a complex
path, as shown in the attached image in earlier mail, "fill" method does
nothing.
Regards
Vinay
-----Original Message-----
From: cocoa-dev-bounces+vinayprabhu=email@hidden
[mailto:cocoa-dev-bounces+vinayprabhu=email@hidden]On
Behalf Of Clint Shryock
Sent: Thursday, November 09, 2006 7:18 PM
To: email@hidden
Subject: Re: Weird problem with NSBezierpath fill method
does the fill method do nothing or is it filling inside the path but not the
path itself?
The fill method does not fill the path, it fills the enclosed region up to
the path. see
here<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit
/Classes/NSBezierPath_Class/Reference/Reference.html#//apple_ref/occ/instm/N
SBezierPath/fill>
"The painted region includes the pixels right up to, but not including, the
path line itself"
hope that helps
On 11/9/06, Vinay Prabhu <email@hidden> wrote:
>
> Hi,
>
> I have encountered a strange problem with the NSBezierPath's, fill method.
> The "fill" method will not fill the path with the current color set.
>
> The code is like this,
>
> //m_pInnerOutline is the object of class NSBezierPath
>
> NSSize aSize;
> aSize.width = m_uiWidth; //Width of the image
> aSize.height = m_uiHeight; //Height of the image
> NSImage* drawImage = nil;
> drawImage = [[NSImage alloc] initWithSize:aSize];
> NSRect fillRect = NSMakeRect(0, 0, aSize.width, aSize.height);
>
> [drawImage lockFocus];
>
> [[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0] set];
> NSRectFill(fillRect);
>
> [[NSColor colorWithCalibratedRed:1 green:0 blue:1 alpha:1] set];
>
> [m_pInnerOutline setLineWidth:2];
> [m_pInnerOutline setWindingRule:NSEvenOddWindingRule];
>
> [m_pInnerOutline stroke]; //This method works
>
> [m_pInnerOutline fill]; //This method doesn't works
>
> [drawImage unlockFocus];
>
> The "stroke" method works fine, but the "fill" method will not work.
> I had saved the drawImage as tif image and attached with the mail.
>
> I am not understanding why "fill" method is not working !!!!
> If bezier path contains only rectangle, the fill method works fine.
>
> Does anybody know what is causing this problem? or anything wrong in the
> code?
>
> Regards
> Vinay
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
in
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden