Pattern pattern1 = new Pattern(device, rect.x, rect.y, rect.width / 2f, rect.height / 2f, color1, color2);
gc.setBackgroundPattern(pattern1);
Path path = new Path(device);
path.addRectangle(0, 0, width / 4f, height / 4f);
path.addRectangle(width / 4f, height / 4f, width / 4f, height / 4f);
gc.fillPath(path);
path.dispose();
Pattern pattern2 = new Pattern(device, rect.width, 0, rect.width / 2f, rect.height / 2f, color1, color2);
gc.setBackgroundPattern(pattern2);
path = new Path(device);