本文整理汇总了Java中java.awt.image.LookupOp.filter方法的典型用法代码示例。如果您正苦于以下问题:Java LookupOp.filter方法的具体用法?Java LookupOp.filter怎么用?Java LookupOp.filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.LookupOp
的用法示例。
在下文中一共展示了LookupOp.filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.image.LookupOp; //导入方法依赖的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.LookupOp; //导入方法依赖的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.LookupOp; //导入方法依赖的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.LookupOp; //导入方法依赖的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.LookupOp; //导入方法依赖的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: botonContrasteActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例7: botonIluminarActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例8: botonOscurecerActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例9: negativeActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例10: botonContrasteActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例11: botonIluminarActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例12: botonOscurecerActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的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");
}
}
示例13: buildLookupOpTab
import java.awt.image.LookupOp; //导入方法依赖的package包/类
private void buildLookupOpTab(JTabbedPane tabbedPane) {
BufferedImage dstImage = null;
short[] data = new short[256];
for (int i = 0; i < 256; i++) {
data[i] = (short) (255 - i);
}
LookupTable lookupTable = new ShortLookupTable(0, data);
LookupOp op = new LookupOp(lookupTable, null);
dstImage = op.filter(sourceImage, null);
tabbedPane.add("Lookup", new JLabel(new ImageIcon(dstImage)));
}
示例14: guardarActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的package包/类
private void guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarActionPerformed
JFileChooser dlg = new JFileChooser();
int resp = dlg.showSaveDialog(this);
if (escritorio.getSelectedFrame() instanceof VentanaInternaImagen) {
dlg.addChoosableFileFilter(new GIFImageFileFilter());
dlg.addChoosableFileFilter(new JPEGImageFileFilter());
dlg.addChoosableFileFilter(new JPGImageFileFilter());
dlg.addChoosableFileFilter(new PNGImageFileFilter());
if (resp == JFileChooser.APPROVE_OPTION) {
try {
File f = dlg.getSelectedFile();
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
BufferedImage img = vi.getLienzo().getImageOriginal();
if (img == null) {
img = new BufferedImage(vi.getLienzo().getWidth(), vi.getLienzo().getHeight(), BufferedImage.TYPE_INT_RGB);
//Le añado filtro negativo para que slaga el fondo blanco en la imagen.
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_NEGATIVE);
LookupOp lop = new LookupOp(ltp, null);
img = lop.filter(img, null);
}
img = vi.getLienzo().volcado(img);
ImageIO.write(img, UtilFileFilter.getExtension(f), f);
//Código
} catch (IOException ex) {
Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
示例15: menuArtFilterActionPerformed
import java.awt.image.LookupOp; //导入方法依赖的package包/类
private void menuArtFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuArtFilterActionPerformed
VentanaInternaImagen vi = (VentanaInternaImagen) selectInternalWindows();
if (vi != null) {
//Filtro Sobel
BufferedImage imgSource = vi.getLienzo().getImageActual();
if (imgSource != null) {
SobelOp sobel = new SobelOp();
BufferedImage imgdest = sobel.filter(imgSource, null);
//Filtro Negativo
imgdest = convertImageType(imgdest, BufferedImage.TYPE_INT_RGB);
LookupTable ltp = LookupTableProducer.createLookupTable(LookupTableProducer.TYPE_NEGATIVE);
LookupOp lop = new LookupOp(ltp, null);
imgdest = lop.filter(imgdest, null);
//Paso a Gris
ICC_Profile ip;
ip = ICC_Profile.getInstance(ColorSpace.CS_GRAY);
ColorSpace cs = new ICC_ColorSpace(ip);
ColorConvertOp ccop = new ColorConvertOp(cs, null);
imgdest = ccop.filter(imgdest, null);
//Guardo la imagen
if (imgdest != null) {
vi.getLienzo().setImageOriginal(imgdest);
activateFilterColorImage(false);
vi.getLienzo().repaint();
}
}
}
}