DoodleView Constructor
The constructor (Fig. 7.22) initializes several of the class’s instance variables—the two Maps are initialized in their declarations in Fig. 7.21. Line 49 creates the Paint object paintScreen that will be used to display the user’s drawing on the screen and line 52 creates the Paint object paintLine that specifies the settings for the line(s) the user is currently drawing. Lines 53–57 specify the settings for the paintLine object. We pass true to Paint’s setAntiAlias method to enable anti-aliasing which smooths the edges of the lines. Next, we set the Paint’s style to Paint.Style.STROKE with Paint’s setStyle method. The style can be STROKE, FILL or FILL_AND_STROKE for a line, a filled shape without a border and a filled ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access