本文整理汇总了Java中java.awt.image.LookupTable类的典型用法代码示例。如果您正苦于以下问题:Java LookupTable类的具体用法?Java LookupTable怎么用?Java LookupTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LookupTable类属于java.awt.image包,在下文中一共展示了LookupTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.image.LookupTable; //导入依赖的package包/类
public static void main(String[] args) {
LookupTable tbl = createReverseTable();
LookupOp op = new LookupOp(tbl, null);
for (ImageType t : ImageType.values()) {
System.out.print(t);
BufferedImage src = createSourceImage(t);
BufferedImage dst = op.filter(src, null);
int rgb = dst.getRGB(0, 0);
System.out.printf(" Result: 0x%X ", rgb);
if (rgb != argbReverse) {
throw new RuntimeException("Test failed.");
}
System.out.println("Passed.");
}
}
示例2: toInverseVideo
import java.awt.image.LookupTable; //导入依赖的package包/类
/**
* For testing lookup tables
*/
public static Image toInverseVideo(Image source) {
//
BufferedImage src = new BufferedImage(source.getWidth(null), source
.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics g = src.getGraphics();
g.drawImage(source, 0, 0, null);
//
short[][] lookup = new short[4][256];
for (int c = 0; c < 4; c++) {
for (short b = 0; b < 256; b++) {
if (c == 3)
lookup[c][b] = b;
else
lookup[c][b] = (short)(255 - b);
}
}
LookupTable table = new ShortLookupTable(0, lookup);
LookupOp op = new LookupOp (table, null);
return op.filter(src, null);
}
示例3: botonContrasteActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonContrasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonContrasteActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_SFUNCION);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error en el contraste");
}
}
示例4: botonIluminarActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonIluminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonIluminarActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_LOGARITHM);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al iluminar");
}
}
示例5: botonOscurecerActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonOscurecerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonOscurecerActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_POWER);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al oscurecer");
}
}
示例6: createLookupTable
import java.awt.image.LookupTable; //导入依赖的package包/类
/**
* Crea objetos LookupTable usando valores por defecto
*/
static LookupTable createLookupTable(int type){
switch(type){
case TYPE_NEGATIVE:
return negativeFuction();
case TYPE_SFUNCION:
return sFuction(DEFAULT_M_SFUNCTION,DEFAULT_E_SFUNCTION);
case TYPE_LOGARITHM:
return logarithmFuction();
case TYPE_POWER:
return powerFuction(DEFAULT_POWER);
case TYPE_ROOT:
return rootFuction(DEFAULT_ROOT);
case TYPE_GAMMA_CORRECTION:
return gammaCorrection(DEFAULT_A_GAMMA,DEFAULT_GAMMA);
default:
return null;
}
}
示例7: botonContrasteActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonContrasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonContrasteActionPerformed
try {
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_SFUNCION);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error en el contraste");
}
}
示例8: botonIluminarActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonIluminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonIluminarActionPerformed
try {
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_LOGARITHM);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al iluminar");
}
}
示例9: botonOscurecerActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonOscurecerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonOscurecerActionPerformed
try {
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_POWER);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al oscurecer");
}
}
示例10: negativeActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void negativeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_negativeActionPerformed
try {
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_NEGATIVE);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error en el contraste");
}
}
示例11: createLookupTable
import java.awt.image.LookupTable; //导入依赖的package包/类
/**
* Crea objetos LookupTable usando valores por defecto
*/
static LookupTable createLookupTable(int type) {
switch (type) {
case TYPE_NEGATIVE:
return negativeFuction();
case TYPE_SFUNCION:
return sFuction(DEFAULT_M_SFUNCTION, DEFAULT_E_SFUNCTION);
case TYPE_LOGARITHM:
return logarithmFuction();
case TYPE_POWER:
return powerFuction(DEFAULT_POWER);
case TYPE_ROOT:
return rootFuction(DEFAULT_ROOT);
case TYPE_GAMMA_CORRECTION:
return gammaCorrection(DEFAULT_A_GAMMA, DEFAULT_GAMMA);
default:
return null;
}
}
示例12: gammaCorrection
import java.awt.image.LookupTable; //导入依赖的package包/类
/**
* Corrección gamma. Si 0 menor_que gamma menor_que 1 ilumina, si
* gamma_mayor_que 1 oscurece
*
* @param cteA double
* @param gamma double
* @return LookupTable
*/
public static LookupTable gammaCorrection(double cteA, double gamma) {
if (gamma <= 0) {
return null;
}
// K: constante de normalización
double K = ((double) MAX_LEVEL) / (cteA * Math.pow(((double) MAX_LEVEL), gamma));
short lt[] = new short[MAX_LEVEL + 1];
for (int l = 0; l <= MAX_LEVEL; l++) {
lt[l] = (short) (K * cteA * Math.pow((double) l, gamma));
}
ShortLookupTable slt = new ShortLookupTable(0, lt);
if (ECHO) {
plot(lt);
}
return slt;
}
示例13: botonContrasteActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonContrasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonContrasteActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_SFUNCION);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null){
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error en el contraste");
}
}
示例14: botonIluminarActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonIluminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonIluminarActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_LOGARITHM);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null){
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al iluminar");
}
}
示例15: botonOscurecerActionPerformed
import java.awt.image.LookupTable; //导入依赖的package包/类
private void botonOscurecerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonOscurecerActionPerformed
try {
VentanaInterna vi = (VentanaInterna) escritorio.getSelectedFrame();
if (vi != null) {
BufferedImage imgActual = convertImageType(vi.getLienzo().getImageActual(), BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_POWER);
LookupOp lop = new LookupOp(ltp, null);
BufferedImage imgdest = lop.filter(imgActual, null);
if (imgdest != null){
vi.getLienzo().setImageOriginal(imgdest);
vi.getLienzo().repaint();
}
}
} catch (Exception e) {
System.err.println("Error al oscurecer");
}
}