Methods Summary |
---|
public void | close()
if (available && blitter != 0) {
xlibFree();
}
|
protected int | doProcess(javax.media.Buffer buffer)
return doProcess(buffer, false);
|
protected int | doProcess(javax.media.Buffer buffer, boolean repaint)
boolean resetOutputSize = false;
if (!available || component == null)
return BUFFER_PROCESSED_OK;
if (!repaint) {
if (!buffer.getFormat().equals(inputFormat)) {
if (setInputFormat(buffer.getFormat()) == null)
return BUFFER_PROCESSED_FAILED;
}
data = getInputData(buffer);
} else
if (data == null)
return BUFFER_PROCESSED_FAILED;
synchronized (this) {
if (!componentAvailable || data == null)
return BUFFER_PROCESSED_OK;
if (blitter == 0 || firstTime) {
int handle = 0;
firstTime = false;
if (blitter == 0) {
handle = com.sun.media.util.WindowUtil.getWindowHandle(component);
if (handle == 0)
return BUFFER_PROCESSED_OK;
//System.err.println("handle is " + handle);
xlibInitialize();
xlibSetComponent(component);
xlibSetInputFormat(inWidth, inHeight, lineStride);
resetOutputSize = true;
// Reset it to force calling setInputFormat
inputFormat = new VideoFormat(null);
}
if (blitter == 0) {
return BUFFER_PROCESSED_FAILED;
}
}
if (outWidth > 0 && outHeight > 0) {
if (outWidth != lastOutWidth || outHeight != lastOutHeight || resetOutputSize) {
outWidth &= ~1;
lastOutWidth = outWidth;
lastOutHeight = outHeight;
if (blitter != 0)
xlibSetOutputSize(outWidth, outHeight);
}
long dataBytes = getNativeData(data);
if (data == null)
return BUFFER_PROCESSED_OK;
return (xlibDraw(data, dataBytes, bytesPerPixel))?
BUFFER_PROCESSED_OK : BUFFER_PROCESSED_FAILED;
} else
return BUFFER_PROCESSED_FAILED;
}
|
public javax.media.Format[] | getBaseInputFormats()
Format [] formats = new Format[1];
formats[0] = new RGBFormat();
return formats;
|
public javax.media.Format[] | getBaseOutputFormats()
Format [] formats = new Format[0];
return formats;
|
public void | open()
if (!available)
throw new ResourceUnavailableException("XLib not available");
|
protected synchronized void | removingComponent()
if (blitter != 0) {
xlibFree();
}
|
protected synchronized void | repaint()
if (!isStarted() && data != null)
doProcess(null, true);
|
public void | reset()
|
public javax.media.Format | setInputFormat(javax.media.Format format)Set the data input format.
if (!available)
return null;
if (!(format instanceof RGBFormat))
return null;
if (!(Toolkit.getDefaultToolkit().getColorModel() instanceof DirectColorModel))
return null;
if (super.setInputFormat(format) != null) {
if (inputFormat instanceof RGBFormat) {
RGBFormat rgbf = (RGBFormat) inputFormat;
bitsPerPixel = rgbf.getBitsPerPixel();
rMask = rgbf.getRedMask();
gMask = rgbf.getGreenMask();
bMask = rgbf.getBlueMask();
lineStride = rgbf.getLineStride();
pixelStride = rgbf.getPixelStride();
} else if (inputFormat instanceof IndexedColorFormat) {
lineStride = ((IndexedColorFormat)format).getLineStride();
} else
return null;
// Inform the native code of the input format change
synchronized (this) {
if (blitter != 0) {
xlibSetInputFormat(inWidth, inHeight, lineStride);
}
}
if (outWidth == -1 || outHeight == -1) {
outWidth = inWidth;
outHeight = inHeight;
}
if (component != null)
component.setSize(outWidth, outHeight);
// All's well
return format;
} else {
// Unsupported format
return null;
}
|
private native synchronized boolean | xlibDraw(java.lang.Object data, long dataBytes, int aes)
|
private native synchronized boolean | xlibFree()
|
private native synchronized boolean | xlibInitialize()
|
private native synchronized boolean | xlibSetComponent(java.lang.Object component)
|
private native synchronized boolean | xlibSetInputFormat(int width, int height, int strideX)
|
private native void | xlibSetJAWT(int jawt)
|
private native synchronized boolean | xlibSetOutputSize(int width, int height)
|