The "Daisy" program shows how to create a new 24-bit bitmap using a combination of Canvas methods (namely Canvas.Ellipse for Blue information) and ScanLine (to add Green and Blue information). This 24-bit bitmap can be displayed on the screen, printed, or saved to a BMP file.
Materials and Equipment
Windows 95, Delphi 3 (to recompile)
Best when run on 800 x 600 pixel (or higher) monitor in high color or true color mode. Colors will not be very good in the 256 color mode.
The Daisy image, especially when printed with only the "blue" plane, is quite a Moiré pattern when printed on a HP LaserJet 5 (or equivalent).
The ImageProcessingPrimitives.PAS unit defines the TYPEs TRGBTripleArray and pRGBTripleArray, which are very useful for working with 24-bit color bitmaps.
The DrawDaisy procedure shows how to use one routine to draw on any canvas,
The PrintBitmap routine in this unit uses the StretchDIBits API call to properly print the image on any color printer.
See Split in Image Processing to break this image into its red, green, and blue planes.
ScanLine is a very useful property for creating and manipulating 24-bit images.
Golden Ratio, Moiré pattern, TCanvas.Ellipse, TBitmap.ScanLine, GetDeviceCaps
Mathographics by Robert Dixon, Section 5.1, "On Drawing a Daisy," Dover Publications, New York, 1987. Algorithm is on p. 131. Example "True Daisy" image is on p. 142.
Delphi 3 Source and EXE (122 KB): Daisy.ZIP
Compiles without any changes in D4. D3 EXE is 220 KB, while D4 EXE is 310 KB.
26 Feb 2005
since 1 Nov 1998