• 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: 1-bit NSBitmapImageRep?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1-bit NSBitmapImageRep?


  • Subject: Re: 1-bit NSBitmapImageRep?
  • From: Peter Zegelin <email@hidden>
  • Date: Fri, 18 Apr 2008 12:15:00 +1000


On 18/04/2008, at 11:30 AM, Graham Cox wrote:


On 18 Apr 2008, at 11:21 am, Peter Zegelin wrote:
I'm new here so excuse me if I end up leading you in the wrong direction but I'm working on a drawing program and will end up having to solve the exact same problem. In my current implementation - written in REALBasic - instead of drawing the whole shape I use a very small bitmap (basically the size of the valid hit area) and do some calculations to draw the shape into that, in the correct position. I then check - from the middle out - to see if a pixel has changed. This has the advantage of being able to give you a 'closeness factor' - thats why I check from the middle out.

I did think of this type of approach but the problem is that the hit area changes very rapidly in some cases (think of dragging a selection rect over a series of objects for example) which means that you end up redrawing this a hell of a lot. That said, the approach has a lot of merit and may well be the better one in the long run.

I'm using a different method for the selection rectangle - just doing a line intersection (4x) on the points of the path and a further test at the end to see if the shape is completely within the rectangle as in this case there will be no intersecting lines. I only use the technique I described on mousedown.


Main problem I found was its hard to get the calculations right when taking scaling into account, and I never did get it quite right.

Yep, all those transformations can be hard work ;-)

If you are trying to make a vector-type drawing program and want to go the Cocoa route, you might be interested in my project - see http://apptree.net/drawkit.htm

I already have it ;-) I'm using C++ for the actual 'engine' part though as its a fairly straight forward conversion from RB and I want to keep it as cross platform as possible. Interesting to see the different approaches people take for the same problems. Mine is always 'way' different which is a worry sometimes ;-)


My effort - AlphaDraw - is here: http://www.fracturedsoftware.com/developer/alphadraw/

regards,

Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: AU-Newbie question re: parameters and Process()
  • Next by Date: If I have contracting work for a Core Audio Guru, can I post it here?
  • Previous by thread: Re: AU-Newbie question re: parameters and Process()
  • Next by thread: If I have contracting work for a Core Audio Guru, can I post it here?
  • Index(es):
    • Date
    • Thread