// 色を変換したグラフィックスデータを生成 int outputGraphics = newGraphics( inputGraphics, // 元の画像を保持するグラフィックスデータ fromRed, fromGreen, fromBlue, fromAlpha, // 変換したい色(ユーザーが選んだ色) toRed, toGreen, toBlue, toAlpha // 変換後の色(透明) );