|
||
• Geometry 3D |
Bundles A bundle on macOS is very much different from the TBundle discussed here. But usage of the term here predates the macOS one, so there. It comes from the NuGraf proposal at Apple by Mark C, the author of the original MacDraw application. The idea was to collect in one object all the graphics state required for a drawing operation. The Albert project used this convention and Guildhall uses it as well, but I have yet to fill out its full capability, mostly because I haven't yet had much need for the extra goodies. Here's some of the state it might contain:
In practice I've gotten as far as the draw operation, the fill and frame colors, and the pen width. I've done some inconsistent work on the fill and frame operations. The method calls are there for the other features but I tend to let usage drive implementation and I just haven't needed them yet. The practical advantage of this approach is avoiding repeated setup calls for the port. Anything the port needs for drawing is right in the bundle, and in theory the architecture could cache expensive setup. But as I said, I haven't needed that stuff yet. One comment about bundles. They can be constructed in three ways.
This is by far the most convenient way to set the draw operation to fill, frame, and both, though that can also be set explicitly. But also note that although these methods are shown taking a TColor parameter, the actual constructors require TPaint instances. TPaint can take a TColor in its constructor, so C++ automatically promotes TColor to a TPaint. The reason they take a TPaint object is so color operation information could be included, for example operations for additive color, subtractive color, lightening, or darkening. This hasn't been nearly as useful since alpha channel usage became ubiquitous, but I expect that I'll use them again when the Paint applet gets farther along. Constructible Classes
|