mosaiccreator
Class MosaicAlgorithm

public class MosaicAlgorithm
implements Runnable

Title: Mosaic creator Algorithm

Description: creates a mosaic

Version:
1.0
Author:
Lance Finfrock
Constructor Detail

MosaicAlgorithm

public MosaicAlgorithm(String FileNameToOriginal,
                       File[] filesOfPieces,
                       int detailLevel,
                       int divwide,
                       int divheight,
                       boolean isReplacement1,
                       MainWindow f,
                       JProgressBar jProgressBar,
                       JLabel label)
Parameters:
FileNameToOriginal - String the path to the mosaic image to be mapped
filesOfPieces - File[] all the files for the mosaic piece to be used
detailLevel - int amount of detail wanted to match the pictures the hight the beter match
divwide - int the amount of division wide of the mosaic
divheight - int the amount of division high of the mosaic
isReplacement1 - boolean if the mosaic is to be created with duplcates
f - MainWindow the window that called the class
jProgressBar - JProgressBar the progress bar to show the user progress
label - JLabel the label to write to the user what is going on

Method Detail

CreatePicWithReplacement

public PicPixels[] CreatePicWithReplacement()
Returns:
PicPixels[]

CreatePicWithOutReplacement

public PicPixels[] CreatePicWithOutReplacement()
Returns:
PicPixels[]

CreatePictureToCopy

private PicPixels CreatePictureToCopy(String originalPicturePath,
                                      int MaxDimension)
Parameters:
originalPicturePath - String
MaxDimension - int
Returns:
PicPixels

ReadPictures

public PicPixels[] ReadPictures(int subPicWidth,
                                int subPicHeight)
Parameters:
subPicWidth - int
subPicHeight - int
Returns:
PicPixels[]

ReadPicturesIntoVector

public Vector ReadPicturesIntoVector(int subPicWidth,
                                     int subPicHeight)
Parameters:
subPicWidth - int
subPicHeight - int
Returns:
Vector

FindMatch

private PicPixels FindMatch(int w,
                            int h,
                            Vector pictures)
Parameters:
w - int
h - int
pictures - Vector
Returns:
PicPixels

FindMatch

private PicPixels FindMatch(int w,
                            int h,
                            PicPixels[] pictures)
Parameters:
w - int
h - int
pictures - PicPixels[]
Returns:
PicPixels

Compare

private int Compare(int w,
                    int h,
                    PicPixels mosaicPiece)
Parameters:
w - int
h - int
p - PicPixels
Returns:
int

differenceInColor

private int differenceInColor(Color color1,
                              Color color2)
finds the difference between two colors
Parameters:
color1 - Color
color2 - Color
Returns:
int the difference