|
JavaTM Platform Standard Ed. 6 |
|||||||||
앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
java.lang.Objectjava.awt.image.MemoryImageSource
public class MemoryImageSource
이 클래스는, 배열을 사용해 Image 의 픽셀치를 생성하는 ImageProducer 인터페이스를 구현합니다. 이하의 예는, X 축방향으로 흑으로부터 파랑에 변화해, Y 축방향으로 흑으로부터 빨강에 변화하는 100×100 의 이미지입니다.
int w = 100; int h = 100; int pix[] = new int[w * h]; int index = 0; for (int y = 0; y < h; y++) { int red = (y * 255) / (h - 1); for (int x = 0; x < w; x++) { int blue = (x * 255) / (w - 1); pix[index++] = (255 << 24) | (red << 16) | blue; } } Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));또, MemoryImageSource 는, 시간과 함께 변화해, 애니메이션이나 커스텀 렌더링을 가능하게 하는 메모리 이미지를 관리하는 기능을 가집니다. 다음에, 애니메이션 소스, 및 데이터의 신호 변화의 설정 방법법의 예를 나타냅니다 (Garth Dickie 에 의한 MemoryAnimationSourceDemo 로부터의 적용).
int pixels[]; MemoryImageSource source; public void init() { int width = 50; int height = 50; int size = width * height; pixels = new int[size]; int value = getBackground(). getRGB(); for (int i = 0; i < size; i++) { pixels[i] = value; } source = new MemoryImageSource(width, height, pixels, 0, width); source.setAnimated(true); image = createImage(source); } public void run() { Thread me = Thread.currentThread( ); me.setPriority(Thread.MIN_PRIORITY); while (true) { try { thread.sleep(10); } catch (InterruptedException e) { return; } // Modify the values in the pixels array at (x, y, w, h) // Send the new data to the interested ImageConsumers source.newPixels(x, y, w, h); } }
ImageProducer
생성자 의 개요 | |
---|---|
MemoryImageSource (int w,
int h,
ColorModel cm,
byte[] pix,
int off,
int scan)
byte 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
|
MemoryImageSource (int w,
int h,
ColorModel cm,
byte[] pix,
int off,
int scan,
Hashtable <?,?> props)
byte 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
|
MemoryImageSource (int w,
int h,
ColorModel cm,
int[] pix,
int off,
int scan)
정수형 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
|
MemoryImageSource (int w,
int h,
ColorModel cm,
int[] pix,
int off,
int scan,
Hashtable <?,?> props)
정수형 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
|
MemoryImageSource (int w,
int h,
int[] pix,
int off,
int scan)
디폴트 RGB 칼라 모델의 정수형 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
|
MemoryImageSource (int w,
int h,
int[] pix,
int off,
int scan,
Hashtable <?,?> props)
디폴트 RGB 칼라 모델의 정수형 배열을 사용해 Image 객체 데이터를 생성하는 ImageProducer 객체를 구축합니다. |
메소드의 개요 | |
---|---|
void |
addConsumer (ImageConsumer ic)
이 이미지의 데이터의 전달 대상이 되고 있는 컨슈머(consumer)의 리스트에 ImageConsumer 를 추가합니다. |
boolean |
isConsumer (ImageConsumer ic)
현재 이 이미지의 데이터의 전달 대상이 되고 있는 컨슈머(consumer)의 리스트에 ImageConsumer 가 있을지 어떨지를 판정합니다. |
void |
newPixels ()
이 이미지 데이터를 현재 요구하는 ImageConsumer 에 픽셀의 새로운 버퍼 전체를 송출해, 애니메이션 프레임의 송출이 완료한 것을 통지합니다. |
void |
newPixels (byte[] newpix,
ColorModel newmodel,
int offset,
int scansize)
새로운 byte 배열을, 이 이미지의 픽셀을 보관 유지하도록(듯이) 변경합니다. |
void |
newPixels (int[] newpix,
ColorModel newmodel,
int offset,
int scansize)
새로운 int 배열을, 이 이미지의 픽셀을 보관 유지하도록(듯이) 변경합니다. |
void |
newPixels (int x,
int y,
int w,
int h)
이 이미지의 데이터를 현재 요구하는 ImageConsumer 에 픽셀의 구형 영역 버퍼를 송출해, 애니메이션 프레임의 송출이 완료한 것을 통지합니다. |
void |
newPixels (int x,
int y,
int w,
int h,
boolean framenotify)
이 이미지의 데이터를 현재 요구하는 ImageConsumer 에, 픽셀의 구형 영역 버퍼를 송출합니다. |
void |
removeConsumer (ImageConsumer ic)
이 이미지의 데이터의 전달 대상이 되고 있는 컨슈머(consumer)의 리스트로부터 ImageConsumer 를 삭제합니다. |
void |
requestTopDownLeftRightResend (ImageConsumer ic)
지정된 ImageConsumer 에, 위에서 아래, 왼쪽에서 오른쪽의 순서로 이제(벌써) 1 회 이미지 데이터를 다시 전달하도록(듯이) 요구합니다. |
void |
setAnimated (boolean animated)
animated 파라미터에 따라, 이 메모리 이미지를 멀티 프레임의 애니메이션 또는 싱글 프레임의 정지 이미지로 변경합니다. |
void |
setFullBufferUpdates (boolean fullbuffers)
변경이 있었을 때는 언제라도 픽셀의 완전한 버퍼를 송출해, 이 애니메이션화 메모리 이미지를 항상 갱신할지 어떨지를 지정합니다. |
void |
startProduction (ImageConsumer ic)
이 이미지 데이터를 요구하는 컨슈머(consumer)의 리스트에 ImageConsumer 를 추가해, ImageConsumer 인터페이스 경유로 즉시 이미지 데이터의 전송을 개시합니다. |
클래스 java.lang. Object 로부터 상속된 메소드 |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
생성자 의 상세 |
---|
public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off, int scan)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이cm
- 지정된 ColorModel
pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리Component.createImage(java.awt.image.ImageProducer)
public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off, int scan, Hashtable <?,?> props)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이cm
- 지정된 ColorModel
pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리props
- ImageProducer
가 이미지 처리로 사용한다
프로퍼티 리스트Component.createImage(java.awt.image.ImageProducer)
public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off, int scan)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이cm
- 지정된 ColorModel
pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리Component.createImage(java.awt.image.ImageProducer)
public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off, int scan, Hashtable <?,?> props)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이cm
- 지정된 ColorModel
pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리props
- ImageProducer
가 이미지 처리로 사용한다
프로퍼티 리스트Component.createImage(java.awt.image.ImageProducer)
public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리Component.createImage(java.awt.image.ImageProducer)
,
ColorModel.getRGBdefault()
public MemoryImageSource(int w, int h, int[] pix, int off, int scan, Hashtable <?,?> props)
w
- 구형 픽셀의 폭h
- 구형 픽셀의 높이pix
- 픽셀의 배열off
- 최초의 픽셀을 배열의 어디에 포함하는지를 나타낸다
오프셋(offset)scan
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리props
- ImageProducer
가 이미지 처리로 사용한다
프로퍼티 리스트Component.createImage(java.awt.image.ImageProducer)
,
ColorModel.getRGBdefault()
메소드의 상세 |
---|
public void addConsumer(ImageConsumer ic)
ImageProducer
내의 addConsumer
ic
- 지정된 ImageConsumer
NullPointerException
- 지정되었다
ImageConsumer
가 null 의 경우ImageConsumer
public boolean isConsumer(ImageConsumer ic)
ImageProducer
내의 isConsumer
ic
- 지정된 ImageConsumer
ImageConsumer
가 리스트에 있는 경우는 true
,
그렇지 않은 경우는 false
ImageConsumer
public void removeConsumer(ImageConsumer ic)
ImageProducer
내의 removeConsumer
ic
- 지정된 ImageConsumer
ImageConsumer
public void startProduction(ImageConsumer ic)
ImageProducer
내의 startProduction
ic
- ImageConsumer 인터페이스를 개입시킨,
지정된 ImageConsumer
이미지 데이터ImageConsumer
public void requestTopDownLeftRightResend(ImageConsumer ic)
ImageProducer
내의 requestTopDownLeftRightResend
ic
- 지정된 ImageConsumer
ImageConsumer
public void setAnimated(boolean animated)
이 메소드는, 모든 ImageConsumer 가 정상적인 멀티 프레임 데이터를 받는 것을 보증하기 위해서, MemoryImageSource 의 구축 후 즉시, 이미지가 생성되기 전에 호출할 필요가 있습니다. 이 플래그를 설정하기 전에, ImageConsumer 를 이 ImageProducer 에 추가하면(자), 접속했을 때에 이용 가능함 픽셀 데이터의 snapshot만이 ImageConsumer 로부터 참조됩니다.
animated
- 그 이미지가 멀티 프레임 애니메이션의 경우는
true
public void setFullBufferUpdates(boolean fullbuffers)
이 메소드는, MemoryImageSource 의 구축 후 즉시, 이미지가 작성되기 전에 불려 가 모든 ImageConsumer 에 정상적인 픽셀 전송 정보를 주고 받습니다.
fullbuffers
- 완전한 픽셀 버퍼를
항상 송출하는 경우는
true
setAnimated(boolean)
public void newPixels()
newPixels(int, int, int, int, boolean)
,
ImageConsumer
,
setAnimated(boolean)
public void newPixels(int x, int y, int w, int h)
x
- 송출되는 픽셀의 구형의
좌상구석의 x 좌표y
- 송출되는 픽셀의 구형의
좌상구석의 y 좌표w
- 송출되는 픽셀의 구형의 폭h
- 송출되는 픽셀의 구형의 높이newPixels(int, int, int, int, boolean)
,
ImageConsumer
,
setAnimated(boolean)
,
setFullBufferUpdates(boolean)
public void newPixels(int x, int y, int w, int h, boolean framenotify)
x
- 송출되는 픽셀의 구형의
좌상구석의 x 좌표y
- 송출되는 픽셀의 구형의
좌상구석의 y 좌표w
- 송출되는 픽셀의 구형의 폭h
- 송출되는 픽셀의 구형의 높이framenotify
- 컨슈머(consumer)에게 SINGLEFRAMEDONE
통지를
송출하는 경우는 true
ImageConsumer
,
setAnimated(boolean)
,
setFullBufferUpdates(boolean)
public void newPixels(byte[] newpix, ColorModel newmodel, int offset, int scansize)
newpix
- 새로운 픽셀 배열newmodel
- 지정된 ColorModel
offset
- 배열에의 오프셋(offset)scansize
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리newPixels(int, int, int, int, boolean)
,
setAnimated(boolean)
public void newPixels(int[] newpix, ColorModel newmodel, int offset, int scansize)
newpix
- 새로운 픽셀 배열newmodel
- 지정된 ColorModel
offset
- 배열에의 오프셋(offset)scansize
- 배열내에서의 있는 픽셀행으로부터 다음의 픽셀행까지의
거리newPixels(int, int, int, int, boolean)
,
setAnimated(boolean)
|
JavaTM Platform Standard Ed. 6 |
|||||||||
앞의 클래스 다음의 클래스 | 프레임 있어 프레임 없음 | |||||||||
개요: 상자 | 필드 | 생성자 | 메소드 | 상세: 필드 | 생성자 | 메소드 |
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.