// get the resize ratio
double resize = (iconSize - 8)
/ (bounds.getWidth() > bounds.getHeight() ? bounds
.getWidth() : bounds.getHeight());
// resize graphics
ShapeModel newShape = shape.clone();
newShape.moveToCenter();
newShape.scale(resize, resize);
// now move it to centre of the icon
newShape.translate(iconSize / 2, iconSize / 2);
for (LineModel line : newShape.getLines()) {
for (int i=0; i<line.getPoints().size()-1; i++) {
drawLine(e.gc, line.getPoints().get(i), line.getPoints().get(i+1));
}
if (line.isClosed()) {
drawLine(e.gc, line.getPoints().get(0), line.getPoints().get(line.getPoints().size()-1));