Drawing icons
The drawIcon:x:y:icon: method of CgDrawable is used to draw CgIcon objects. The following code draws the icon, created in the previous example, at the top left corner of the screen. The icon is freed because it is no longer required.
CgWindow default
drawIcon: CgGC default
x: 0
y: 0
icon: icon.
icon freeIcon
 
sp006155
 
As with images, CgIcons have a platform- and device-independent data representation. However, for speed, CgIcons are displayed using the operating system's representation of icons. On OS/2 PM the limit is 32x32 or 40x40, depending on the video driver. On Windows, the size of operating-system icons is limited to 32x32. If an icon is created larger than the maximum size on these platforms, it is clipped to the maximum size and only its top left corner is drawn.
The best icon size to use can be obtained by sending queryBestIconSize to the CgScreen. On Window and OS/2 PM this size is the maximum displayable icon size. On X this size is only a suggestion, not a hard limit.
CgIcons are displayed using only the default palette colors. It is not necessary to select a palette in the destination drawable. The drawIcon: method ignores the selected palette.
Last modified date: 04/18/2020