• 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
still cant get bezier paths working for me.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

still cant get bezier paths working for me.


  • Subject: still cant get bezier paths working for me.
  • From: Development <email@hidden>
  • Date: Mon, 25 Feb 2008 21:55:16 -0700

Well... bezierpaths have officially confused me beyond reason... I am hoping that some one will be able to help me based on the amount of code that I can paste in to an email with out it getting bounced.

First, I am trying to create a pen tool similar to something you'd find in photoshop. After more reading and trial and error I have gotten a tad closer but not much. This code is based on the sketch example code, I figured that would be a good place to start. However I am thinking that it is not possible to use bezier paths for this.
First time through I've tried to use an instance variable to maintain the path, but it had two problems, the first is that the rectangle around the path shifted size, even though I had though append path would prevent this. When the rect shifted sizes it cut out the edges of what ever I drew. Second, as soon as I let off the mouse button the application would crash. The instance variable was the cause. I attempted to NSLog it to get some information but that would cause the application to crash also. The variable however was not NULL or nil so I honestly do not know how to deal with this... I could not find the reason for it.
Next I just return the current part of the path but then I only end up with a dot chasing the cursor. But no crash.
I tried using a point array but apparently I don't understand how they work, I thought it was like any plain old char array. below is the code that produces the single dot... if some one could suggest how I could make the line persistent I'd be grateful. Should I be trying to keep an array of point returning newPath with appendPoints?


- (NSBezierPath *)bezierPath {

	if(![self strokeLineWidth]){
		return NULL;
		}

	if(!lastPointSet){
		lastPoint = [self bounds].origin;
		lastPointSet= YES;
		}

NSPoint dotPoint = [[[[self document]windowController]graphicView]currentPoint];
NSBezierPath * newPath =[NSBezierPath bezierPath];
[[self fillColor]set];
[newPath moveToPoint:dotPoint];
[newPath lineToPoint:lastPoint];
[newPath stroke];
lastPoint = dotPoint;


    return newPath;
}
_______________________________________________

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: still cant get bezier paths working for me.
      • From: Graham <email@hidden>
  • Prev by Date: Re: Observing with GC
  • Next by Date: Re: Observing with GC
  • Previous by thread: which choice to implement iterations on separate threads
  • Next by thread: Re: still cant get bezier paths working for me.
  • Index(es):
    • Date
    • Thread