mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-31 19:54:37 +00:00
do not recreate tree model every time
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* @(#)AbstractVideoCodec.java
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2011 Werner Randelshofer, Goldau, Switzerland.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You may not use, copy or modify this file, except in compliance with the
|
||||
* license agreement you entered into with Werner Randelshofer.
|
||||
* For details see accompanying license terms.
|
||||
@@ -21,7 +21,8 @@ import java.awt.image.DirectColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.stream.ImageOutputStream;
|
||||
import static org.monte.media.VideoFormatKeys.*;
|
||||
import static org.monte.media.VideoFormatKeys.HeightKey;
|
||||
import static org.monte.media.VideoFormatKeys.WidthKey;
|
||||
|
||||
/**
|
||||
* {@code AbstractVideoCodec}.
|
||||
@@ -37,7 +38,10 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
super(supportedInputFormats, supportedOutputFormats);
|
||||
}
|
||||
|
||||
/** Gets 8-bit indexed pixels from a buffer. Returns null if conversion failed. */
|
||||
/**
|
||||
* Gets 8-bit indexed pixels from a buffer. Returns null if conversion
|
||||
* failed.
|
||||
*/
|
||||
protected byte[] getIndexed8(Buffer buf) {
|
||||
if (buf.data instanceof byte[]) {
|
||||
return (byte[]) buf.data;
|
||||
@@ -51,7 +55,9 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Gets 15-bit RGB pixels from a buffer. Returns null if conversion failed. */
|
||||
/**
|
||||
* Gets 15-bit RGB pixels from a buffer. Returns null if conversion failed.
|
||||
*/
|
||||
protected short[] getRGB15(Buffer buf) {
|
||||
if (buf.data instanceof int[]) {
|
||||
return (short[]) buf.data;
|
||||
@@ -80,7 +86,11 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/** Gets 16-bit RGB-5-6-5 pixels from a buffer. Returns null if conversion failed. */
|
||||
|
||||
/**
|
||||
* Gets 16-bit RGB-5-6-5 pixels from a buffer. Returns null if conversion
|
||||
* failed.
|
||||
*/
|
||||
protected short[] getRGB16(Buffer buf) {
|
||||
if (buf.data instanceof int[]) {
|
||||
return (short[]) buf.data;
|
||||
@@ -110,8 +120,9 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/** Gets 24-bit RGB pixels from a buffer. Returns null if conversion failed. */
|
||||
/**
|
||||
* Gets 24-bit RGB pixels from a buffer. Returns null if conversion failed.
|
||||
*/
|
||||
protected int[] getRGB24(Buffer buf) {
|
||||
if (buf.data instanceof int[]) {
|
||||
return (int[]) buf.data;
|
||||
@@ -133,7 +144,9 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Gets 32-bit ARGB pixels from a buffer. Returns null if conversion failed. */
|
||||
/**
|
||||
* Gets 32-bit ARGB pixels from a buffer. Returns null if conversion failed.
|
||||
*/
|
||||
protected int[] getARGB32(Buffer buf) {
|
||||
if (buf.data instanceof int[]) {
|
||||
return (int[]) buf.data;
|
||||
@@ -155,13 +168,16 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Gets a buffered image from a buffer. Returns null if conversion failed. */
|
||||
/**
|
||||
* Gets a buffered image from a buffer. Returns null if conversion failed.
|
||||
*/
|
||||
protected BufferedImage getBufferedImage(Buffer buf) {
|
||||
if (buf.data instanceof BufferedImage) {
|
||||
return (BufferedImage) buf.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private byte[] byteBuf = new byte[4];
|
||||
|
||||
protected void writeInt24(ImageOutputStream out, int v) throws IOException {
|
||||
@@ -216,7 +232,9 @@ public abstract class AbstractVideoCodec extends AbstractCodec {
|
||||
out.write(b, 0, len * 3);
|
||||
}
|
||||
|
||||
/** Copies a buffered image. */
|
||||
/**
|
||||
* Copies a buffered image.
|
||||
*/
|
||||
protected static BufferedImage copyImage(BufferedImage img) {
|
||||
ColorModel cm = img.getColorModel();
|
||||
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
|
||||
|
||||
Reference in New Issue
Block a user