PSTilingPattern patternObj = (PSTilingPattern) pattern;
if (this.patternType != patternObj.patternType) {
return false;
}
TexturePaint patternTexture = patternObj.getTexturePaint();
if ( ((patternTexture == null) && (texture != null)) ||
((patternTexture != null) && (texture == null))) {
return false;
}
if ((patternTexture != null) && (texture != null)) {
// compare textures data
int width = texture.getImage().getWidth();
int height = texture.getImage().getHeight();
int widthPattern = patternTexture.getImage().getWidth();
int heightPattern = patternTexture.getImage().getHeight();
if (width != widthPattern) {
return false;
}
if (height != heightPattern) {
return false;
}
int [] rgbData = new int[width * height];
int [] rgbDataPattern = new int[widthPattern * heightPattern];
texture.getImage().getRGB(0, 0, width, height, rgbData, 0, width);
patternTexture.getImage().getRGB(0, 0, widthPattern, heightPattern,
rgbDataPattern, 0, widthPattern);
for (int i = 0; i < rgbData.length; i++) {
if (rgbData[i] != rgbDataPattern[i]) {
return false;