|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectkinugasa.contents.graphics.ImageUtil
public final class ImageUtil
画像のIOや簡易編集を行うユーティリティクラスです.
このクラスからロードした画像は、通常の方法でロードされた画像よりも
高速に描画できる可能性があります。
また、このクラスのロード機能は、同じファイルパスを指定すると
同じ画像インスタンスを返します。
フィールドの概要 | |
---|---|
private static java.awt.GraphicsConfiguration |
gc
デフォルトのウインドウシステムがサポートする画像の生成機能を持った、グラフィックスの設定です. |
private static java.util.HashMap<java.lang.String,java.lang.ref.SoftReference<java.awt.image.BufferedImage>> |
IMAGE_CACHE
ロードした画像をキャッシュするためのマップです. |
コンストラクタの概要 | |
---|---|
private |
ImageUtil()
ユーティリティクラスのためインスタンス化できません. |
メソッドの概要 | |
---|---|
static java.awt.image.BufferedImage[] |
columns(java.awt.image.BufferedImage src,
int x,
int w,
int h)
BudderdImageのx, 0 からw, hのサイズで縦方向に画像を分割し、配列として返します. |
static java.awt.image.BufferedImage |
copy(java.awt.image.BufferedImage src)
BufferedImageの複製を新しいインスタンスとして返します. |
static java.awt.image.BufferedImage |
copy(java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dst)
BufferedImageの複製を作成し、dstに格納します. |
static java.awt.Graphics2D |
createGraphics2D(java.awt.image.BufferedImage image,
RenderingPolicy renderingPolicy)
画像に書き込むためのグラフィクスコンテキストを作成します. |
static java.awt.GraphicsConfiguration |
getGraphicsConfiguration()
メインスクリーンのデバイス設定を取得します。 |
static int[] |
getPixel(java.awt.image.BufferedImage image)
BufferedImageのピクセルデータを配列として取得します. |
static int[][] |
getPixel2D(java.awt.image.BufferedImage image)
BufferedImageのピクセルデータを二次元配列として取得します. |
static java.awt.image.BufferedImage |
lineUp(java.awt.image.BufferedImage... images)
画像配列を水平方向に並べた新しい画像を作成して返します. |
static java.awt.image.BufferedImage |
load(java.lang.String filePath)
BufferedImageをファイルから作成します. |
static java.awt.image.BufferedImage |
newImage(int width,
int height)
新しい空のBufferedImageを生成します. |
static java.awt.image.BufferedImage[] |
rows(java.awt.image.BufferedImage src,
int y,
int w,
int h)
BudderdImageの0, y からw, hのサイズで横方向に画像を分割し、配列として返します. |
static void |
save(java.lang.String filePath,
java.awt.image.BufferedImage image)
BufferedImageをファイルに保存します. |
static void |
screenShot(java.lang.String FILE_PATH,
java.awt.Rectangle BOUNDS)
指定された領域のキャプチャを指定されたファイルに保存します. |
static void |
setPixel(java.awt.image.BufferedImage image,
int[] pix)
BufferedImageにピクセルデータを設定します. |
static void |
setPixel2D(java.awt.image.BufferedImage image,
int[][] pix)
BufferedImageにピクセルデータを設定します. |
static java.awt.image.BufferedImage[][] |
splitAsArray(java.awt.image.BufferedImage src,
int w,
int h)
BufferedImageの0, 0,からw, hのサイズで二次元に画像を分割し、配列として返します. |
static java.util.List<java.awt.image.BufferedImage> |
splitAsList(java.awt.image.BufferedImage src,
int w,
int h)
BufferedImageの0, 0,からw, hのサイズで二次元に画像を分割し、リストとして返します. |
static java.util.Map<java.lang.String,java.awt.image.BufferedImage> |
splitAsMap(java.awt.image.BufferedImage src,
int w,
int h)
BufferedImageの0, 0,からw, hのサイズで二次元に画像を分割し、マップとして返します. |
static java.awt.image.BufferedImage |
tiling(java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dst,
int xNum,
int yNum)
ソース画像を指定された数だけ水平方向に並べた画像を作成します. |
static java.awt.image.BufferedImage |
tiling(java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dst,
int xNum,
int yNum,
int drawWidth,
int drawHeight)
ソース画像を指定された数だけ水平方向に並べた画像を作成します. |
static java.awt.image.BufferedImage[] |
transparentArray(java.awt.image.BufferedImage image,
float initialTp,
float addTp)
1つの画像の透過度をinitialTpからdecTpずつ変更した画像を配列として返します. |
static java.awt.image.BufferedImage |
trimming(java.awt.image.BufferedImage src,
int x,
int y,
int width,
int height)
|
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
private static final java.awt.GraphicsConfiguration gc
private static final java.util.HashMap<java.lang.String,java.lang.ref.SoftReference<java.awt.image.BufferedImage>> IMAGE_CACHE
コンストラクタの詳細 |
---|
private ImageUtil()
メソッドの詳細 |
---|
public static java.awt.GraphicsConfiguration getGraphicsConfiguration()
public static java.awt.image.BufferedImage newImage(int width, int height)
width
- 画像の幅をピクセル単位で指定します。height
- 画像の高さをピクセル単位で指定します。public static java.awt.image.BufferedImage copy(java.awt.image.BufferedImage src)
src
- コピーする画像。public static java.awt.image.BufferedImage copy(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
src
- コピーする画像。dst
- nullでない場合このインスタンスに結果が格納される。public static java.awt.image.BufferedImage load(java.lang.String filePath) throws ContentsFileNotFoundException, ContentsIOException
filePath
- 読み込むファイルパス。ContentsFileNotFoundException
- ファイルが存在しない場合に投げられる。ContentsIOException
- ファイルがロードできない場合に投げられます。public static void save(java.lang.String filePath, java.awt.image.BufferedImage image) throws ContentsIOException
filePath
- 書き込むファイルパス.上書きは確認されず、拡張子も任意。image
- 書き込む画像。ContentsIOException
- ファイルが書き込めない場合に投げられる。public static int[] getPixel(java.awt.image.BufferedImage image)
image
- ピクセルデータを取得する画像を送信します。public static int[][] getPixel2D(java.awt.image.BufferedImage image)
image
- ピクセルデータを取得する画像を送信します。public static void setPixel(java.awt.image.BufferedImage image, int[] pix)
image
- ピクセルデータを設定する画像。pix
- 設定するピクセルデータ。public static void setPixel2D(java.awt.image.BufferedImage image, int[][] pix)
image
- 画像。pix
- 設定するピクセルデータ。public static java.awt.Graphics2D createGraphics2D(java.awt.image.BufferedImage image, RenderingPolicy renderingPolicy)
image
- グラフィックスコンテキストを取得する画像を指定します。 renderingPolicy
- nullでない場合、このレンダリング設定がグラフィックスコンテキストに適用されます。public static java.awt.image.BufferedImage[] rows(java.awt.image.BufferedImage src, int y, int w, int h) throws java.awt.image.RasterFormatException
src
- 画像。y
- Y座標。w
- 切り出す幅。h
- 切り出す高さ。java.awt.image.RasterFormatException
- 座標またはサイズが不正な場合に投げられる。public static java.awt.image.BufferedImage[] columns(java.awt.image.BufferedImage src, int x, int w, int h) throws java.awt.image.RasterFormatException
src
- 画像。x
- X座標。w
- 切り出す幅。h
- 切り出す高さ。java.awt.image.RasterFormatException
- 座標またはサイズが不正な場合に投げられる。public static java.util.List<java.awt.image.BufferedImage> splitAsList(java.awt.image.BufferedImage src, int w, int h) throws java.awt.image.RasterFormatException
src
- 画像。w
- 切り出す幅。h
- 切り出す高さ。java.awt.image.RasterFormatException
- 座標またはサイズが不正な場合に投げられる。public static java.awt.image.BufferedImage[][] splitAsArray(java.awt.image.BufferedImage src, int w, int h) throws java.awt.image.RasterFormatException
src
- 画像。w
- 切り出す幅。h
- 切り出す高さ。java.awt.image.RasterFormatException
- 座標またはサイズが不正な場合に投げられる。public static java.util.Map<java.lang.String,java.awt.image.BufferedImage> splitAsMap(java.awt.image.BufferedImage src, int w, int h) throws java.awt.image.RasterFormatException
src
- 画像。w
- 切り出す幅。h
- 切り出す高さ。java.awt.image.RasterFormatException
- 座標またはサイズが不正な場合に投げられる。public static void screenShot(java.lang.String FILE_PATH, java.awt.Rectangle BOUNDS) throws ContentsIOException
FILE_PATH
- ファイルパスを記述します。BOUNDS
- キャプチャする領域.デバイスのグローバル座標で指定します。ContentsIOException
- 画像が保存できない場合およびスクリーンショットが取得できない場合に
投げられます。public static java.awt.image.BufferedImage tiling(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst, int xNum, int yNum)
src
- タイリングするソース画像を指定します。この画像のピクセルデータは操作されません。dst
- nullでない場合、この引数に結果が格納されます。xNum
- X方向に並べる数を指定します。yNum
- Y方向に並べる数を指定します。public static java.awt.image.BufferedImage tiling(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst, int xNum, int yNum, int drawWidth, int drawHeight)
src
- タイリングするソース画像を指定します。この画像のピクセルデータは操作されません。dst
- nullでない場合、この引数に結果が格納されます。xNum
- X方向に並べる数を指定します。yNum
- Y方向に並べる数を指定します。drawWidth
- 画像を描画する際のサイズを指定します。drawHeight
- 画像を描画する際のサイズを指定します。public static java.awt.image.BufferedImage trimming(java.awt.image.BufferedImage src, int x, int y, int width, int height) throws java.awt.image.RasterFormatException
java.awt.image.RasterFormatException
public static java.awt.image.BufferedImage[] transparentArray(java.awt.image.BufferedImage image, float initialTp, float addTp) throws java.lang.IllegalArgumentException
image
- 透過度を変更するソース画像。initialTp
- 透過度の初期値です。addTp
- 透過度に加算する値です。通常は負数を使用します。java.lang.IllegalArgumentException
- initailTpが0未満又は1を超えるときに投げられます。public static java.awt.image.BufferedImage lineUp(java.awt.image.BufferedImage... images) throws java.lang.IllegalArgumentException
images
- 使用する画像を1つ以上送信します。java.lang.IllegalArgumentException
- imagesの長さが0のときに投げられます。
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |