Actualizar ImageToAscii/src/imagetoascii/ImageToAscii.java

This commit is contained in:
omar.lopez 2024-02-28 14:15:37 +00:00
parent fa8fe0d2b6
commit 6b7e7678f9
1 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,3 @@
package imagetoascii; package imagetoascii;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -95,7 +94,7 @@ public class ImageToAscii extends JFrame {
JButton button = new JButton(text); JButton button = new JButton(text);
button.setBackground(color); button.setBackground(color);
button.setForeground(Color.WHITE); button.setForeground(Color.WHITE);
button.addActionListener(e -> handleButtonClick(text)); // Reemplaza handleButtonClick con el manejo apropiado button.addActionListener(e -> handleButtonClick(text));
return button; return button;
} }
@ -245,7 +244,7 @@ public class ImageToAscii extends JFrame {
} }
private static char getAsciiChar(int gray) { private static char getAsciiChar(int gray) {
// Ajusta estos valores según tu preferencia
char[] asciiChars = {'@', '#', '8', '&', 'o', ':', '*', '.', ' '}; char[] asciiChars = {'@', '#', '8', '&', 'o', ':', '*', '.', ' '};
int index = gray * (asciiChars.length - 1) / 255; int index = gray * (asciiChars.length - 1) / 255;
return asciiChars[index]; return asciiChars[index];