GDI-Managed Attributes: Brushes

GDI also manages all attributes. GDI passes attributes to the driver as brushes; the driver realizes these brushes by converting them to a useful internal form. GDI maintains this converted information for the driver. GDI also maintains all states, including bounds, correlation, current position, and line style. The driver can cache information but is not assumed to maintain any state. Except for initialization and brush realization, GDI calls the driver only to draw on the device. GDI takes care of transforms, region locking, and pointer exclusion before it calls the driver.

Whenever a driver needs to use a brush not yet realized, it calls back to GDI. GDI allocates memory for the brush and calls the driver to realize it and, if necessary, dither it.