Graphics
Daisy  Lab Report
Create "Daisy" Bitmap

Purpose
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

Software Requirements
Windows 95, Delphi 3 (to recompile)
Daisy.EXE

Hardware Requirements
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.

Procedure

  1. Double click on the Daisy.EXE icon to start the program. The 640-by-480 pixel image appears on the screen with 1024 daisy "points" (as shown above).
  2. Check or uncheck the R, G, or B checkboxes to see the various color planes in the image.
  3. Press the Write BMP button to save a 1024-by-768 pixel bitmap. If the Blue checkbox is checked, the file Daisy.BMP will contain 3000 daisy "points.".
  4. Press the Print button to create a 2000-by-1500 pixel 24-bit bitmap in memory. If the Blue checkbox is checked, the image will have 12,000 daisy "points." The Image is printed at a specified location on a sheet of paper in landscape orientation.

Discussion
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.

Also see:

Conclusions
ScanLine is a very useful property for creating and manipulating 24-bit images.


Keywords
Golden Ratio, Moiré pattern, TCanvas.Ellipse, TBitmap.ScanLine, GetDeviceCaps

Reference
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.

Download
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.


Updated
26 Feb 2005


since 1 Nov 1998