ET++: A sample application: iconedit

Every ET++ application which uses the view metaphore must subclass the View class. FatIconView is the iconedit view class which shows an enlarged view of the bitmap. This method draws the enlarged bitmap by iterating through all its pixels. There is also an IconView class which is similar to FatIconView, but shows the icon at normal size. Both use the Observer pattern to ensure that they are updated whenever the underlying image changes.


void FatIconView::Draw(Rectangle r)
{
	[ ... misc initializations, erase grid ... ]

	Rectangle rr(scale-1);
	for (y= p1.y; y < p2.y; y++) {
		for (x= p1.x; x < p2.x; x++) {
			rr.origin.x= x*scale+margin.x+1;
			rr.origin.y= y*scale+margin.y+1;
			im->Index2RGB(im->GetIndex(x, y), &rgb);
			rc.SetRGB(&rgb);
			GrPaintRect(rr, &rc);
		}
	}
		
	[ ... draw box around fat icon ... ]
	[ ... show selection ... ]
}

Back to the top of the IconEdit description

Back to the top of the ET++ pages