Question: import java.awt.Color; import java.awt.image.BufferedImage; / * * * @author Opeyemi Ajisegiri * Class: CMSC 4 0 5 * Project: 1 * File: ImageTemplate.java * Note:
import java.awt.Color;
import java.awt.image.BufferedImage;
@author Opeyemi Ajisegiri
Class: CMSC
Project:
File: ImageTemplate.java
Note: This file defines and gives access the three images defined
as a twodimensional array.
public class ImageTemplate
Constants
X Size of Images
private final static int IMGSIZEX ; ;
Y Size of Images
private final static int IMGSIZEY ; ;
Defining the nnumber image
public static int number
;
Defining the LetterJ image
public static int letterJ
;
Defining the triangle image
public static int triangle
;
Methods to apply pixel colors and
public BufferedImage getImageint data
BufferedImage image new BufferedImageIMGSIZEX IMGSIZEY,
BufferedImage.TYPEINTRGB;
for int x ; x IMGSIZEX; x
for int y ; y IMGSIZEY; y
int pixelColor dataxy;
Set Colors based on Binary Image value
if pixelColor
pixelColor Color.WHITE.getRGB;
else if pixelColor
pixelColor Color.BLACK.getRGB;
else
pixelColor Color.GRAY.getRGB;
image.setRGBx y pixelColor;
End for y
End for x
return image;
End getData method.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
