Re: How would Mr. Stroustrup implement his solution to 12.7[2]

From: Oplec (anonymous_at_anonymous.com)
Date: 10/22/03


Date: Wed, 22 Oct 2003 16:24:10 GMT


"David White" <no@email.provided> wrote in message
news:Nlmlb.6612$d6.290296@nasal.pacific.net.au...

> Yes, I've seen these as example OO designs as well, but they are usually
> designs, not working implementations. I just don't think a draw() with no
> parameters is right for a real graphics system. The Shape objects should
be
> independent of the device because it is not only possible, but highly
> likely, that you will sometimes want to print whatever you've drawn on the
> screen.

    If I had were to have free reign over the design, I would most likely
implement a Surface class that Shapes draw to. My only question would then
be whether or not such a Surface should provide the members for drawing to
it, such as put_pixel(), or whether another class should be implemented to
do so. Any ideas?

> Probably. I think the shapes are defined so that the n(), s() etc. members
> are sufficient for the window to draw any shape. This is probably a good
> enough design, or even the best design, for a system with these
limitations.
> Remember it is just an exercise and not necessarily a proposal for the
best
> design for graphics systems in general. For high resolution graphics
systems
> you will want to have dotted or dashed lines, thick or thin lines, curved
> lines, ellipses, pear shapes, closed shapes with various kinds of shading
> etc. The possibilities and complexities are endless, and in my opinion the
> shape object will usually best know how to draw itself. The type of device
> might make a difference too (e.g., raster or non-raster), but the shape
> object is where most of the knowledge belongs. So, for this exercise
> Stroustrup's design is sufficient, but for more complex drawing I don't
> think it is.

    From my understanding of the problem, and how I implemented it, the
Points returned by the n(), e(), ..., members could not be used to draw a
shape unless Window knew of what shape the object being drawn was, such as
Line. That would violate the whole idea of what Mr. Stroustrup wrote in the
chapter; He seems to detest casts.

> No, I think he's using non-const parameters because there's no need to
make
> them const and because it's the convention.

    If it is the convention then I will follow it. Thank you for informing
me of this matter since I was not expecting any help on my code, but it is
most welcome.

    Thank you for your time, Oplec.



Relevant Pages

  • Re: How do I make a web page appear as large as screen when upload
    ... I used the 3 available layers in the design of the website cited above, ... doing avoid "ghosting" of the image in high resolution. ... Publisher allows one to create a decent webpage in far ... including graphics. ...
    (microsoft.public.publisher.webdesign)
  • CFP: 8th International Symposium on Smart Graphics, Rennes, France
    ... 8th International Symposium on SMART GRAPHICS ... Graphics become Smart Graphics when their design and implementation ...
    (comp.ai)
  • Re: Publisher 07 Form Wont Work With Mac
    ... Compress graphics file sizes to create smaller Publisher Web ... Design Gallery Object - I did not realize that ... With your explanation about images affecting text appearance in Firefox, ...
    (microsoft.public.publisher.webdesign)
  • Re: Fully Functional IMSAI-8080 boot CP/M 80 for sale on e-bay
    ... reminiscent of the NEC 765A with its DRQ/DACK interface. ... if the existing Disk IO "pseudo-DMA" design in the Disk IO board ...  DRI never sold a graphics card or a complete system. ... using the chip. ...
    (comp.os.cpm)
  • Re: How would Mr. Stroustrup implement his solution to 12.7[2]
    ... >> pass a reference to the Window object to the Shape's draw(), ... > iterators supplied by each Shape object in order to get the Shape's shape; ... enough design, or even the best design, for a system with these limitations. ... > for parameters over const ints, but I thought he was doing that for some ...
    (comp.lang.cpp)