It seems natural that the Rect will mark the entire shape from the topleft to bottomright point.
Having one DrawObject supporting all these shapes makes some of the properties a bit difficult to get consistent. To get the entire width for a circle, I have do Width*2. For polygons I have to go thru the points and calculate it myself..? The shapes have quite different characteristics.. All: rect, points Circle: centerposition, radius, diameter What should width and hight return? Radius? Diameter? Polygons: centerposition For polygons width and height doesn't make sense, but if you need the bounding box, you can use the rect property. Line: startPosition, stopPosition, length (longest difference between points), width (penwidth). Rect for a line will of course give a very large rect if it's a diagonal line, but as long as rect always gives the bounding box this is ok. Rect, Bmp, Text: width, height, position (topleft) This is taken from the top of my head, but I think it will be very difficult to support everything you want/need in a single class. The different behaviours will give subtle bugs and cause confusion. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ed Leafe Sent: 12. juli 2007 15:08 To: Dabo Users list Subject: Re: [dabo-users] Text DrawObject.Width On Jul 12, 2007, at 8:59 AM, Simen Haugen wrote: > Perhaps you can also add a read-only Rect property? > > I was also thinking about how nice it would be to have the rect > intersect etc. functions on the window level as something like this: I was just thinking about this very thing. I've added support for Width, Height and Size to all the draw objects, but Position has me a little stumped. It's clear enough for rectangles and text, but what about a circle? That's drawn by specifying the center and radius, and Xpos/Ypos refer to the center, not the left/top. Same goes for polygons. Having a Rect that defines the rectangular area makes this a little less critical. What do you think? -- Ed Leafe -- http://leafe.com -- http://dabodev.com [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
