public Tileset(String name, int tileWidth, int tileHeight, int spacing,
			int margin, int tileOffsetX, int tileOffsetY,
			Map<String, String> properties, BufferedImage image,
			RGBColor imageTransparentColor, boolean imageUseTransparentColor,
			int imageWidth, int imageHeight,
			Map<Integer, TilesetTile> tiles) {
		if (tileWidth < 0 || tileHeight < 0) {
			throw new IllegalArgumentException(
					"tileWidth and tileHeight must be positive");
		}else if (imageWidth < 0 || imageHeight < 0) {
			throw new IllegalArgumentException(
					"imageWidth and imageHeight must be positive");
		}else if (spacing < 0 || margin < 0) {
			throw new IllegalArgumentException(
					"spacing and margin must be positive");
		}
		this.name = name;
		this.tileWidth = tileWidth;
		this.tileHeight = tileHeight;
		this.spacing = spacing;
		this.margin = margin;
		this.tileOffsetX = tileOffsetX;
		this.tileOffsetY = tileOffsetY;
		this.properties = ImmutableProperties.copyOf(properties);
		this.image = Utils.deepCopy(image);
		this.imageTransparentColor = imageTransparentColor;
		this.imageTransparentColorEnabled = imageUseTransparentColor;
		this.imageWidth = imageWidth;
		this.imageHeight = imageHeight;
		this.tiles = ImmutableMap.copyOf(tiles);
	}