The Document’s Data: Class CStroke
In Scribble, a stroke consists of an array of points. As the user drags the mouse to draw, Scribble collects points and stores them as part of the current stroke. Points collected from the time the left mouse button is pressed to the time it’s released form one stroke of a Scribble drawing. The figure below shows Scribble’s data structure schematically. Scribble uses an object of class CPen for drawing.
Scribble’s m_strokeList Data Structure
Each stroke is stored in an object of class CStroke
, Scribble’s primary data structure, which, in the next topic, you’ll add as a new class in Scribble’s files (ScribbleDoc.h and ScribbleDoc.cpp). The whole drawing is a list of CStroke
objects.