Sie sind auf Seite 1von 32

/*

THISistheF2Versionsomewherenearcompletedforrelease.
Theoldsitewashttp://www.nicephotogjsp.netthenewsiteishttp://www.windsolarhybridaustralia.x10.mx
ThisapplicationisnotprincipleywritteninLinuxorWindowsandissometimesperversiononlyusableinoneortheotherOSsystem.
ItisendevouredtobewrittenforbothandallWindowsandNIX'sOS'sintheonedownload...
cdC:\SideWinderColourBalancer\engine
FILENAMESHOULDBE"SideWinderPhotoColourBalancer.java"writtenbyMrSamuelAMarchantSydneyNSWAustraliaOctober20102015versionF2
cdC:\SideWinderColourBalancer\engine\sidewinderutil
"MultiDimArr.java"writtenbyMrSamuelAMarchantSydneyNSWAustraliaOctober2010
"C:\ProgramFiles\Java\jdk1.5.0_07\bin\javac.exe"SidewinderPhotoColourBalancer.java
"C:\ProgramFiles\Java\jdk1.5.0_07\bin\java.exe"classpath"C:\SideWinderColourBalancer\engine".SidewinderPhotoColourBalancer
"C:\ProgramFiles\Java\jdk1.6.0_22\bin\javac.exe"SidewinderPhotoColourBalancer.java
"C:\ProgramFiles\Java\jdk1.6.0_22\bin\java.exe"classpath"C:\SideWinderColourBalancer\engine".SidewinderPhotoColourBalancer
*/
import java.awt.*
import java.awt.event.ActionListener
import java.awt.event.ActionEvent
import java.awt.Dimension
import java.awt.image.*
import javax.swing.event.*
import java.awt.event.ItemEvent
import java.awt.event.WindowAdapter
import java.awt.event.WindowEvent
import javax.swing.*
import javax.swing.filechooser.FileFilter
//importjavax.swing.filechooser.FileNameExtensionFilter
import java.io.*
import javax.imageio.*
import javax.imageio.spi.*
import javax.imageio.stream.*
import javax.imageio.metadata.*
//
import java.util.*
import java.util.List
import java.util.Iterator
//importsidewinderutil.*
//importsidewinderutil.MultiDimArr
//importsidewinderutil.Rotators
//importsidewinderutil.Cropcoords
//importsidewinderutil.IMGextensions
//importsidewinderutil.FlipInvert
//
import java.awt.font.*
import java.awt.geom.*
import java.awt.FontMetrics
import java.awt.font.LineMetrics
import java.awt.GraphicsEnvironment
//
class SidewinderPhotoColourBalancer extends javax.swing.JFrame implements java.awt.event.ActionListener,java.awt.event.ItemListener{
private final String[] uibuttext={"Up","Down","Up","Down","Up","Down","Up","Down","Open","Save"}
private final String[] uibuttcommand={"REDUP","REDDOWN","GREENUP","GREENDOWN","BLUEUP","BLUEDOWN","WHITEUP","WHITEDOWN","OPENFILE","SAVAS"}
private final java.awt.Color[] cols = {new Color(255,0,0),new Color(0,255,0),new Color(0,0,255),new Color(0,0,0),new Color(255,255,255)}
//JCheckBoxchkwhtclbg
//staticjava.util.Iterator<javax.imageio.ImageWriter>iwrtRs
static javax.imageio.ImageIO ioStreamSyscalls2 //INNERCLASSESCANNOTHAVESTATICDECLARATIONS
static java.util.Iterator iwrtRs //INNERCLASSESCANNOTHAVESTATICDECLARATIONS
RGBchangeCoeffLinear coloffl
//RGBchangeCoeffContrastcoloffc
RGBchangeCoeffLinearSingle coloffs
RGBchangeCoeffLinearSingleHueSetter colHue
RGBchangeCoeffLinearGammaSetter rgbSetgamm
HueBoard hu
QuickBoardColour qbrd
FontTextBoard fontextbaud
//
//JProgressBarwrkprog
//WorkBarwrkPROG
WorkWindowProgressor wrkprogess
WorkBar work
java.awt.Image sw32ico
//
int alngPVal
java.util.Timer tm
Object wimg //WritImgOutJPEGWritImgOutPNGWritImgOutBMP
Frame dialFram
Splashframe splatter
//
JButton bwbttn
//
FchComp pfc
JPanel pl
//
javax.swing.JSplitPane panesplit
javax.swing.JPanel labpan
java.awt.image.ImageObserver obsrvlab
javax.swing.JViewport[] panviewset //
javax.swing.JPanel[] panset //
javax.swing.JScrollPane[] panscro //
javax.swing.JTextArea metaPne
JButton[] colbutt
JCheckBox thumboo,thumbleep
DefaultComboBoxModel[] inpcombomodset
JComboBox[] inptnums
DefaultComboBoxModel szcombomod
JComboBox jox
int rsZidx //comboindexforresize
int oldrsZidx
ImageWriteParam wrtPrm
JPanel toolpan,conslcntbtt
java.io.FileOutputStream foutstrm
//java.io.RandomAccessFilefoutstrm
//java.io.Filefoutstrm
//javax.imageio.stream.FileImageOutputStreamfoutstrm
ConvertToBandW bnw
WritableRaster wras
MultiDimArr rgbDimArr
Rotators roTor //roTor=newRotators(bumi.getType())
//ThreadReduxPriorthePR
ThreadRedux1 the1 //=newThreadRedux1()
ThreadRedux2 the2
ThreadRedux3 the3
//ThreadRedux2theOther//=newThreadRedux2(e.getActionCommand())actComm=e.getActionCommand()
String actComm
String passPane
int imH
int lenw
short[][] red_Overstep
short[][] green_Overstep
short[][] blue_Overstep
//MULTIDIMINITS
ImageSysTest imcanv
Graphics g
long tme = 50
ImWin tpn
Font uifont
JFileChooser flchs
JFrame parent
File inputimage
String curropendir
String currsavdir
//==errorfileiftheerrorhandlerhasaproblem
File errFil //errorfileinsu.dat
PrintStream pr //errorprintstramforstackTracemethodready
String errF
int buttonjump=1
//
JButton rdysz,mkrsz,quickclru,quickclrd,huebord
JTextField lngz,wzd,hzd
//
JPanel[] bgbut
//javax.imageio.ImageWriteriwRT
javax.imageio.IIOParamController imPrmCnt
String app_Classpath_PATH,app_PATH,wnei
byte[] sysOS
String flsep
String linesep
boolean firstopenedis
boolean guiOpOccurring
//
//thumbsizerpanel
JFrame thmbFrm
JPanel frmpanl
JLabel sett
JComboBox settLong
JButton setchoice
DefaultComboBoxModel thmsz
int szMkThmb
//
//THUMBVIEWER
JFrame thumbVIEW
JScrollPane vwscroll
JViewport cview
JPanel frmevwpnl
JPanel compvw
JLabel[] thmImgView
String thumbinf
//
JPanel contain,containR,containL,contButtRow,crpWHlab,crpWHfields,crpXYfields,crpXYlab
JButton crpSet,crpClr,crpCrop,crpRccw,crpcw,crpRFror,crpRmror,crptxt
JTextField widefield,heightfield,xfield,yfield
JLabel wideLab,heightLab,xfieldLab,yfieldLab
java.util.Locale Aoriale
ComponentOrientation Acmpo
DefaultComboBoxModel omod
JComboBox crx
boolean cropsysstate
//BufferedImagecopybumi
//Graphicsg
Graphics gg
Rectangle rb
//NESTEDREADERCLASSPARTS
static ImageIO ioStreamSyscalls
static java.util.Iterator imReaders
//java.util.IteratorimReaders
//
javax.imageio.stream.ImageInputStream imgInpStr
javax.imageio.ImageReader readIMG
javax.imageio.ImageReadParam rdrPRM
javax.imageio.IIOImage iioiMIG
BufferedImage bumi
Image bumiSZpaint
//
javax.imageio.metadata.IIOMetadata imgIIOmtda
javax.imageio.metadata.IIOMetadata imgIIOmtdaRead
//org.w3c.dom.Noderootnod
//StringmtdaTree
String imgfilename
File imgFiling
FileInputStream flimstrm
//http://www.oracle.com/technetwork/articles/javase/generics136597.html
java.util.List imgThmbNl
//
int numThumb
//
String[] args
/*
"180flip.png","0
blueminus.png","1
blueplus.png","2
cropclear.png","3
cropdo.png","4
cropset.png","5
doresize.png","6
gammapply.png","7
gammatry.png","8
greenminus.png","9
greenplus.png","10
hueboard.png","11
longside.png","12
mirror.png","13
open.png","14
quickboardminus.png","15
quickboardplus.png","16
redminus.png","17
redplus.png","18
rotateccw.png","19
rotatecw.png","20
saveas.png","21
textboard.png","22
textclear.png","23
textry2.png","24
textsize.png","25
toblackandwhite.png","26
whiteminus.png","27
whiteplus.png"}28
*/
String icopath
String icoext
final String[] appicons = {"180flip","blueminus","blueplus","cropclear","cropdo","cropset","doresize","gammapply","gammatry","greenminus","greenplus","hueboard","longside","mirror","open","quickboardminus","quickboardplus","redminus","redplus","rotateccw","rotatecw","saveas","textboard","textclear","textry2","textsize","toblackandwhite","whiteminus","whiteplus"}
Image[] appiconsIMG
//CONSTRUCTORFOLLOWS
SidewinderPhotoColourBalancer(String[] args){ //takesastringargfromdraganddroponiconlater
//INSIDECONSTRUCTOR
this.args=args
//
firstopenedis=false
cropsysstate=false
Aoriale = (java.util.Locale)Locale.US //java.util.LocaleAorialeComponentOrientationAcmpo
Acmpo = ComponentOrientation.getOrientation(Aoriale)
setComponentOrientation(Acmpo)
try{
flsep=System.getProperty("file.separator")
linesep=System.getProperty("line.separator")
curropendir = System.getProperty("user.home")
currsavdir = System.getProperty("user.home")
sysOS=(System.getProperty("os.name")).getBytes("ISO88591")
wnei = new String(sysOS,0,sysOS.length)
app_Classpath_PATH=System.getProperty("java.class.path")
//
if((wnei.equals("WindowsXP"))||(wnei.equals("WindowsNT"))||(wnei.equals("Windows2000"))||(wnei.equals("Windows98"))||(wnei.equals("WindowsMe"))||(wnei.equals("Windows2003"))||(wnei.equals("Windows_NT"))||(wnei.equals("WindowsNT(unknown)"))||(wnei.equals("WindowsVista"))){
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf((flsep+"engine"))))
icopath=app_PATH+flsep+"dat"+flsep+"sidewinder5050icons"+flsep+"ico"+flsep
icoext=".gif"
applicationIconMaker()
}else{
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf(flsep+"engine")))
icopath=app_PATH+flsep+"dat"+flsep+"sidewinder5050icons"+flsep
icoext=".png"
//req.tobe.giftestonly
applicationIconMaker()
}

Page 1 / 32

//
if((wnei.equals("WindowsXP"))||(wnei.equals("WindowsNT"))||(wnei.equals("Windows2000"))||(wnei.equals("Windows98"))||(wnei.equals("WindowsMe"))||(wnei.equals("Windows2003"))||(wnei.equals("Windows_NT"))||(wnei.equals("WindowsNT(unknown)"))||(wnei.equals("WindowsVista"))){
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf((flsep+"engine"))))
icopath=app_PATH+flsep+"dat"+flsep+"sidewinder5050icons"+flsep+"ico"+flsep
icoext=".gif"
applicationIconMaker()
}else{
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf(flsep+"engine")))
icopath=app_PATH+flsep+"dat"+flsep+"sidewinder5050icons"+flsep
icoext=".png"
//req.tobe.giftestonly
applicationIconMaker()
}
}catch(java.io.UnsupportedEncodingException unspenc){
}finally{}
//==instantiateerrorhandlerfortheerrorhandler(doublestageifthefirstfails)
try{
errF=app_PATH+flsep+"dat"+flsep+"errTraceSidewinder.txt"
errFil=new File(errF)
pr=new PrintStream(((OutputStream)new FileOutputStream(errFil,true)))
//==//eiyti.printStackTrace(pr)
}catch(java.io.FileNotFoundException fifterr){
System.out.println("ConstructorEXCEPTION:java.io.FileNotFoundException"+errF+"ErrorhandlersystemdownSidewinderPhotoColourBalancer.java")
}catch(java.lang.Exception excA){
System.out.println("ConstructorEXCEPTION:java.lang.ExceptionErrorhandlersystemdownSidewinderPhotoColourBalancer.java")
}finally{}
try{
String sw400pth = app_PATH+flsep+"dat"+flsep+"SidewinderA400.jpg"
inputimage = new File(sw400pth)
splatter = new Splashframe(sw400pth )
uifont = ((Font)splatter.appfon) //,1,8)//(nopointing)originalwillsoonbeinanullclass
imcanv = new ImageSysTest(inputimage)
//GETSTHEIMAGE
}catch(java.io.FileNotFoundException finotfn){
finotfn.printStackTrace(pr)
}catch(javax.imageio.IIOException imgioexc){
imgioexc.printStackTrace(pr)
}catch(java.io.IOException ioexconst){
ioexconst.printStackTrace(pr)
}catch(java.lang.Exception excafAS){
stackExPasthru((Throwable)excafAS)
}finally{}
/*catch(java.io.IOExceptionioexconst){
ioexconst.printStackTrace(pr)
}*/
//
rsZidx=0
oldrsZidx=0
//splatter.repaint(((long)newLong("10").longValue()))
splatter.toFront()splatter.repaint()
splatter.mssg="StartingSidewinder........"
splatter.mssgPrs()
//splatter.sidewindersplash.paintComponent(splatter.sidewindersplash.getGraphics())
passPane=""
bgbut = new JPanel[4] //WAS4NOW3
bgbut[0] = new JPanel()
bgbut[0].setPreferredSize(new Dimension(210,65))
bgbut[0].setSize(new Dimension(210,65))
bgbut[0].setLayout(new java.awt.FlowLayout(1,4,4))
bgbut[0].setBackground(new Color(255,0,0))
bgbut[1] = new JPanel()
bgbut[1].setPreferredSize(new Dimension(210,65))
bgbut[1].setSize(new Dimension(210,65))
bgbut[1].setLayout(new java.awt.FlowLayout(1,4,4))
bgbut[1].setBackground(new Color(0,255,0))
bgbut[2] = new JPanel()
bgbut[2].setPreferredSize(new Dimension(210,65))
bgbut[2].setSize(new Dimension(210,65))
bgbut[2].setLayout(new java.awt.FlowLayout(1,4,4))
bgbut[2].setBackground(new Color(0,0,255))
bgbut[3] = new JPanel()
bgbut[3].setPreferredSize(new Dimension(210,65))
bgbut[3].setSize(new Dimension(210,65))
bgbut[3].setLayout(new java.awt.FlowLayout(1,4,4))
bgbut[3].setBackground(new Color(255,255,255))
//createButt()deled
splatter.toFront()splatter.repaint()
splatter.mssg="Sidewinder:LoadingListGUIParts........"
splatter.mssgPrs()
szcombomod = new javax.swing.DefaultComboBoxModel()
szcombomod.addElement((Object)"1/1")
szcombomod.addElement((Object)"3/4")
szcombomod.addElement((Object)"2/3")
szcombomod.addElement((Object)"1/2")
szcombomod.addElement((Object)"5/12")
szcombomod.addElement((Object)"1/3")
szcombomod.addElement((Object)"1/4")
szcombomod.addElement((Object)"1/5") //
szcombomod.addElement((Object)"3/16") //
szcombomod.addElement((Object)"1/6") //
szcombomod.addElement((Object)"1/8")
szcombomod.addElement((Object)"1/10")
szcombomod.addElement((Object)"1/12")
szcombomod.addElement((Object)"1/16")
jox = new JComboBox(szcombomod)
jox.addItemListener(this)
inpcombomodset = new javax.swing.DefaultComboBoxModel[4]
for(int ckco=0(ckco<4)ckco++){
inpcombomodset[ckco] = new javax.swing.DefaultComboBoxModel()
inpcombomodset[ckco].addElement((Object)"1")
inpcombomodset[ckco].addElement((Object)"2")
inpcombomodset[ckco].addElement((Object)"3")
inpcombomodset[ckco].addElement((Object)"4")
inpcombomodset[ckco].addElement((Object)"5")
inpcombomodset[ckco].addElement((Object)"6")
inpcombomodset[ckco].addElement((Object)"7")
inpcombomodset[ckco].addElement((Object)"8")
inpcombomodset[ckco].addElement((Object)"9")
inpcombomodset[ckco].addElement((Object)"10")
inpcombomodset[ckco].addElement((Object)"15")
inpcombomodset[ckco].addElement((Object)"20")
inpcombomodset[ckco].addElement((Object)"30")
}//enfr
splatter.toFront()splatter.repaint()
splatter.mssg="Sidewinder:LoadingListGUIParts........"
splatter.mssgPrs()
inptnums = new javax.swing.JComboBox[4]
for(int vfgf=0(vfgf<4)vfgf++){
inptnums[vfgf] = new JComboBox(inpcombomodset[vfgf])
}//enfr
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingComboBoxGUIParts........"
splatter.mssgPrs()
inptnums[0].setBackground(new Color(255,200,200))
inptnums[1].setBackground(new Color(200,255,200))
inptnums[2].setBackground(new Color(200,200,255))
inptnums[3].setBackground(new Color(255,255,255))
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingComboBoxGUIParts........"
splatter.mssgPrs()
toolpan = new JPanel()
toolpan.setSize(1000,65)
toolpan.setLayout(new java.awt.FlowLayout(1,4,4))
/*
//toolpan.add(wrkPROG)//wrkprog
privatefinalString[]uibuttcommand={"REDUP","REDDOWN","GREENUP","GREENDOWN","BLUEUP","BLUEDOWN","WHITEUP","WHITEDOWN","OPENFILE","SAVAS"}
colbutt[xnm].setFont(uifont)
colbutt[xnm].setActionCommand(uibuttcommand[xnm])
colbutt[xnm].addActionListener(this)
*/
colbutt = new JButton[10]
colbutt[0] = new JButton(new ImageIcon(appiconsIMG[17]))
colbutt[1] = new JButton(new ImageIcon(appiconsIMG[18]))
colbutt[2] = new JButton(new ImageIcon(appiconsIMG[9]))
colbutt[3] = new JButton(new ImageIcon(appiconsIMG[10]))
colbutt[4] = new JButton(new ImageIcon(appiconsIMG[1]))
colbutt[5] = new JButton(new ImageIcon(appiconsIMG[2]))
colbutt[6] = new JButton(new ImageIcon(appiconsIMG[27]))
colbutt[7] = new JButton(new ImageIcon(appiconsIMG[28]))
colbutt[8] = new JButton(new ImageIcon(appiconsIMG[14])) //open
colbutt[9] = new JButton(new ImageIcon(appiconsIMG[21])) //savas
colbutt[8].setPreferredSize(new Dimension(54,54))
colbutt[8].setSize(54,54)
colbutt[8].setFont(uifont)
colbutt[8].setActionCommand(uibuttcommand[8]) //open
colbutt[8].addActionListener(this)
colbutt[9].setPreferredSize(new Dimension(54,54))
colbutt[9].setSize(54,54)
colbutt[9].setFont(uifont)
colbutt[9].setActionCommand(uibuttcommand[9]) //savas
colbutt[9].addActionListener(this)
colbutt[0].setPreferredSize(new Dimension(54,54))
colbutt[0].setSize(54,54)
colbutt[0].setFont(uifont)
colbutt[0].setActionCommand(uibuttcommand[1])
colbutt[0].addActionListener(this)
//colbutt[1].setBackground(newColor(255,0,0))
colbutt[1].setPreferredSize(new Dimension(54,54))
colbutt[1].setSize(54,54)
colbutt[1].setFont(uifont)
colbutt[1].setActionCommand(uibuttcommand[0])
colbutt[1].addActionListener(this)
//
bgbut[0].add(colbutt[0])
bgbut[0].add(inptnums[0])
bgbut[0].add(colbutt[1])
toolpan.add(bgbut[0])
//
colbutt[2].setPreferredSize(new Dimension(54,54))
colbutt[2].setSize(54,54)
colbutt[2].setActionCommand(uibuttcommand[3])
colbutt[2].addActionListener(this)
colbutt[2].setFont(uifont)
colbutt[3].setPreferredSize(new Dimension(54,54))
colbutt[3].setSize(54,54)
colbutt[3].setActionCommand(uibuttcommand[2])
colbutt[3].addActionListener(this)
colbutt[3].setFont(uifont)
//
bgbut[1].add(colbutt[2])
bgbut[1].add(inptnums[1])
bgbut[1].add(colbutt[3])
toolpan.add(bgbut[1])
//
colbutt[4].setPreferredSize(new Dimension(54,54))
colbutt[4].setSize(54,54)
colbutt[4].setActionCommand(uibuttcommand[5])
colbutt[4].addActionListener(this)
colbutt[4].setFont(uifont)
colbutt[5].setPreferredSize(new Dimension(54,54))
colbutt[5].setSize(54,54)
colbutt[5].setActionCommand(uibuttcommand[4])
colbutt[5].addActionListener(this)
colbutt[5].setFont(uifont)
//
bgbut[2].add(colbutt[4])
bgbut[2].add(inptnums[2])
bgbut[2].add(colbutt[5])
toolpan.add(bgbut[2])
//

colbutt[6].setPreferredSize(new Dimension(54,54))
colbutt[6].setSize(54,54)
colbutt[6].setActionCommand(uibuttcommand[7])
colbutt[6].addActionListener(this)
colbutt[6].setFont(uifont)
colbutt[7].setPreferredSize(new Dimension(54,54))
colbutt[7].setSize(54,54)
colbutt[7].setActionCommand(uibuttcommand[6])
colbutt[7].addActionListener(this)
colbutt[7].setFont(uifont)
//
bgbut[3].add(colbutt[6])
bgbut[3].add(inptnums[3])
bgbut[3].add(colbutt[7])
//
bwbttn = new JButton(new ImageIcon(appiconsIMG[26])) //"ToB&W")
bwbttn.setPreferredSize(new Dimension(54,54))
bwbttn.setSize(new Dimension(54,54))
bwbttn.setFont(uifont)
bwbttn.setToolTipText("ConverttoBlackandWhitePhoto")
bwbttn.setActionCommand("BLACKUNDWAAAHT")
bwbttn.addActionListener(this)
toolpan.add(bgbut[3])
//toolpan.add(bwbttn)//toBW
//
toolpan.add(jox)
//
mkCropGUI()
//
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
panset = new javax.swing.JPanel[4] //
panset[0] = new javax.swing.JPanel()
panset[1] = new javax.swing.JPanel()
panset[2] = new javax.swing.JPanel() //upperviewPICTURE
panset[3] = new javax.swing.JPanel() //lowerview
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
panviewset = new javax.swing.JViewport[2]
importJl((BufferedImage)bumiSZpaint) //makestpn
panset[2].add(tpn)
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
panviewset[0]= new javax.swing.JViewport()
//panset[2]
panviewset[1]= new javax.swing.JViewport()
panviewset[0].setView(panset[2])
panviewset[0].setScrollMode(2)
//
metaPne = new javax.swing.JTextArea()
panset[3].setLayout(new BorderLayout())
panset[3].add(metaPne)
panviewset[1].setView(panset[3])
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()

Page 2 / 32

panviewset[0]= new javax.swing.JViewport()


//panset[2]
panviewset[1]= new javax.swing.JViewport()
panviewset[0].setView(panset[2])
panviewset[0].setScrollMode(2)
//
metaPne = new javax.swing.JTextArea()
panset[3].setLayout(new BorderLayout())
panset[3].add(metaPne)
panviewset[1].setView(panset[3])
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
panscro = new javax.swing.JScrollPane[2]
panscro[0] = new javax.swing.JScrollPane(panviewset[0],20,30)
panscro[1] = new javax.swing.JScrollPane(panviewset[1],20,30)
panset[0].setLayout(new BorderLayout())
panset[0].add(panscro[0])
//impliesCENTER
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
//splatter.drawMssg("StartingSidewinderLoadingGUIParts........")
panset[1].setLayout(new BorderLayout())
panset[1].add(panscro[1],BorderLayout.CENTER)
//impliesCENTER
panset[1].add(contain,BorderLayout.NORTH)
//impliesCENTER
panesplit = new javax.swing.JSplitPane(0,true,panset[0],panset[1])
panesplit.setDividerSize(10)
double dbla = ((double)new Double("0.5").doubleValue())
panesplit.setDividerLocation(dbla)
panesplit.setOneTouchExpandable(true)
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
labpan = new javax.swing.JPanel()
labpan.setLayout(new BorderLayout())
labpan.add(toolpan,BorderLayout.NORTH)
labpan.add(panesplit)
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
wras = bumi.getRaster()
imH = wras.getHeight()
int httimg=imH
lenw = wras.getWidth()
int lenbrdthimg=lenw
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingSpecialGUIParts........"
splatter.mssgPrs()
rgbDimArr = new MultiDimArr()
red_Overstep = rgbDimArr.colOverstepstore(0,imH,lenw,wras)
green_Overstep = rgbDimArr.colOverstepstore(1,imH,lenw,wras)
blue_Overstep = rgbDimArr.colOverstepstore(2,imH,lenw,wras)
SwingUtilities.invokeLater(new Runnable(){
public void run(){
try{
setIconImage((sw32ico=((Toolkit)splatter.getToolkit()).getImage(app_PATH+flsep+"Sidewinder32.gif")))
}catch(java.lang.Exception excaf1){
stackExPasthru((Throwable)excaf1)
}finally{}
//mkSwngSz()
setSize(new java.awt.Dimension(800,700))
getContentPane().add(labpan)
setTitle("SidewinderPhotoColourBalancer")
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingMainGUIParts........"
splatter.mssgPrs()
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
pr.close() //errorprintstreamclose
System.exit(0)
}
})
//
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingMainGUIParts........"
splatter.mssgPrs()
try{
flimstrm.close()
imgInpStr.close()
flimstrm = null
imgInpStr = null
}catch(java.io.IOException ioexconst2){
stackExPasthru((Throwable)ioexconst2)
}finally{}
setDefaultCloseOperation(2)
setVisible(true)
setIgnoreRepaint(false)
labpan.setIgnoreRepaint(false)
tpn.setIgnoreRepaint(false)
tpn.repaint()
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingMainGUIParts........"
splatter.mssgPrs()
imcanv=null
//
metaPne.setText("===SidewinderPhotoColourBalancerF2C17(FirstSimpleVersion)CompiledonX86DebianLinuxwrittenandcompiledinOracleJava2JDK1.5.0_07==="+linesep)
metaPne.append("===TestedWithLINUXDebian\"Squeeze\"GnomeDesktopandKubuntu9.04KDesktop==="+linesep)
metaPne.append("===ThisF2C17fileset(withthismessagehere)isaMSWindows\"ReCompile\"BECAUSE***someMSWindowsversionsdidnotshowthecontrolicons!!!==="+linesep)
metaPne.append("===ByexperiencethisversionwilloperateinBOTHLinuxandMSWindows==="+linesep)
metaPne.append("===(ItwasonlyfiletypeforIconproblem.icoonlyoperatesinsomeJava+MSWin)==="+linesep)
metaPne.append("Created:October2010October16th2014SydneyNSWAustralia,byMr.S.A.Marchant,nicephotog@gmail.com"+linesep)
metaPne.append("(oldsitewww.nicephotogjsp.netexistsnolonger)newsitehttp://windsolarhybridaustralia.x10.mx/"+linesep)
metaPne.append("SidewinderPhotoColourBalancer:isa24bitColourPhotoRGBmanualcolourlevelbalancer"+linesep)
//metaPne.append(""+linesep)
metaPne.append("(dependantIF:andsometimesotherse.g.1.6.0_22)(formerlySunMicrosystemsInc.Java2JDKorSDK)."+linesep)
metaPne.append("OracleSoftwareagreementtermsofusecanbefoundatthissite:http://www.oracle.com/html/terms.html"+linesep)
metaPne.append("fileextensions.jpg,.jpeg,.bmp,.pngareall\"canbesaved\"butnocompressionandqualitysettingsystemis"+linesep)
metaPne.append("suppliedbythisprogramuserinterface(thoughusuallyataround92%95%),soitissuggestedthatyousave"+linesep)
metaPne.append("anyfileyouworkoninthisasa.bmpor.png"+linesep)
metaPne.append("Itrequiresuseofanotherimagingprogramtosetqualityandcompressiontomakea.jpgofguarenteedqualityina"+linesep)
metaPne.append("smallcompressedfilesizeforJPEGtypes."+linesep)
metaPne.append("ThisversionF2C17hasabetterjavaAPIimagefilesavingsystemandbettersupportforthumbimagesonJPEGtypes."+linesep)
metaPne.append("ThisversionofSidewinderPhotoColourBalanceristhefirst\"Icon\"ifiedversion."+linesep)
guiOpOccurring = false
splatter.toFront()splatter.repaint() //
splatter.mssg="Sidewinder:LoadingMainGUIParts........"
splatter.mssgPrs()
splatter.setVisible(false)
splatter.dispose()
splatter=null
contain.repaint()
//
work = new WorkBar((int)bumi.getHeight())
wrkprogess = new WorkWindowProgressor(work,sw32ico)
wrkprogess.reshower() //WorkBarworkwrkprogess.reshower()
//
Runtime.getRuntime().gc()
Runtime.getRuntime().runFinalization()
}
}) //runnable}eninvk
//publicvoidrunend===========================================================
//JOptionPane.showMessageDialog(newJFrame(),"args[0]:"+args[0])
new OpOpencommline() //
rotateSysClss()
RGBgammaSetterBoot()
RGBhueSetterBoot()
RGBlinearBoot()
//RGBcontrastBoot()
RGBlinearSingleBoot()
refreshBWmake()
}//enconstr
//quickcolourboardqbourdColoffsqbourdColoffl(
protected void qbourdColoffs(boolean aboo,boolean bbo,int ac1,int ab1){
RGBlinearSingleBoot()
//
int rsZidx = rSzIdx(jox.getSelectedIndex())
coloffs.changePixelsInRaster(aboo,bbo,ac1,ab1)
//
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
rotationPopulator(bWI,bHI)
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}else{
makeImgRsz(oldrsZidx)
}
tpn.repaint()
/*
tpn.setSize(newDimension(bumi.getWidth(),bumi.getHeight()))
tpn.setIcon(newImageIcon((Image)bumi))
tpn.repaint()
makeImgRsz(rsZidx)
*/
}//enmeth

//model(true,false,0,newInteger(trist).intValue())

//whiteupdown
protected void qbourdColoffl(boolean aboo,boolean bbo,int ac1,int ab1){
RGBlinearBoot()
int rsZidx = rSzIdx(jox.getSelectedIndex())
coloffl.changePixelsInRaster(aboo,bbo,ac1,ab1)
//
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
rotationPopulator(bWI,bHI)
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}else{
makeImgRsz(oldrsZidx)
}
tpn.repaint()
/*ROTATIONPOPULAROT()SHOULDDOTHISONWAYOUTOFLISTENER
tpn.setSize(newDimension(bumi.getWidth(),bumi.getHeight()))
tpn.setIcon(newImageIcon((Image)bumi))
tpn.repaint()
*/
makeImgRsz(rsZidx)
}//enmeth

void applicationIconMaker(){
appiconsIMG = new Image[29]
try{
for(int trx = 0 trx<29 trx++){
appiconsIMG[trx]=((Toolkit)this.getToolkit()).getImage((icopath+appicons[trx]+icoext))
}
}catch(java.lang.Exception excaf1){
stackExPasthru((Throwable)excaf1)
}finally{}
}

public void paintImageText(Color textimgcol,Font fon,String inst,int stdhi){


//JOptionPane.showMessageDialog(newJFrame(),"REACHEDpaintImageText(...)")
Graphics bu = bumi.getGraphics()
bu.setColor(textimgcol)
bu.setPaintMode()
//bu.setFont(newFont("arialblack",0,72))
bu.setFont(fon)
byte[] insbyt=inst.getBytes()
int lnby=insbyt.length

//+stdhi

//MODIFIEDFROMTHECROPPINGCLASSpoint2=newPoint(e.getX(),e.getY())RATIOTRANSLATER
int joxMultiplier=jox.getSelectedIndex()
//
double sztoit=0D
int xleft=tpn.textPointset[0]
int yleftdown=tpn.textPointset[1]
if(joxMultiplier==3){//1/2
sztoit=2D
}else if(joxMultiplier==5){//1/3
sztoit=3D
}else if(joxMultiplier==6){//1/4
sztoit=4D
}else if(joxMultiplier==7){//1/5
sztoit=5D
}else if(joxMultiplier==9){//1/6
sztoit=6D
}else if(joxMultiplier==10){//1/8
sztoit=8D
}else if(joxMultiplier==11){//1/10
sztoit=10D
}else if(joxMultiplier==12){//1/12
sztoit=12D
}else if(joxMultiplier==13){//1/16
sztoit=16D
}else{}
//
if(joxMultiplier!=0){ //*0BYZEROBRINGSBACK0
if(joxMultiplier==1){ //3/4
xleft = (int)new Double((double)(new Integer(xleft).doubleValue()/3D)*4D).intValue()
yleftdown = (int)new Double((double)(new Integer(yleftdown).doubleValue()/3D)*4D).intValue()
}else if(joxMultiplier==2){ //2/3
xleft = (int)new Double((double)(new Integer(xleft).doubleValue()/2D)*3D).intValue()
yleftdown = (int)new Double((double)(new Integer(yleftdown).doubleValue()/2D)*3D).intValue()
}else if(joxMultiplier==4){ //5/12
xleft = (int)new Double((double)(new Integer(xleft).doubleValue()/5D)*12D).intValue()
yleftdown = (int)new Double((double)(new Integer(yleftdown).doubleValue()/5D)*12D).intValue()
}else if(joxMultiplier==8){ //3/16
xleft = (int)new Double((double)(new Integer(xleft).doubleValue()/3D)*16D).intValue()
yleftdown = (int)new Double((double)(new Integer(yleftdown).doubleValue()/3D)*16D).intValue()
}else{
xleft = new Double((new Integer(xleft).doubleValue()*sztoit)).intValue()
yleftdown = new Double((new Integer(yleftdown).doubleValue()*sztoit)).intValue()
}
}//enif
//FOLLOWEDBY
bu.drawBytes(insbyt,0,lnby,xleft,(yleftdown+stdhi))
tpn.repaint()
}//enmeth
void callPaintMarginBox(int widR,int hitR){//,Fontfr
//JOptionPane.showMessageDialog(newJFrame(),"callPaintMarginBox"+widR+""+hitR+""+fr.getName())
//tpn.repaint()
tpn.setArrTxlenwid(widR,hitR)//textLen
//tpn.paintMarginBox()//,fr
if(tpn.txtTimeFlg==0){
tpn.timeMarginBox()//timeflag(0)toswitchitoff
}//enif
}//enmeth
void toPointsFields(int xf,int yf){

Page 3 / 32

void callPaintMarginBox(int widR,int hitR){//,Fontfr


//JOptionPane.showMessageDialog(newJFrame(),"callPaintMarginBox"+widR+""+hitR+""+fr.getName())
//tpn.repaint()
tpn.setArrTxlenwid(widR,hitR)//textLen
//tpn.paintMarginBox()//,fr
if(tpn.txtTimeFlg==0){
tpn.timeMarginBox()//timeflag(0)toswitchitoff
}//enif
}//enmeth
void toPointsFields(int xf,int yf){
fontextbaud.setPointFields(xf,yf)
}//enmeth

public void txflagOff(){


tpn.timeflag(0)
tpn.textWriteFlgOFF()
}//enmeth
public void txflagOn(){
tpn.textWriteFlgON()
}//enmeth
//textPointset
public void callTpnRepaint(){
tpn.repaint()
}//enmeth
class OpOpencommline extends Thread{
OpOpencommline(){
//openCommLinefile()
super.setDaemon(false)
super.setPriority(10)
try{
super.sleep(2000L)
}catch(java.lang.InterruptedException intrrp){
stackExPasthru((Throwable)intrrp)
}finally{}
this.openCommLinefile()
}//enconstr

protected void openCommLinefile(){


if(args.length>0){
if(((String)args[0]).length() > 5){
java.io.File fk = new java.io.File(((String)args[0]))
inputIMGfile(fk)
checkopen()
}
}
return
}//enmeth
}//enclss

void callGamma(boolean upgamm,boolean act,int setting,boolean iscontrast){

//callGamma(upgamm,act,setting)

int rsZidx = rSzIdx(jox.getSelectedIndex()) //setinstanceviewsizeattimebeforerepaintremovereplaceimageaction


rgbSetgamm.changePixelsInRaster(upgamm,act,setting,iscontrast)
rotationPopulator(bumi.getWidth(),bumi.getHeight())
makeImgRsz(rsZidx)
}//enmeth

void callHue(boolean upn,int colnimcolour,int[] paramBalsettVals){


int rsZidx = rSzIdx(jox.getSelectedIndex())
colHue.changePixelsInRaster(upn,colnimcolour,paramBalsettVals)
rotationPopulator(bumi.getWidth(),bumi.getHeight())
makeImgRsz(rsZidx)
}//enmeth
void callHue(boolean upn,int[] paramBalsettVals){
RGBlinearBoot(paramBalsettVals)
int rsZidx = rSzIdx(jox.getSelectedIndex())
coloffl.changePixelsInRaster(upn,true,0,1)
rotationPopulator(bumi.getWidth(),bumi.getHeight())
makeImgRsz(rsZidx)
RGBlinearBoot() //!!!RETURNITBACKputitbacktothenormalone
}//enmeth

RGBchangeCoeffLinearGammaSetter RGBgammaSetterBoot(){
rgbSetgamm = new RGBchangeCoeffLinearGammaSetter(this)
return rgbSetgamm
}
RGBchangeCoeffLinearSingleHueSetter RGBhueSetterBoot(){
colHue = new RGBchangeCoeffLinearSingleHueSetter(this)
return colHue
}

RGBchangeCoeffLinear RGBlinearBoot(){ //RGBlinearBoot()RGBcontrastBoot()


coloffl = new RGBchangeCoeffLinear(this)
return coloffl
}
//nextusedbyhueboard(otheruserquickboard)
RGBchangeCoeffLinear RGBlinearBoot(int[] paramset){ //RGBlinearBoot()RGBcontrastBoot()
coloffl = new RGBchangeCoeffLinear(this,paramset)
return coloffl
}
/*
RGBchangeCoeffContrastRGBcontrastBoot(){
coloffc=newRGBchangeCoeffContrast(this)
returncoloffc
}
*/
RGBchangeCoeffLinearSingle RGBlinearSingleBoot(){ //RGBlinearBoot()RGBcontrastBoot()
coloffs = new RGBchangeCoeffLinearSingle(this)
return coloffs
}
ConvertToBandW refreshBWmake(){
bnw=new ConvertToBandW(this)
return bnw
}//enmeth

//==========================
//developedbecauseStackPrinterPasthroughclassrequiresioexceptiononinstantiationuse
//dontneedtocontinuallywrapioexceptionsaroundnewStackPrinterPasthrough(thrower)
void stackExPasthru(Throwable thrower){
try{
new StackPrinterPasthrough(thrower)
}catch(IOException iniyti){
iniyti.printStackTrace(pr)
}catch(Exception eiyti){
eiyti.printStackTrace(pr)
}finally{}
} //enmeth
//============================
public static void main(String Args[])throws java.io.FileNotFoundException,javax.imageio.IIOException,java.io.IOException,java.lang.Exception{
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
new SidewinderPhotoColourBalancer(((String[])Args))//shouldtakeargs[]
//lookAndFeel="com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
}catch(UnsupportedLookAndFeelException e){
//handleexception
}catch (ClassNotFoundException e){
//handleexception
}catch(InstantiationException e){
//handleexception
}catch(IllegalAccessException e){
//handleexception
}
}//enmain
protected JLabel importJl(BufferedImage beefm){
tpn = new ImWin(beefm)
return tpn
}//enmain
boolean guiOpOccurPresent(boolean guiin){
guiOpOccurring=guiin
return guiOpOccurring
}//enmeth
void makeThumbAddPanel(){
thmsz = new javax.swing.DefaultComboBoxModel()
thmsz.addElement((Object)"80")
thmsz.addElement((Object)"90")
thmsz.addElement((Object)"100")
thmsz.addElement((Object)"110")
thmsz.addElement((Object)"120")
thmsz.addElement((Object)"130")
thmsz.addElement((Object)"140")
thmsz.addElement((Object)"150")
thmsz.addElement((Object)"160")
thmsz.addElement((Object)"170")
thmsz.addElement((Object)"180")
thmsz.addElement((Object)"190")
thmsz.addElement((Object)"200")
thmsz.addElement((Object)"210")
thmsz.addElement((Object)"220")
thmsz.addElement((Object)"230")
//
sett = new JLabel("LongsideApprox.lengthPixels")
sett.setPreferredSize(new Dimension(220,25))
sett.setSize(new Dimension(220,25))
settLong = new JComboBox(thmsz)
settLong.setPreferredSize(new Dimension(220,25))
settLong.setSize(new Dimension(220,25))
setchoice = new JButton("SetAddedThumbSize")
setchoice.setActionCommand("SETTHUMBSZ")
setchoice.addActionListener(this)
setchoice.setPreferredSize(new Dimension(220,25))
setchoice.setSize(new Dimension(220,25))
frmpanl = new JPanel()
frmpanl.setLayout(new java.awt.FlowLayout(4,5,5)) //4=trailing1=center
frmpanl.setPreferredSize(new Dimension(245,135))
frmpanl.setSize(new Dimension(245,135))
frmpanl.add(sett)
frmpanl.add(settLong)
frmpanl.add(setchoice)
thmbFrm = new JFrame("AddedThumbImageSetting")
thmbFrm.setDefaultCloseOperation(2)
try{
thmbFrm.setIconImage(((Toolkit)thmbFrm.getToolkit()).getImage(app_PATH+flsep+"Sidewinder32.gif"))
}catch(java.lang.Exception excaf2){
stackExPasthru((Throwable)excaf2)
}finally{}
thmbFrm.setSize(new Dimension(245,135))
thmbFrm.getContentPane().add(frmpanl)
thmbFrm.setVisible(true)
thmbFrm.setIgnoreRepaint(false)
}//enmeth
String actionComm(String passCommAct){
actComm = passCommAct
return actComm
}//enmeth
void makeQuickBoard(BufferedImage abu,String aapp_PATH,int awdin,int ahdin,boolean uPdowN){
//SwingUtilities.invokeLater(newRunnable(){
//publicvoidrun(){
qbrd = new QuickBoardColour(this,abu,aapp_PATH,awdin,ahdin,uPdowN)
qbrd.setVisible(true)
//}
//})
return
} //enmeth
java.awt.Image quickImg(int awdin,int ahdin){
return bumi.getScaledInstance(awdin,ahdin,4)
}//enmeth
void readyQuickboard(boolean upordown){
boolean longside=false
int lsdz=350 //iconmax200pixels
int wz=bumi.getWidth()
int hz=bumi.getHeight()
if(wz>hz){
longside=true
}
float coef=0
float lngz = new Integer(lsdz).floatValue()
float hiz = new Integer(hz).floatValue()
float wiz = new Integer(wz).floatValue()
if(longside==true){ //"otherelse"istheheight
coef=lngz/wiz
}else{//
coef=lngz/hiz
}
float nht=coef*hiz
float nwd=coef*wiz
int wdin = (new Float(nwd).intValue())
int hdin = (new Float(nht).intValue())
//
try{
java.awt.Image bmiresiz = quickImg(wdin,hdin)
BufferedImage bu = new BufferedImage(wdin,hdin,bumi.getType())
Graphics gr=bu.getGraphics()
gr.drawImage(bmiresiz,0,0,null)
makeQuickBoard(bu,app_PATH,wdin,hdin,upordown)
}catch(Exception exsxa){
//System.out.println(exsxa.getMessage())
exsxa.printStackTrace(pr)
}finally{}
}//enmeth

void mcHue(){
hu = new HueBoard(this) //WARNINGTESTPARAMETERSFEDONLY!!!!
}//enmeth
//

Page 4 / 32

}catch(Exception exsxa){
//System.out.println(exsxa.getMessage())
exsxa.printStackTrace(pr)
}finally{}
}//enmeth

void mcHue(){
hu = new HueBoard(this) //WARNINGTESTPARAMETERSFEDONLY!!!!
}//enmeth
//
//setValue()
//repaint()
void rotateCW(){
work.makeParamWork(100) //swinder.bumi.getWidth()
rotateSysClss() //newRotators
work.setValue(10)
work.repaint()
//
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
redCWRemake(bWI,bHI)
//work.setValue(20)
//work.repaint()
//
doGarbageClear()
greenCWRemake(bWI,bHI)
//work.setValue(30)
//work.repaint()
//
doGarbageClear()
blueCWRemake(bWI,bHI)
//work.setValue(40)
//work.repaint()
//
doGarbageClear()
bmiMKrotate(bHI,bWI) //makesaCWrotatedbumi
//work.setValue(50)
//work.repaint()
roTor = null
clearthumbL()
doGarbageClear()
//NOTICE(argumentsin!!!SP)FILLIN!!!MUSTBEDONEINHERErunthetranslatorpopulatormethodnext
rotationPopulator(bHI,bWI)
//work.setValue(70)
////work.repaint()
//nowsetSizesetIconrepaint
//!!!!!!TPNMUSTBERESET"IN"HERE
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.setSize(new Dimension(bWI,bHI))
tpn.repaint()
//makeImgRsz(oldrsZidx)
//work.setValue(100)
//work.repaint()
metaPne.append("===RotatedImage:==="+linesep)
metaPne.append("===width:"+bumi.getWidth()+linesep)
metaPne.append("===height:"+bumi.getHeight()+linesep)
metaPne.append("===note:anypreviousthumnailsarecleared"+linesep)
}//enmeth

void rotateCCW(){
rotateSysClss() //newRotators
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
redCCWRemake(bWI,bHI)
doGarbageClear()
greenCCWRemake(bWI,bHI)
doGarbageClear()
blueCCWRemake(bWI,bHI)
doGarbageClear()
bmiMKrotate(bHI,bWI) //"swapstoH,Winsidethecallerfunction"makesaCCWrotatedbumi
roTor = null
clearthumbL()
doGarbageClear()
//
//runthetranslatorpopulatormethodnext
rotationPopulator(bHI,bWI)
//nowsetSizesetIconrepaint
//tpn.setIcon(newImageIcon((java.awt.Image)bumi))
//tpn.setSize(newDimension(bWI,bHI))
//tpn.repaint()
makeImgRsz(oldrsZidx)
metaPne.append("===RotatedImage:==="+linesep)
metaPne.append("===width:"+bumi.getWidth()+linesep)
metaPne.append("===height:"+bumi.getHeight()+linesep)
metaPne.append("===note:anypreviousthumnailsarecleared"+linesep)
}//enmeth
public void actionPerformed(java.awt.event.ActionEvent e){
actionComm(((String)e.getActionCommand()))
//
if(guiOpOccurring==false){
guiOpOccurPresent(true)
//JOptionPane.showMessageDialog(newJFrame(),"command(listenermethodsection):"+((String)e.getActionCommand()))
try{
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
//
if(((boolean)actComm.equals("OPENFILE"))){
passPane=""
chooseOpenFile()
if(firstopenedis==true){
disnableButtons(true) //
}//
tpn.repaint()
guiOpOccurPresent(false)
//
}else{
int btyP=bumi.getType()
if(((int)btyP==5) || ((int)btyP==4) || ((int)btyP==1)){ //normalRGBtruecolour
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
if(((boolean)actComm.equals("THBOO"))&&((thumbleep.isSelected())==true)){
thumbleep.setSelected(false)
}else if(((boolean)actComm.equals("THBLEEP"))&&((thumboo.isSelected())==true)){
thumboo.setSelected(false)
}else if((boolean)actComm.equals("BLACKUNDWAAAHT")){
disnableButtons(true)
refreshBWmake()
bnw.makeBWimage()
rotationPopulator(bumi.getWidth(),bumi.getHeight())
makeImgRsz(oldrsZidx)
metaPne.append("===SwitchedImageToB&W==="+linesep)
doGarbageClear()
//JOptionPane.showMessageDialog(newJFrame(),"APPARRENTSEQUENCEFINNISHED???")
//
}else if(((boolean)actComm.equals("READYBMI"))){
int wz=bumi.getWidth()
int hz=bumi.getHeight()
wzd.setText(new Integer(wz).toString())
hzd.setText(new Integer(hz).toString())
if(hz>wz){
lngz.setText(hzd.getText())
}else{
lngz.setText(wzd.getText())
}
guiOpOccurPresent(false)
disnableButtons(true)
}else if(((boolean)actComm.equals("BMI"))){
lngz.setEnabled(false) //onlylongside
boolean longside=false
int wz=bumi.getWidth()
int hz=bumi.getHeight()
wzd.setText(new Integer(wz).toString())
hzd.setText(new Integer(hz).toString())
if(wz>hz){
longside=true
}
String aa=wzd.getText()
String ab=hzd.getText()
String ac=lngz.getText()
//hzd.getText()
//lngz.getText()
boolean a1 = chKChr(aa)
boolean a2 = chKChr(ab)
boolean a3 = chKChr(ac)
if((a1==true)&&(a2==true)&&(a3==true)){
float coef=0
float lngz = new Float(ac).floatValue()
float hiz = new Float(ab).floatValue()
float wiz = new Float(aa).floatValue()
if(longside==true){ //"otherelse"istheheight
coef=lngz/wiz
}else{//
coef=lngz/hiz
}
float nht=coef*hiz
float nwd=coef*wiz
int wdin = (new Float(nwd).intValue())
int hdin = (new Float(nht).intValue())
//
Image bmiresiz = bumi.getScaledInstance(wdin,hdin,4)
bumi = new BufferedImage(wdin,hdin,bumi.getType())
Graphics tr = bumi.getGraphics()
tr.drawImage(bmiresiz,0,0,wdin,hdin,null)
WritableRaster wras=bumi.getRaster()
red_Overstep = rgbDimArr.colOverstepstore(0,hdin,wdin,wras)
green_Overstep = rgbDimArr.colOverstepstore(1,hdin,wdin,wras)
blue_Overstep = rgbDimArr.colOverstepstore(2,hdin,wdin,wras)
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.setSize(new Dimension(wdin,hdin))
doGarbageClear()
//POPULATORANDMULTIDIMMARTORESETUPAFTERRESIZINGPROCEDURE
//rotationPopulator(bumi.getWidth(),bumi.getHeight())
oldrSzIdx(0) //isalwayskeptbeforeabyassignmenttorSzIdx()
makeImgRsz(0)
jox.setSelectedIndex(0)
metaPne.append("===ResizeofImageDone(previousaspectratio)==="+linesep)
metaPne.append("::NewWidth:"+wdin+""+linesep)
metaPne.append("::NewHeight:"+hdin+""+linesep)
//RESTOREVIEWTOTHEjoxVIEWSELECTIONSETTING
}else{
JOptionPane.showMessageDialog(new JFrame(),"Onlynumbertobeusedastextentries!!")
}
//DOGARBAGECOLLECTIONHERE
lngz.setEnabled(true) //onlylongside
//REENABLEBUTTONSFORGUIHERE
guiOpOccurPresent(false)
disnableButtons(true)
}else if(((boolean)actComm.equals("SAVAS"))){
chooseSaveAsFileLocation()
guiOpOccurPresent(false)
disnableButtons(true)
}else if(((boolean)actComm.equals("SETTHUMBSZ"))){
doSavesys() //"SETTHUMBSZ"isinthethumbimagelistenertrack
}else if(((boolean)actComm.equals("SETCROP"))){
if((cropsysstate==false)&&(((boolean)checkFieldCropval())==true)){
doGarbageClear()
//"setcrop"
cropstater(true)
oldrSzIdx(0) //isalwayskeptbeforeabyassignmenttorSzIdx()
makeImgRsz(0)
jox.setSelectedIndex(0)
mkImCrpPaintSelect()
doGarbageClear()
}else{
cropstater(false)
JOptionPane.showMessageDialog(new JFrame(),"inputtypoerrorinatextentryfieldinputfieldvaluesmustbenumbers")
}//enif
disnableButtons(true)
}else if(((boolean)actComm.equals("CLEARCROP"))){
if(cropsysstate==true){
tpn.cropIsOnflag(false)
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.repaint()
rotationPopulator(bumi.getWidth(),bumi.getHeight())
doGarbageClear()
cropstater(false)
//calltotpnforextraimagenulledandthendogarbage
doGarbageClear()
}
disnableButtons(true)
}else if(((boolean)actComm.equals("DOCROP"))){
if(cropsysstate==true){
doGarbageClear()
//
if(checkFieldCropval()==true){ //!!!checkFieldCropval(excesscodethereareotherplaceshavethistestinternalbutishere
//!!!topreventclasscastexceptionherecheckFieldCropval(
int newide = new Integer(widefield.getText()).intValue()
int newheight = new Integer(heightfield.getText()).intValue()
doGarbageClear()
rotateSysClss() //newRotators
bmiMKrotate(newide,newheight) //
roTor = null
doGarbageClear()
int topLpnt = new Integer(xfield.getText()).intValue()
int topRpnt = new Integer(yfield.getText()).intValue()
//makethenewmodifiedarraysfromtheoriginaloversteps
redCropRemake(topLpnt,topRpnt,newide,newheight)
greenCropRemake(topLpnt,topRpnt,newide,newheight)
blueCropRemake(topLpnt,topRpnt,newide,newheight)
rotationPopulator(bumi.getWidth(),bumi.getHeight())
/*
TODOSETUPCOMPLETEREASSIGNINGOFiioIMAGEOBJECTSE.T.C.FORWRITEANDREFERENCESONbumi
*/
tpn.setSize(new Dimension(newide,newheight))
tpn.setIcon(new ImageIcon(((Image)bumi)))
tpn.repaint()
oldrSzIdx(0) //isalwayskeptbeforeabyassignmenttorSzIdx()
makeImgRsz(0)
jox.setSelectedIndex(0)
tpn.repaint()
clearthumbL()
//Stringcrppa=metaPne.getText()
//metaPne.setText(crppa)
String msgcrpping ="CropDone:Xpos:"+xfield.getText()+"::Ypos:"+ yfield.getText()+"::Width:"+ widefield.getText()+"::Height:"+heightfield.getText()
metaPne.append("===CroppedImage:==="+linesep)
metaPne.append(msgcrpping+linesep)
metaPne.append("===width:"+bumi.getWidth()+linesep)
metaPne.append("===height:"+bumi.getHeight()+linesep)
metaPne.append("===note:anypreviousthumnailsarecleared"+linesep)
//note:iioimagekeptformetadata
}//enif

Page 5 / 32

tpn.repaint()
clearthumbL()
//Stringcrppa=metaPne.getText()
//metaPne.setText(crppa)
String msgcrpping ="CropDone:Xpos:"+xfield.getText()+"::Ypos:"+ yfield.getText()+"::Width:"+ widefield.getText()+"::Height:"+heightfield.getText()
metaPne.append("===CroppedImage:==="+linesep)
metaPne.append(msgcrpping+linesep)
metaPne.append("===width:"+bumi.getWidth()+linesep)
metaPne.append("===height:"+bumi.getHeight()+linesep)
metaPne.append("===note:anypreviousthumnailsarecleared"+linesep)
//note:iioimagekeptformetadata
}//enif
cropstater(false)
doGarbageClear()
}//enif
disnableButtons(true)
}else if(((boolean)actComm.equals("TEXTING"))){
if(tpn.getTextFlag()==false){//stopdoublepanes
//BOOLEANREQUIREDHERETOSWITCHOFFImWinselection
fontextbaud = new FontTextBoard(this)
//metapaneappendisdonefromtextboardclass
}
disnableButtons(true)
}else{
//===================COMPOUNDED
the1 = new ThreadRedux1()
the1.start()
//===================COMPOUNDED
}//enlistenifels
}//enelseforIMAGERESTRAINTS
//
}//enelseforopen
//
}catch(java.lang.IllegalThreadStateException thrupt1){
stackExPasthru((Throwable)thrupt1)
}catch(java.lang.Exception irexc1){
stackExPasthru((Throwable)irexc1)
}finally{}
//
guiOpOccurPresent(false)
//
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}else{
makeImgRsz(oldrsZidx)
}
tpn.repaint()
if(cropsysstate==true){
//disnableButtons(false)
crpRccw.setEnabled(false)
crpcw.setEnabled(false)
//!!!DONOTputguiOpOccurPresent(inhere
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}else{
makeImgRsz(oldrsZidx)
}
tpn.repaint()
}else{
crpRccw.setEnabled(true)
crpcw.setEnabled(true)
if(the1!=null){
the1 = null
}else{
disLowerButs(true)
}//eninnerifels
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
rotationPopulator(bWI,bHI)
}//enifels
doGarbageClear()
}//enifguioccurend
}//eneventmeth
void rotationPopulator(int bumw,int bumhi){ //argsmaybereplaced
WritableRaster bumras = bumi.getRaster()
int caccr = 0
//System.out.println("hibum:"+hibum+"wibum"+wibum+"bumw"+bumw+"bumhi"+bumhi)
while(caccr<bumhi){
for(int tdsf=0tdsf<bumwtdsf++){
int red=0
int green=0
int blue=0
red = new Short(red_Overstep[caccr][tdsf]).intValue()
green = new Short(green_Overstep[caccr][tdsf]).intValue()
blue = new Short(blue_Overstep[caccr][tdsf]).intValue()
if(red>255){
red = 255
}else if(red<0){
red = 0
}else{}//okthrowitin
if(green>255){
green = 255
}else if(green<0){
green = 0
}else{}//okthrowitin
if(blue>255){
blue = 255
}else if(blue<0){
blue = 0
}else{}//okthrowitin
int[] aninit = {red,green,blue}
bumras.setPixel(tdsf,caccr,aninit)
}//enfr
caccr++
}//enwhl
}//enmeth
BufferedImage bmiMKrotate(int snw,int snht){
int bumout = bumi.getType()
bumi = null
doGarbageClear()
return bumi = roTor.mkBasePlateIMG(snw,snht,bumout) //thisrequirestobebacktofrontheightthenwidthtomaketheimageflip(swapsidelengths)90degrees
}//enmeth
Rotators rotateSysClss(){
return roTor = new Rotators(this,bumi.getType())
}//enmeth
short[][] redCWRemake(int aW,int aH){
//redCCWRemake(bWI,bHI)
red_Overstep = roTor.rotateCw(aW,aH,red_Overstep)
return red_Overstep
}//enmeth
short[][] greenCWRemake(int aW,int aH){
green_Overstep = roTor.rotateCw(aW,aH,green_Overstep)
return green_Overstep
}//enmeth
short[][] blueCWRemake(int aW,int aH){
blue_Overstep = roTor.rotateCw(aW,aH,blue_Overstep)
return blue_Overstep
}//enmeth
short[][] redCCWRemake(int aW,int aH){
//redCCWRemake(bWI,bHI)
red_Overstep = roTor.rotateCCw(aW,aH,red_Overstep)
return red_Overstep
}//enmeth
short[][] greenCCWRemake(int aW,int aH){
green_Overstep = roTor.rotateCCw(aW,aH,green_Overstep)
return green_Overstep
}//enmeth
short[][] blueCCWRemake(int aW,int aH){
blue_Overstep = roTor.rotateCCw(aW,aH,blue_Overstep)
return blue_Overstep
}//enmeth
short[][] redCropRemake(int accrx,int ydwn,int nW,int nH){
red_Overstep = rgbDimArr.reMakeCropArr(accrx,ydwn,nW,nH,red_Overstep)
return red_Overstep
}//enmeth
short[][] greenCropRemake(int accrx,int ydwn,int nW,int nH){
green_Overstep = rgbDimArr.reMakeCropArr(accrx,ydwn,nW,nH,green_Overstep)
return green_Overstep
}//enmeth
short[][] blueCropRemake(int accrx,int ydwn,int nW,int nH){
blue_Overstep = rgbDimArr.reMakeCropArr(accrx,ydwn,nW,nH,blue_Overstep)
return blue_Overstep
}//enmeth
Color mkDrwColor(int clnm){
return (Color)cols[clnm]
}//

//Colordrw=mkDrwColor(colnum)//crx.getSelectedIndex()

void drawCrop(int colnum){


Color drw = mkDrwColor(colnum) //crx.getSelectedIndex()
Graphics2D bmg = bumi.createGraphics()
bmg.setColor(drw)
//
bmg.drawRect(new Double(rb.getX()).intValue(),new Double(rb.getY()).intValue(),((new Double(rb.getHeight()).intValue()) 1),((new Double(rb.getWidth()).intValue()) 1))
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.repaint()
}//enmeth
Rectangle mkRect(Rectangle rr){
rb=rr
return rb
}//enmeth

//tpn.mkRect(Rectanglerr)

boolean cropstater(boolean cpstat){ //booleancropsysstate


cropsysstate=cpstat
return cropsysstate
}//enmeth
boolean mkCrpCheckChar(String[] inchkC){
boolean ouchk=false
String[] intarray = {"0","1","2","3","4","5","6","7","8","9"}
int ctal = inchkC.length
int whlStp=0
int ac=0
for(int cvoiu=0(cvoiu<ctal)cvoiu++){
whlStp=0
while(whlStp<10){
if((((Object)intarray[whlStp]).equals(((Object)inchkC[cvoiu])))==true){
ac+=1
whlStp=10
}//enif
whlStp+=1
}//enwhlnumbers
}//enfr
if(ac==ctal){
ouchk=true
}//enif
return ((boolean)ouchk)
}//enmeth
boolean chKChr(String newide){
boolean crpBoolchkFlag=false
String[] checkset
checkset = new String[1]
checkset[0]=newide
int whsLp=0
int ckcntCrp=0
char[] chkIntVl = null
boolean asses=false//init
int chln=0
//
while(whsLp<1){
chkIntVl = checkset[whsLp].toCharArray()
chln = chkIntVl.length
String[] clch = new String[chln]
for(int oiop=0oiop<chlnoiop++){
clch[oiop] = new Character(chkIntVl[oiop]).toString()
}//enfr
asses=mkCrpCheckChar(clch)
if(asses==true){
ckcntCrp+=1
}//enif
whsLp++
}//enwhl
//JOptionPane.showMessageDialog(newJFrame(),"ckcntCrp:"+ckcntCrp)
if(ckcntCrp==1){
crpBoolchkFlag=true
}//enif
return ((boolean)crpBoolchkFlag)
}
boolean checkFieldCropval(){
boolean crpBoolchkFlag=false
String newide = widefield.getText()
String newheight = heightfield.getText()
String topLpnt = xfield.getText()
String topRpnt = yfield.getText()
if((newide!=null)&&(newheight!=null)&&(topLpnt!=null)&&(topRpnt!=null)){
//JOptionPane.showMessageDialog(newJFrame(),"newide:"+newide+"newheight:"+newheight+"topLpnt:"+topLpnt+"topRpnt:"+topRpnt)
String[] checkset
checkset = new String[4]
checkset[0]=newide
checkset[1]=newheight
checkset[2]=topLpnt
checkset[3]=topRpnt
int whsLp=0
int ckcntCrp=0
char[] chkIntVl = null
boolean asses=false//init
int chln=0
//
while(whsLp<4){
chkIntVl = checkset[whsLp].toCharArray()

Page 6 / 32

checkset[0]=newide
checkset[1]=newheight
checkset[2]=topLpnt
checkset[3]=topRpnt
int whsLp=0
int ckcntCrp=0
char[] chkIntVl = null
boolean asses=false//init
int chln=0
//
while(whsLp<4){
chkIntVl = checkset[whsLp].toCharArray()
chln = chkIntVl.length
String[] clch = new String[chln]
for(int oiop=0oiop<chlnoiop++){
clch[oiop] = new Character(chkIntVl[oiop]).toString()
}//enfr
asses=mkCrpCheckChar(clch)
if(asses==true){
ckcntCrp+=1
}//enif
whsLp++
}//enwhl
if(ckcntCrp==4){
crpBoolchkFlag=true
}//enif
}//enifnullcheckspretests
return ((boolean)crpBoolchkFlag)
}//enmeth
void mkImCrpPaintSelect(){
int ibumW = 0
int ibumH = 0
int nwid = 0
int nwhit = 0
//finallydebuggingtotrue
if(((boolean)checkFieldCropval())==true){
String newide = widefield.getText()
String newheight = heightfield.getText()
String topLpnt = xfield.getText()
String topRpnt = yfield.getText()
ibumW = bumi.getWidth()
ibumH = bumi.getHeight()
nwid = new Integer(newide).intValue()
nwhit = new Integer(newheight).intValue()
int widchk = ibumW(new Integer(topLpnt).intValue())
int hichk = ibumH(new Integer(topRpnt).intValue())
//USERASSISTANCEPOPUP
JOptionPane.showMessageDialog(new JFrame(),"topleftxfieldaccross:"+topLpnt+"topleftyfielddown"+topRpnt+"Maximumwidthcheck:"+widchk+"Maximumheightcheck:"+hichk)
if((((boolean)(nwid<(widchk+1))))&&(((boolean)(nwhit<(hichk+1))))){ //besureitsinbounds
mkRect(new Rectangle(new Integer(topLpnt).intValue(),new Integer(topRpnt).intValue(),nwhit,nwid))
doGarbageClear()
drawCrop(crx.getSelectedIndex())
}else{
//doerrordialoghereforselectionsize
JOptionPane.showMessageDialog(new JFrame(),"Selectionsizenotwithincorrectboundaries")
}//enifelswideheighttest
}else{
JOptionPane.showMessageDialog(new JFrame(),"inputtypoerrorinatextentryfieldinputfieldvaluesmustbenumbers")
}//enifelse
}//enmeth
void mkCropGUI(){ //addtoborderlayoutnorthinlowersplit
contain = new JPanel()
contain.setPreferredSize(new Dimension(750,310))
//contain.setBackground(newColor(0,255,0))
contain.setSize(new Dimension(750,310))
//contain.setBackground(newColor(255,0,0))
contain.setLayout(new java.awt.FlowLayout(1,1,1))
conslcntbtt = new JPanel() //topleft
conslcntbtt.setPreferredSize(new Dimension(750,135)) //was390
//conslcntbtt.setBackground(newColor(255,0,0))
conslcntbtt.setSize(new Dimension(750,135))
colbutt[8].setToolTipText("OpenaJPEG,PNG,BMPPhotofile")
conslcntbtt.add(colbutt[8]) //open
thumboo = new JCheckBox("ti",false) //thumboo.isSelected()setToolTipText()JCheckBoxthumboo
thumboo.setActionCommand("THBOO")
thumboo.addActionListener(this)
thumboo.setToolTipText("JPEGAddAThumbImageonSaveAs")
thumbleep = new JCheckBox("rem",false) //thumboo.isSelected()setToolTipText()JCheckBoxthumboo
thumbleep.setActionCommand("THBLEEP")
thumbleep.addActionListener(this)
thumbleep.setToolTipText("JPEGRemoveALLThumbImageSonSaveAs")
//rdyszlngzmkrszwzdhzd
rdysz=new JButton(new ImageIcon(appiconsIMG[12])) //"Longside=")
rdysz.setToolTipText("GetLongside(Aspectratio)ofphotoLengthorHeight")
rdysz.setPreferredSize(new Dimension(54,54))
rdysz.setSize(new Dimension(54,54))
rdysz.setActionCommand("READYBMI")
//"CLEARCROP"stopTm()
rdysz.addActionListener(this)
lngz=new JTextField("longside",7)
lngz.setSize(new Dimension(100,22))
lngz.setForeground(new Color(255,100,0))
lngz.setDisabledTextColor(new Color(255,255,0))
mkrsz=new JButton(new ImageIcon(appiconsIMG[6])) //doresize
mkrsz.setToolTipText("CommittheResizing(Aspectratio)")
mkrsz.setPreferredSize(new Dimension(54,54))
mkrsz.setSize(new Dimension(54,54))
mkrsz.setActionCommand("BMI")
//"CLEARCROP"stopTm()
mkrsz.addActionListener(this)
//JTextField
wzd=new JTextField("width",7)
wzd.setSize(new Dimension(100,22))
wzd.setDisabledTextColor(new Color(0,0,0))
hzd=new JTextField("height",7)
hzd.setSize(new Dimension(100,22))
hzd.setDisabledTextColor(new Color(0,0,0))
wzd.setEnabled(false) //thesetwodonotneedtobeenabled
hzd.setEnabled(false) //thesetwodonotneedtobeenabled
//
colbutt[9].setToolTipText("SavetodiscaJPEG,PNG,BMPPhoto")
//
conslcntbtt.add(thumboo) //addathumbnailimage
conslcntbtt.add(thumbleep)
conslcntbtt.add(colbutt[9]) //save
conslcntbtt.add(rdysz)
conslcntbtt.add(lngz)
conslcntbtt.add(mkrsz)
conslcntbtt.add(wzd)
conslcntbtt.add(hzd)
containL = new JPanel() //topleft
//
containL.setPreferredSize(new Dimension(400,130)) //was390
containL.setSize(new Dimension(400,130))
containL.setLayout(new java.awt.FlowLayout(1,4,4))
//containL.setBackground(newColor(255,0,0))
containR = new JPanel() //cropdimension
//containR.setBackground(newColor(255,0,255))
containR.setPreferredSize(new Dimension(320,80)) //was390
containR.setSize(new Dimension(320,80))
containR.setLayout(new java.awt.FlowLayout(1,4,4))
contButtRow = new JPanel() //"set""clear""commit"
contButtRow.setPreferredSize(new Dimension(750,135))
//contButtRow.setBackground(newColor(0,0,255))
contButtRow.setSize(new Dimension(750,135))
//contain.setBackground(newColor(255,0,0))
contButtRow.setLayout(new java.awt.FlowLayout(1,2,2))
//=======
crptxt = new JButton(new ImageIcon(appiconsIMG[22]))//"Text")
crptxt.setPreferredSize(new Dimension(54,54))
crptxt.setSize(new Dimension(54,54))
crptxt.setFont(uifont)
crptxt.setToolTipText("AddtextontothePhoto")
crptxt.setActionCommand("TEXTING")
crptxt.addActionListener(this)
huebord=new JButton(new ImageIcon(appiconsIMG[11]))//"Hue")
huebord.setPreferredSize(new Dimension(54,54))
huebord.setSize(new Dimension(54,54))
huebord.setFont(uifont)
huebord.setToolTipText("PhotoExposureCorrectioncontrols")
huebord.setActionCommand("HUE")
//"CLEARCROP"stopTm()
huebord.addActionListener(this)
crpXYlab = new JPanel() //xylabels
crpXYlab.setPreferredSize(new Dimension(260,65))
crpXYlab.setSize(new Dimension(260,65))
crpXYlab.setLayout(new java.awt.FlowLayout(1,20,2))
crpXYfields = new JPanel() //xyfields
crpXYfields.setPreferredSize(new Dimension(260,65))
crpXYfields.setSize(new Dimension(260,65))
crpXYfields.setLayout(new java.awt.FlowLayout(1,20,2))
xfieldLab = new JLabel("Xtopleftcorner")
xfieldLab.setHorizontalAlignment(0)
xfieldLab.setSize(new Dimension(120,22))
yfieldLab = new JLabel("Ytopleftcorner")
yfieldLab.setHorizontalAlignment(0)
yfieldLab.setSize(new Dimension(120,22))
xfield = new JTextField("XTopLaccross",7)
xfield.setSize(new Dimension(100,22))
yfield = new JTextField("YTopLdown",7)
yfield.setSize(new Dimension(100,22))
//
crpXYlab.add(xfieldLab)
crpXYlab.add(yfieldLab)
crpXYfields.add(xfield)
crpXYfields.add(yfield)
containL.add(crpXYlab)
containL.add(crptxt)
containL.add(crpXYfields)
containL.add(huebord)
//==============
crpWHlab = new JPanel() //xylabels
crpWHlab.setPreferredSize(new Dimension(260,26))
crpWHlab.setSize(new Dimension(260,26))
crpWHlab.setLayout(new java.awt.FlowLayout(1,20,2))
crpWHfields = new JPanel() //xyfields
crpWHfields.setPreferredSize(new Dimension(260,32))
crpWHfields.setSize(new Dimension(260,32))
crpWHfields.setLayout(new java.awt.FlowLayout(1,20,2))
wideLab = new JLabel("cropwidth")
wideLab.setHorizontalAlignment(0)
wideLab.setSize(new Dimension(120,22))
heightLab = new JLabel("cropheight")
heightLab.setHorizontalAlignment(0)
heightLab.setSize(new Dimension(120,22))
widefield = new JTextField("width",6)
widefield.setSize(new Dimension(90,22))
heightfield = new JTextField("height",6)
heightfield.setSize(new Dimension(90,22))
//
crpWHlab.add(wideLab)
crpWHlab.add(heightLab)
crpWHfields.add(widefield)
crpWHfields.add(heightfield)
containR.add(crpWHlab)
containR.add(crpWHfields)
//==========
quickclru=new JButton(new ImageIcon(appiconsIMG[16])) //"ChooseQuickColour+")
quickclru.setPreferredSize(new Dimension(54,54))
quickclru.setSize(new Dimension(54,54))
quickclru.setToolTipText("UserViewColourBalancinghueUP")
quickclru.setActionCommand("QUICLRUP")
//"CLEARCROP"stopTm()
quickclru.addActionListener(this)
//
quickclrd=new JButton(new ImageIcon(appiconsIMG[15])) //"ChooseQuickColour")
quickclrd.setPreferredSize(new Dimension(54,54))
quickclrd.setSize(new Dimension(54,54))
quickclrd.setToolTipText("UserViewColourBalancinghueDOWN")
quickclrd.setActionCommand("QUICLRDOWN")
//"CLEARCROP"stopTm()
quickclrd.addActionListener(this)
//"set""clear""commit"
crpSet = new JButton(new ImageIcon(appiconsIMG[5])) //"SetCrop")//crpSetcrpClrcrpCropcrpRccwcrpcw
crpSet.setPreferredSize(new Dimension(54,54))
crpSet.setSize(new Dimension(54,54))
crpSet.setFont(uifont)
crpSet.setActionCommand("SETCROP")
crpSet.setToolTipText("SettheCropAreaReady")
crpSet.addActionListener(this)
crpClr = new JButton(new ImageIcon(appiconsIMG[3])) //"ClearCrop")
crpClr.setPreferredSize(new Dimension(54,54))
crpClr.setSize(new Dimension(54,54))
crpClr.setFont(uifont)
crpClr.setActionCommand("CLEARCROP")
//"CLEARCROP"stopTm()
crpClr.setToolTipText("CeartheCropparameters")
crpClr.addActionListener(this)
crpCrop = new JButton(new ImageIcon(appiconsIMG[4])) //"CropArea")
crpCrop.setPreferredSize(new Dimension(54,54))
crpCrop.setSize(new Dimension(54,54))
crpCrop.setFont(uifont)
crpCrop.setActionCommand("DOCROP")
crpCrop.setToolTipText("Cropthephotoarea")
crpCrop.addActionListener(this)
crpRccw = new JButton(new ImageIcon(appiconsIMG[19])) //"Rotate90<ccw")//crpRccwcrpcw//"CCw""cW"
crpRccw.setPreferredSize(new Dimension(54,54))
crpRccw.setSize(new Dimension(54,54))
crpRccw.setFont(uifont)
crpRccw.setActionCommand("CCw")
crpRccw.setToolTipText("CounterClockwiserotate90")
crpRccw.addActionListener(this)
crpcw = new JButton(new ImageIcon(appiconsIMG[20])) //"Rotate90cw>")
crpcw.setPreferredSize(new Dimension(54,54))
crpcw.setSize(new Dimension(54,54))
crpcw.setFont(uifont)
crpcw.setActionCommand("cW")
crpcw.setToolTipText("Clockwiserotate90")
crpcw.addActionListener(this)
crpRFror = new JButton(new ImageIcon(appiconsIMG[0])) //"Flip180")//Mirror=1
crpRFror.setPreferredSize(new Dimension(54,54))
crpRFror.setSize(new Dimension(54,54))
crpRFror.setFont(uifont)
crpRFror.setActionCommand("Flip180")
crpRFror.setToolTipText("Flipoverupsidedown180")
crpRFror.addActionListener(this)
crpRmror = new JButton(new ImageIcon(appiconsIMG[13])) //"Mirror")//Mirror=1
crpRmror.setPreferredSize(new Dimension(54,54))
crpRmror.setSize(new Dimension(54,54))
crpRmror.setFont(uifont)
crpRmror.setToolTipText("Mirror(Reversed)imageviewFlip")
crpRmror.setActionCommand("MirrOR")
crpRmror.addActionListener(this)
//
omod = new javax.swing.DefaultComboBoxModel()
//omod=newjavax.swing.DefaultComboBoxModel()crx=newJComboBox(omod)
omod.addElement((Object)"Red")
omod.addElement((Object)"Green")

Page 7 / 32

crpRFror.addActionListener(this)
crpRmror = new JButton(new ImageIcon(appiconsIMG[13])) //"Mirror")//Mirror=1
crpRmror.setPreferredSize(new Dimension(54,54))
crpRmror.setSize(new Dimension(54,54))
crpRmror.setFont(uifont)
crpRmror.setToolTipText("Mirror(Reversed)imageviewFlip")
crpRmror.setActionCommand("MirrOR")
crpRmror.addActionListener(this)
//
omod = new javax.swing.DefaultComboBoxModel()
//omod=newjavax.swing.DefaultComboBoxModel()crx=newJComboBox(omod)
omod.addElement((Object)"Red")
omod.addElement((Object)"Green")
omod.addElement((Object)"Blue")
omod.addElement((Object)"Black")
omod.addElement((Object)"White")
crx = new JComboBox(omod)
crx.setToolTipText("CropSelectionBoundaryColour")
//
contButtRow.add(bwbttn)
//
contButtRow.add(quickclru)
contButtRow.add(quickclrd)
//
contButtRow.add(crpSet)
contButtRow.add(crpClr)
contButtRow.add(crpCrop)
contButtRow.add(crx)
contButtRow.add(crpRccw)
contButtRow.add(crpcw)
contButtRow.add(crpRFror)
contButtRow.add(crpRmror)
contain.add(conslcntbtt)
contain.add(containL)
contain.add(containR)
contain.add(contButtRow)
doGarbageClear()
}//enmeth
void openThumbView(){ //onopen
try{
thmImgView = new JLabel[numThumb]
//
BufferedImage thImmkr
int innpanwidth=0 //panelSIZEforthethumbsintheviewportANDtheframespanel
int innpanheight=0 //panelSIZEforthethumbsintheviewportANDtheframespanel
int widJl=0
int hitJl=0
thumbinf="ThumbImagesizes:"+linesep
for(int tho=0(tho<numThumb)tho++){
//
thImmkr = ((BufferedImage)imgThmbNl.get(tho))
thmImgView[tho] = new JLabel()
widJl=thImmkr.getWidth()
hitJl=thImmkr.getHeight()
thumbinf+="thumb"+(tho+1)+"."+"width:"+widJl+"height:"+hitJl+linesep
innpanwidth+=widJl
innpanheight+=hitJl
thmImgView[tho].setSize(new Dimension(widJl,hitJl))
thmImgView[tho].setIcon(new ImageIcon(thImmkr))
//
}//enfr
//===========nowmakethegui
innpanwidth+=(5+(5*numThumb))
innpanheight+=(5+(5*numThumb))
compvw = new JPanel()
compvw.setLayout(new FlowLayout(0,5,5))
compvw.setSize(new Dimension(innpanwidth,innpanheight))
for(int atho=0(atho<numThumb)atho++){
compvw.add(thmImgView[atho])
}//enfr
cview = new JViewport()
cview.setView(compvw)
vwscroll = new JScrollPane(cview,20,30) //asneededh=30v=20
frmevwpnl = new JPanel() //outerpanelforframetoholdscrollpane
frmevwpnl.setLayout(new BorderLayout())
frmevwpnl.setSize(new Dimension(400,400)) //+50issafetyagainstresolutionwidthsindifferentmonitors
frmevwpnl.add(vwscroll)
thumbVIEW = new JFrame("ThumbImages")
thumbVIEW.setDefaultCloseOperation(2)
//thumbVIEW.setMinimumSize(newDimension(200,100))
//thumbVIEW.setPreferredSize(newDimension(400,400))
thumbVIEW.setSize(new Dimension(400,400))
thumbVIEW.getContentPane().add(frmevwpnl)
thumbVIEW.setIconImage(((Toolkit)thumbVIEW.getToolkit()).getImage(app_PATH+flsep+"Sidewinder32.gif"))
thumbVIEW.setIgnoreRepaint(false)
for(int btho=0(btho<numThumb)btho++){
thmImgView[btho].repaint()
}//enfr
}catch(java.lang.Exception exvth){
stackExPasthru((Throwable)exvth)
}finally{}
//
}//enmeth
protected java.io.File inputIMGfile(java.io.File iputimage){
inputimage=iputimage
parentDirOpen(inputimage.getParent())
return inputimage
}//enmeth
void checkopen(){
//
curropendir=parentDirOpen(inputimage.getParent())
//
//
if(inputimage.exists()==true){
//==needstobemethodtoreturnglobalsoitcanbeseteachtimeofonepieceofcode
String achknme = inputimage.getName()
achknme = achknme.toLowerCase()
String anamchek = achknme.substring((achknme.lastIndexOf(".")+1))
//==IFITSOKTOOPENTHEFILE
if(anamchek.equals("jpg") || anamchek.equals("jpeg") || anamchek.equals("png") || anamchek.equals("bmp") || anamchek.equals("wbmp")){
//
if(firstopenedis==false){
firstOpnImg()
doGarbageClear()
}else{
//DOGARBAGECOLLECTHERE
redDump()
greenDump()
blueDump()
clearImgbumi()
clearReaderImg()
if(thumbVIEW!=null){
//IFISVISIBLE
thumbVIEW.setVisible(false)
thumbVIEW.dispose()
thumbVIEW=null
}//enif
doGarbageClear()
}//enif
//
try{
callCreateImgOpen()
}catch(java.io.IOException eiocxc){
stackExPasthru((Throwable)eiocxc)
}catch(java.lang.Exception excaf1){
stackExPasthru((Throwable)excaf1)
}finally{}
//
}else{
JOptionPane.showMessageDialog(new JFrame(),"Onlyfileextensiontypesof.jpg,.jpeg,.png,.bmpcanbeopened!")
}
}else{
JOptionPane.showMessageDialog(new JFrame(),"cannotopenfiledoesnotexist!")
}//enels
return
}//enmeth

String parentDirOpen(String parfl){


curropendir=parfl
return curropendir
}
File chooseOpenFile(){
disnableButtons(false)
dialFram = new Frame()
Toolkit toot=(Toolkit)dialFram.getToolkit()
Image dialimg = toot.getImage(app_PATH+flsep+"Sidewinder16.gif")
dialFram.setIconImage(dialimg)
//((Component)dialFram).setSize(newDimension(700,400))
((Component)dialFram).setSize(700,500)
String impth=app_PATH+flsep+"dat"+flsep
//flchs=newJFileChooser()
flchs = new FileChoiceComp(impth,app_PATH,curropendir)
flchs.setIgnoreRepaint(false)
int rtvalaccept = flchs.showOpenDialog(((Component)dialFram))
flchs.setAcceptAllFileFilterUsed(false)
flchs.setDialogTitle("ChooseanImage")
//winonly
flchs.setFileSelectionMode(0)
flchs.setFileHidingEnabled(false)
//flchs.setCurrentDirectory(newFile(curropendir))
//
if(rtvalaccept == flchs.APPROVE_OPTION){
inputimage = flchs.getSelectedFile().getAbsoluteFile()
inputIMGfile(inputimage)
checkopen()
}else{
rtvalaccept=1
}//enifels
//
disnableButtons(true)
return inputimage
}//enmeth

//NOTE:getImagerequiresusingclasspath

void imgViewPortSz(Dimension dmvw){


panviewset[0].setViewSize(dmvw)
}//enmeth
boolean firstOpnImg(){
firstopenedis=true
return firstopenedis
}//enmeth
String mkSavDir(String iputimg){ //inputimage.getAbsoluteFile().toString()
currsavdir=iputimg
//JOptionPane.showMessageDialog(newJFrame(),currsavdir)
return currsavdir
}//enmeth
void doSavesys(){
int qtywrt=1
dialFram = new Frame()
try{
Toolkit toot=(Toolkit)dialFram.getToolkit()
Image dialimg = toot.getImage(app_PATH+flsep+"Sidewinder16.gif")
dialFram.setIconImage(dialimg)
//((Component)dialFram).setSize(newDimension(700,150))
((Component)dialFram).setSize(700,200)
flchs = new JFileChooser()
flchs.setDialogTitle("ChooseaLocation")
//winonly
flchs.setMultiSelectionEnabled(false)
flchs.setFileSelectionMode(0)
flchs.setFileHidingEnabled(false)
flchs.setCurrentDirectory(new File(currsavdir))
int rtvalaccept = flchs.showSaveDialog(((Component)dialFram))
if(rtvalaccept == flchs.APPROVE_OPTION){

//NOTE:getImagerequiresusingclasspath

inputimage = (flchs.getSelectedFile()).getAbsoluteFile()
mkSavDir((inputimage.getParentFile()).getPath())
String chknme = inputimage.getName()
String namchek = chknme.substring((chknme.lastIndexOf(".")+1))
namchek = namchek.toLowerCase()
//!!!@@@won'tsavethese:namchek.equals("jfif")||namchek.equals("JFIF")||//||namchek.equals("tiff")||namchek.equals("tif")
if(namchek.equals("jpg") || namchek.equals("jpeg") || namchek.equals("png") || namchek.equals("bmp")){
if(inputimage.exists()==false){
if(wimg!=null){
wimg=null
doGarbageClear()
}//enif
//
if((namchek.equals("png"))==true){
//WritImgOutPNG
wimg = new WritImgOutPNG()
}else if((namchek.equals("bmp"))==true){
wimg = new WritImgOutBMP()
}else{
wimg = new WritImgOutJPEG() //,imgDefMeta,strmDefMeta//wimg=newWritImgOut(defReadWritr)
}
//wimg.writeCall()
//wimg.start()
dialimg = null
dialFram = null
wimg = null
doGarbageClear()
args=new String[1]
String currtmp = curropendir
args[0]=inputimage.getPath()
new OpOpencommline() //
parentDirOpen(currtmp)
}else{
JOptionPane.showMessageDialog(new JFrame(),"Thissystemdoesnotprovidesavingoverafile!Makeanewonebyname.")
}
}else{
JOptionPane.showMessageDialog(new JFrame(),"SAVEASONLY!:.jpg,.JPG,.jpeg,.JPEG,.png,.PNG,.bmp,.BMP")
}
}else{
rtvalaccept=1
}//enifels
//javax.imageio.IIOException
}catch(java.lang.Exception excaf4){
stackExPasthru((Throwable)excaf4)
}finally{}

Page 8 / 32

JOptionPane.showMessageDialog(new JFrame(),"Thissystemdoesnotprovidesavingoverafile!Makeanewonebyname.")
}
}else{
JOptionPane.showMessageDialog(new JFrame(),"SAVEASONLY!:.jpg,.JPG,.jpeg,.JPEG,.png,.PNG,.bmp,.BMP")
}
}else{
rtvalaccept=1
}//enifels
//javax.imageio.IIOException
}catch(java.lang.Exception excaf4){
stackExPasthru((Throwable)excaf4)
}finally{}
disnableButtons(true) //disnableButtons(false)
}//enmeth
void chooseSaveAsFileLocation(){
disnableButtons(false)
//
if((thumboo.isSelected()) && (imgIIOmtda != null)){
//nowopenadjusterframeforthumbs
makeThumbAddPanel()
//doSavesys()"SETTHUMBSZ"isinthethumbimagelistenertrack
}else{
if((thumboo.isSelected()) && (imgIIOmtda == null)){
//joption"savenotation:nothumbimagewill/canbeadded"
JOptionPane.showMessageDialog(new JFrame(),"savenotation:noEXIFdata=nothumbimagewill/canbeadded")
}//enif
doSavesys()
}//enifels
if((thumbleep.isSelected())==true){
thumbleep.setSelected(false)
}//enifSWITCHOFFTHUMBREMOVERCHECKBOX
}
//enmeth

int rSzIdx(int rsa){


rsZidx=rsa
return rsZidx
}//settheviewsizeindex
int oldrSzIdx(int orsa){
oldrsZidx=orsa
return oldrsZidx
}//settheviewsizeindex
public void itemStateChanged(ItemEvent e){
int rSireassi=oldrsZidx //tempstore
oldrSzIdx(rsZidx) //isalwayskeptbeforeabyassignmenttorSzIdx()
if(((int)e.getStateChange())==1){//1=anitemis"selected"
rsZidx = rSzIdx(jox.getSelectedIndex())
makeImgRsz(rsZidx)
}else{
//doesnotassign
oldrSzIdx(rSireassi) //rsZidxisset0intheconstructor
rSzIdx(oldrsZidx)
}//enif
//SAFETYDEVICEdisnableButtons(true)
doGarbageClear()
disnableButtons(true)
}//enitemlistn
void makeImgRsz(int rszto){
double sztoit=0
if(rszto==0){
//imgViewPortSz(newDimension(imcanv.bumi.getWidth(),imcanv.bumi.getHeight()))
tpn.setSize(new Dimension(bumi.getWidth(),bumi.getHeight()))
tpn.setIcon(new ImageIcon(bumi))
tpn.repaint()
jox.setSelectedIndex(0)
}else if(rszto==1){//3/4
sztoit=new Double(((double)3D))/new Double(((double)4D))
}else if(rszto==2){//2/3
sztoit=new Double(((double)2D))/new Double(((double)3D))
}else if(rszto==3){//1/2
sztoit=(double)2D
}else if(rszto==4){//5/12
sztoit=new Double(((double)5D))/new Double(((double)12D))
}else if(rszto==5){//1/3
sztoit=(double)3D
}else if(rszto==6){//1/4
sztoit=(double)4D
}else if(rszto==7){//1/5
sztoit=(double)5D
}else if(rszto==8){//3/16
sztoit=new Double(((double)3D))/new Double(((double)16D))
}else if(rszto==9){//1/6
sztoit=(double)6D
}else if(rszto==10){//1/8
sztoit=(double)8D
}else if(rszto==11){//1/10
sztoit=(double)10D
}else if(rszto==12){//1/12
sztoit=(double)12D
}else if(rszto==13){//1/16
sztoit=(double)16D
}else{}
//
if(rszto!=0){
int wsz = 0
int hsz = 0
if((rszto==1)||(rszto==2)||(rszto==4)||(rszto==8)){
wsz = (int)new Double((new Double(bumi.getWidth()).doubleValue()*sztoit)).intValue()
hsz = (int)new Double((new Double(bumi.getHeight()).doubleValue()*sztoit)).intValue()
}else{
wsz = (int)new Double((new Double(bumi.getWidth()).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
hsz = (int)new Double((new Double(bumi.getHeight()).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
}
rSZimgview(wsz,hsz)
}//enif
//
}//enmeth
void doGarbageClear(){
Runtime.getRuntime().gc()
Runtime.getRuntime().runFinalization()
}//enmeth
//=================================doICONforDIALOGS
public void callCreateImgOpen()throws java.io.IOException{
try{
imcanv = new ImageSysTest(inputimage)
//GETSTHEIMAGE
}catch(java.lang.Exception excafAS){
stackExPasthru((Throwable)excafAS)
}finally{}
//importJl(imcanv.bumi)//makestpn
wras = bumi.getRaster()
int imH = wras.getHeight()
int httimg=imH
lenw = wras.getWidth()
int lenbrdthimg=lenw
//rgbDimArr=newMultiDimArr()
rtRedArr(imH,lenw,wras)
rtGreenArr(imH,lenw,wras)
rtBlueArr(imH,lenw,wras)
jox.setSelectedIndex(0)
oldrSzIdx(0)
rSzIdx(0)
tpn.setIcon(new ImageIcon(bumi))
tpn.repaint()
//
metaPne.setText("===filename:"+(inputimage.getAbsoluteFile().getName())+"==="+linesep)
metaPne.append("===abspath:"+(inputimage.getAbsolutePath())+"==="+linesep)
metaPne.append("===format:"+readIMG.getFormatName()+""+linesep)
metaPne.append("imagewidth:"+lenw+""+linesep)
metaPne.append("imageheight:"+imH+""+linesep)
metaPne.append("NumberofThumbImages:"+numThumb+""+linesep)
metaPne.append("========================================="+linesep)
//
if(passPane.length()>0){
metaPne.append(passPane+linesep)
}
//greatplacetorememberithere
flimstrm.close()
//imgViewPortSz(newDimension(imcanv.bumi.getWidth(),imcanv.bumi.getHeight()))
makeImgRsz(rsZidx)
//ENSURESPROCESSINGISFINNISHEDTOTHISHERE
if(numThumb>0){
openThumbView()
thumbVIEW.setVisible(true)
metaPne.append(thumbinf)
}//enif
imcanv=null
clearReaderImg()
//
disnableButtons(true)
}//enmeth
void rSZimgview(int wdrsz,int htrsz){
//"szo"istheDENOMINATOR
if((wdrsz>24) && (htrsz>24)){ //protectsagaints0ornegativevalueinput
bumiSZpaint = ((java.awt.Image)bumi).getScaledInstance(wdrsz,htrsz,4)
//imgViewPortSz(newDimension(wdrsz,htrsz))
tpn.setSize(new Dimension(wdrsz,htrsz))
tpn.setIcon(new ImageIcon(bumiSZpaint))
tpn.repaint()
}else{
makeImgRsz(oldrsZidx)
jox.setSelectedIndex(oldrsZidx)
JOptionPane.showMessageDialog(new JFrame(),"IMAGEVIEWRESIZINGNOTEFFECTIVE")
}
}//enmeth
short[][] redFlip(int action){
FlipInvert flipper = new FlipInvert(this,red_Overstep,action)
red_Overstep = flipper.getFlippedOrMirroredArray()
return red_Overstep
}//enmeth
short[][] greenFlip(int action){
FlipInvert flipper = new FlipInvert(this,green_Overstep,action)
green_Overstep = flipper.getFlippedOrMirroredArray()
return green_Overstep
}//enmeth
short[][] blueFlip(int action){
FlipInvert flipper = new FlipInvert(this,blue_Overstep,action)
blue_Overstep = flipper.getFlippedOrMirroredArray()
return blue_Overstep
}//enmeth
short[][] redDump(){
return red_Overstep=null
}
short[][] greenDump(){
return green_Overstep=null
}
short[][] blueDump(){
return blue_Overstep=null
}
short[][] rtRedArr(int aimH,int alenw,WritableRaster awras){
return (red_Overstep = rgbDimArr.colOverstepstore(0,aimH,alenw,awras))
}//enmeth
short[][] rtGreenArr(int aimH,int alenw,WritableRaster awras){
return (green_Overstep = rgbDimArr.colOverstepstore(1,aimH,alenw,awras))
}//enmeth
short[][] rtBlueArr(int aimH,int alenw,WritableRaster awras){
return (blue_Overstep = rgbDimArr.colOverstepstore(2,aimH,alenw,awras))
}//enmeth
//======================================================================================protectedvoidchangePixelsInRaster(booleanupdown,booleancoeffreq,intarrcolnumber,intaddecritive){//up=truedown=false
short redsetPix(int algcolmn,int wda,int pxval){
red_Overstep[algcolmn][wda]=(new Integer(pxval).shortValue())
return red_Overstep[algcolmn][wda]
}//enmeth
short greensetPix(int algcolmn,int wda,int pxval){
green_Overstep[algcolmn][wda]=(new Integer(pxval).shortValue())
return green_Overstep[algcolmn][wda]
}//enmeth
short bluesetPix(int algcolmn,int wda,int pxval){
blue_Overstep[algcolmn][wda]=(new Integer(pxval).shortValue())
return blue_Overstep[algcolmn][wda]
}//enmeth
void disnableButtons(boolean boo){
//
if(boo==true){
work.makeParamWork(bumi.getHeight()1)
}
//LOOPFAILURE?HEAP?STACKfor(intclsa=0clsa<10clsa++){
//if(buttonjump!=clsa){
colbutt[0].setEnabled(boo)
colbutt[0].repaint()
colbutt[1].setEnabled(boo)
colbutt[1].repaint()
colbutt[2].setEnabled(boo)
colbutt[2].repaint()
colbutt[3].setEnabled(boo)
colbutt[3].repaint()
colbutt[4].setEnabled(boo)
colbutt[4].repaint()
colbutt[5].setEnabled(boo)
colbutt[5].repaint()
colbutt[6].setEnabled(boo)
colbutt[6].repaint()
colbutt[7].setEnabled(boo)
colbutt[7].repaint()
colbutt[8].setEnabled(boo)
colbutt[8].repaint()
colbutt[9].setEnabled(boo)
colbutt[9].repaint()
crpSet.setEnabled(boo)
crpSet.repaint()

Page 9 / 32

colbutt[5].setEnabled(boo)
colbutt[5].repaint()
colbutt[6].setEnabled(boo)
colbutt[6].repaint()
colbutt[7].setEnabled(boo)
colbutt[7].repaint()
colbutt[8].setEnabled(boo)
colbutt[8].repaint()
colbutt[9].setEnabled(boo)
colbutt[9].repaint()
crpSet.setEnabled(boo)
crpSet.repaint()
crpClr.setEnabled(boo)
crpClr.repaint()
crpCrop.setEnabled(boo)
crpCrop.repaint()
crpRccw.setEnabled(boo)
crpRccw.repaint()
crpcw.setEnabled(boo)
crpcw.repaint()
mkrsz.setEnabled(boo)
mkrsz.repaint()
bwbttn.setEnabled(boo)
bwbttn.repaint()
crpRFror.setEnabled(boo)
crpRFror.repaint()
crpRmror.setEnabled(boo)
crpRmror.repaint()
//
}//enmeth
void disLowerButs(boolean buttw){
crpSet.setEnabled(buttw)
crpSet.repaint()
crpClr.setEnabled(buttw)
crpClr.repaint()
crpCrop.setEnabled(buttw)
crpCrop.repaint()
crpRccw.setEnabled(buttw)
crpRccw.repaint()
crpcw.setEnabled(buttw)
crpcw.repaint()
colbutt[8].setEnabled(buttw)
colbutt[8].repaint()
colbutt[9].setEnabled(buttw)
colbutt[9].repaint()
jox.setEnabled(buttw)
jox.repaint()
}//enmeth
int jumpPressedButton(int iputbutt){
buttonjump=iputbutt
return buttonjump
}//enmeth
void clearthumbL(){
imgThmbNl=null
}
void clearImgbumi(){ //clearImgbumi()clearReaderImg()
bumi=null
}//enmeth
void clearReaderImg(){
iioiMIG=null
}//enmeth
//=============NESTEDSUBCLASS===
//java.lang.InterruptedException
class ThreadRedux1 extends java.lang.Thread{
//booleanbutten=false
ThreadRedux1(){
//this.butten=butten
setPriority(10)
}//enconstr
public void run(){
disnableButtons(false)
try{
the2 = new ThreadRedux2()
the2.start()
}catch(java.lang.InterruptedException intr1){
}finally{}
//
}//enrun
}//enclss
//=========================
File saveWriteName(){
return inputimage
}
//=========================NESTEDCLASS
class ThreadRedux2 extends java.lang.Thread{
long slp = 500
ThreadRedux2()throws java.lang.InterruptedException{
this.setPriority(5)
this.sleep(slp)
the3 = new ThreadRedux3(false)
the3.start()
}//enconstr
public void run(){
//===
RGBlinearSingleBoot() //REFRESHENERBOOTSINGLECOLOURPROCESSORCLASS
//
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
//===
String qbrd = "BalancerListControl:"
String updnCo=""
String colour=""
if(((boolean)actComm.equals("REDUP"))){
coloffs.changePixelsInRaster(true,false,0,((int)new Integer(((String)inptnums[0].getSelectedItem().toString())).intValue()))
colour="RED:"
updnCo="UP:"+((int)new Integer(((String)inptnums[0].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("REDDOWN"))){
coloffs.changePixelsInRaster(false,false,0,((int)new Integer(((String)inptnums[0].getSelectedItem().toString())).intValue()))
colour="RED:"
updnCo="DOWN:"+((int)new Integer(((String)inptnums[0].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("GREENUP"))){
coloffs.changePixelsInRaster(true,false,1,((int)new Integer(((String)inptnums[1].getSelectedItem().toString())).intValue()))
colour="GREEN:"
updnCo="UP:"+((int)new Integer(((String)inptnums[1].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("GREENDOWN"))){
coloffs.changePixelsInRaster(false,false,1,((int)new Integer(((String)inptnums[1].getSelectedItem().toString())).intValue()))
colour="GREEN:"
updnCo="DOWN:"+((int)new Integer(((String)inptnums[1].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("BLUEUP"))){
coloffs.changePixelsInRaster(true,false,2,((int)new Integer(((String)inptnums[2].getSelectedItem().toString())).intValue()))
colour="BLUE:"
updnCo="UP:"+((int)new Integer(((String)inptnums[2].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("BLUEDOWN"))){
coloffs.changePixelsInRaster(false,false,2,((int)new Integer(((String)inptnums[2].getSelectedItem().toString())).intValue()))
colour="BLUE:"
updnCo="DOWN:"+((int)new Integer(((String)inptnums[2].getSelectedItem().toString())).intValue())
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("WHITEUP"))){
String pasto = ((String)inptnums[3].getSelectedItem().toString())
coloffl.changePixelsInRaster(true,true,0,((int)new Integer(pasto).intValue()))
colour="RED,GREEN,BLUE>(WHITE):"
updnCo="UP:"+pasto
//}
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("WHITEDOWN"))){
String pasto = ((String)inptnums[3].getSelectedItem().toString())
coloffl.changePixelsInRaster(false,true,0,((int)new Integer(pasto).intValue()))
colour+="RED,GREEN,BLUE>(WHITE):"
updnCo="DOWN:"+pasto
//
metaPne.append(qbrd+colour+updnCo+linesep)
doGarbageClear()
}else if(((boolean)actComm.equals("MirrOR"))){
//"CCw""cW"1145
//indeterminateBar()MOVEDUPATHREADwork.makeParamWork(100)work.reshower()
redFlip(1)
greenFlip(1)
blueFlip(1)
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
doGarbageClear()
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
//runthetranslatorpopulatormethodnext
rotationPopulator(bWI,bHI)
//nowsetSizesetIconrepaint
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.setSize(new Dimension(bWI,bHI))
makeImgRsz(oldrsZidx)
tpn.repaint()
metaPne.append("===FlippedMirroredImage:==="+linesep)
disnableButtons(true)
}else if(((boolean)actComm.equals("Flip180"))){
//"CCw""cW"1145
//indeterminateBar()MOVEDUPATHREAD
redFlip(0)
greenFlip(0)
blueFlip(0)
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
doGarbageClear()
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
//runthetranslatorpopulatormethodnext
rotationPopulator(bWI,bHI)
//nowsetSizesetIconrepaint
tpn.setIcon(new ImageIcon((java.awt.Image)bumi))
tpn.setSize(new Dimension(bWI,bHI))
makeImgRsz(oldrsZidx)
tpn.repaint()
metaPne.append("===Flipped180degreesRotatedImage:==="+linesep)
disnableButtons(true)
}else if(((boolean)actComm.equals("CCw"))){
//"CCw""cW"
//indeterminateBar()MOVEDUPATHREAD
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
rotateCCW()
doGarbageClear()
disnableButtons(true)
}else if(((boolean)actComm.equals("cW"))){
//indeterminateBar()MOVEDUPATHREAD
oldrSzIdx(jox.getSelectedIndex()) //isalwayskeptbeforeabyassignmenttorSzIdx()
rotateCW()
doGarbageClear()
disnableButtons(true)
}else{}

if(((boolean)actComm.equals("HUE"))){ //
//disnableButtons(false)
doGarbageClear()
mcHue() //hu=newHueBoard(this)//WARNINGTESTPARAMETERSFEDONLY!!!!
disnableButtons(true)
}else if(((boolean)actComm.equals("QUICLRUP"))){
readyQuickboard(true)
disnableButtons(true)
}else if(((boolean)actComm.equals("QUICLRDOWN"))){
readyQuickboard(false)
disnableButtons(true)
}else{
//REPAINTSFORABOVE
int bHI = bumi.getHeight()
int bWI = bumi.getWidth()
rotationPopulator(bWI,bHI)
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}else{
makeImgRsz(oldrsZidx)
}
tpn.repaint()
}
/*
if(oldrsZidx!=rsZidx){
makeImgRsz(rsZidx)
}//enif
tpn.repaint()
*/
guiOpOccurPresent(false)
try{
the3 = new ThreadRedux3(true)
the3.start()
}catch(java.lang.InterruptedException intrpB){
stackExPasthru(intrpB)
}finally{}
}//enrun
}//enclss
//=============================
class ThreadRedux3 extends java.lang.Thread{
boolean butten
long slp=300
ThreadRedux3(boolean butten)throws java.lang.InterruptedException{
this.butten=butten
setPriority(10)
this.sleep(slp)
}//enconstr
public void run(){
//work.makeParamWork(100)
//work.reshower()
disLowerButs(butten)
disnableButtons(butten)

Page 10 / 32

long slp=300
ThreadRedux3(boolean butten)throws java.lang.InterruptedException{
this.butten=butten
setPriority(10)
this.sleep(slp)
}//enconstr
public void run(){
//work.makeParamWork(100)
//work.reshower()
disLowerButs(butten)
disnableButtons(butten)
}//enrun
}//enclss

//=================NESTEDSUBCLASS
class WritImgOutJPEG extends java.lang.Thread{
//java.util.Iterator<javax.imageio.ImageWriter>iwrtRs
javax.imageio.IIOImage iowrtImg
javax.imageio.ImageWriter iwRT
javax.imageio.stream.ImageOutputStream outstrImg
javax.imageio.ImageWriteParam imgWtPrm
//javax.imageio.IIOImageiioinew
BufferedImage bummer
BufferedImage rastextract
java.util.ArrayList arrlImgTEST
Dimension thumbdimenson
ImageTypeSpecifier ityp
WritableRaster resetdata //thumbimagetransferraster
Object reassThmb //
Object extstyp
Raster raswrt //0indeximage
int qtywrt
int cando
int wid
int hit
int itThmbSz
String typemoder
String qlvals = null
String ctc = null
String flnmeimg = null
//StringpassPane=nullpassPane=""
boolean cntl
float[] compquals
long slp
/*
DONOTDECLARETYPESINSIDETHECONSTRUCTOR!!!!!!!!
*/
//OUTSIDECONSTRUCTORSTART
WritImgOutJPEG(){
super()
slp=200L
setDaemon(false)
setPriority(10)
qtywrt=0
cando=0
//
try{
if(iwRT!=null){
iwRT=null
}//enif
//
if(foutstrm != null){
foutstrm=null
}//enif
//
flnmeimg = (((File)saveWriteName()).getAbsoluteFile()).getName()
typemoder = flnmeimg.substring(((int)flnmeimg.lastIndexOf(".")+1))
extstyp=(Object)typemoder.toLowerCase()
//
//==========================reinstallthethumbswithcolourbalancedversionsafterimagecolourbalancing
//WARNINGimgThmbNlthisListorArraycannotbeNULL!!!itThmbSz=imgThmbNl.size()WARNINGimgThmbNlthisListorArraycannotbeNULL!!!WARNINGimgThmbNlthisListorArraycannotbeNULL!!!
if((imgThmbNl != null) && ((thumbleep.isSelected())==false)){
redoThumbArray()
}//enif
//==========================
this.sleep(10)
if(((thumboo.isSelected())==true) && ((thumbleep.isSelected())==false)){
doAddThumb()
}else{
if((thumbleep.isSelected())==true){
imgThmbNl = null
}
}//ENIFif((thumboo.isSelected())==true)
//
this.sleep(10)
//
doGarbageClear()
//
inputimage.createNewFile()
//
ioStreamSyscalls2.scanForPlugins()
//
//DOJUMPWITHBOOLEANABOVETOREMOVETHUMBSSTARTJUMPHERETOREMOVEMETADATANOTHUMBSJPEGWRITE!!!WARNINGEXCEPTION.PNGMUSTNOTBEWRITTENBYUSINGRASTER
ityp = new ImageTypeSpecifier(((RenderedImage)bumi))
if(((extstyp.equals("jpeg"))==true) || ((extstyp.equals("jpg"))==true)){ //note:getImageWriters(ityp,"WBMP")
iwrtRs = ioStreamSyscalls2.getImageWritersByFormatName("JPEG")
}
//
while(iwrtRs.hasNext()){
//NOTEcandodoesnotactuallyappeartoberequiredbutisonlyusedasaSTOP
if(cando!=1){
iwRT = ((javax.imageio.ImageWriter)iwrtRs.next())
cando+=1
}//enif
qtywrt+=1
}//enwhl
qwRt(qtywrt)
//========specialplacement
if(imgIIOmtda.hasController()){
boolean coImTda = imgIIOmtda.activateController()
if(coImTda==false){
imgIIOmtda.activateController()
}
}
imgIIOmtda=iwRT.convertImageMetadata(imgIIOmtda,ityp,iwRT.getDefaultWriteParam())
foutstrm = new java.io.FileOutputStream(inputimage)
outstrImg = ((javax.imageio.stream.ImageOutputStream)ioStreamSyscalls2.createImageOutputStream(foutstrm))
iwRT.setOutput(outstrImg)
imgWtPrm = iwRT.getDefaultWriteParam()
//
if(imgWtPrm.hasController()){
imPrmCnt = imgWtPrm.getDefaultController()
imgWtPrm.setController(imPrmCnt)
cntl=imgWtPrm.activateController()
if(cntl==false){
cntl=imgWtPrm.activateController()
}
}//enif
//
if(((extstyp.equals("jpeg"))==true) || ((extstyp.equals("jpg"))==true)){
if(imgWtPrm.canWriteCompressed()){
imgWtPrm.setCompressionMode(2)//MODE_DEFAULT=1MODE_EXPLICIT=2
imgWtPrm.setCompressionType("JPEG") //stringNameornull
qlvals="JPEGcompression/picturequalitysettings[HIGHCOMPRESSION/LOWQUALITY]:" //"JPEGqualitysettings:"
compquals = imgWtPrm.getCompressionQualityValues()
for(int cil=0cil<compquals.lengthcil++){
qlvals+=(new Float(compquals[cil]).toString())+":"
}//enfr
qlvals+="[HIGHQUALITY/LOWCOMPRESSION]thislastisthequalitysettingused."+linesep
//
ctc =""
String[] comptyps = imgWtPrm.getCompressionTypes()
for(int too=0too<comptyps.lengthtoo++){
ctc+=comptyps[too]+linesep
}//enfr
//
imgWtPrm.setCompressionQuality(compquals[(compquals.length1)])
//
if(imgWtPrm.canWriteProgressive()){
imgWtPrm.setProgressiveMode(1)
}
//
if(imgWtPrm.canWriteTiles()){
imgWtPrm.setTilingMode(2)
Dimension[] tildime = imgWtPrm.getPreferredTileSizes()
imgWtPrm.setTiling(new Double(tildime[0].getWidth()).intValue(),new Double(tildime[0].getHeight()).intValue(),0,0)
}
}//enifcanwritecompressed()
//
doGarbageClear()
this.sleep(10)
chooseImageSys(iowrtImg,imgThmbNl,imgIIOmtda)
//
}//eniftypmoder
//
}catch(IllegalStateException excvcstat){
stackExPasthru((Throwable)excvcstat)
}catch(IllegalArgumentException excvcarg){
stackExPasthru((Throwable)excvcarg)
}catch(UnsupportedOperationException excvcodf){
stackExPasthru((Throwable)excvcodf)
}catch(IIOException excvioii){
stackExPasthru((Throwable)excvioii)
}catch(java.lang.InterruptedException ioexcepA3){
stackExPasthru((Throwable)ioexcepA3)
}catch(java.io.IOException excvioded){
stackExPasthru((Throwable)excvioded)
}catch(java.lang.Exception excvded){
stackExPasthru((Throwable)excvded)
}finally{}
try{
sleep(slp)
}catch(java.lang.InterruptedException excvdedint){
stackExPasthru((Throwable)excvdedint)
}finally{}
writeImage()
//
}//enconstr
void doAddThumb(){
if((thumboo.isSelected()==true) && (((extstyp.equals("jpeg"))==true) || ((extstyp.equals("jpg"))==true))){//needstobecheckedifEXIFPICTetctoo
int thmSetSz = ((int)new Integer(((String)settLong.getSelectedItem().toString())).intValue())
//if(((extstyp.equals("jpeg"))==true)||((extstyp.equals("jpg"))==true)){//||((extstyp.equals("tiff"))==true)||((extstyp.equals("tif"))==true)
thumbdimenson = thumbAddSizer(thmSetSz)
int dblwid=(int)new Double(thumbdimenson.getWidth()).intValue()
int dblhit=(int)new Double(thumbdimenson.getHeight()).intValue()
if(imgThmbNl == null){
arrlImgTEST = new java.util.ArrayList(1)//!MUSTINSTANTIATEWHETHERORNOTUSEDORERRORWILLBETHROWN
arrlImgTEST.add(thumbImgsys(dblwid,dblhit))
imgThmbNl = (java.util.List)arrlImgTEST
}else{
imgThmbNl.add(thumbImgsys(dblwid,dblhit))
}//enifels
//============================
}//enifenfilecheck
//
thmbFrm.setVisible(false)
thmbFrm.dispose()
//
}//enmeth

void redoThumbArray(){
itThmbSz = imgThmbNl.size()
wid=0
hit=0
for(int clth = 0(clth<itThmbSz)clth+=1){
if(clth!=0){ //clearfornextimage
bummer=null
rastextract=null
resetdata=null
reassThmb=null
}//enif
bummer = (BufferedImage)imgThmbNl.get(clth)
wid = bummer.getWidth()
hit = bummer.getHeight()
rastextract = thumbImgsys(wid,hit)
resetdata = rastextract.getRaster()
bummer.setData((Raster)resetdata)
reassThmb =(Object)bummer
imgThmbNl.set(clth,reassThmb)
}//enfr
}//enmeth

void chooseImageSys(IIOImage iowrtImg,java.util.List imgThmbNl,IIOMetadata mtda){


//>WARNINGEXTRACTEDFROMLARGECOMMENTEDOUTSECTIONABOVEASALLPURPOSETEST
iowrtImg = new javax.imageio.IIOImage(((RenderedImage)bumi),null,(javax.imageio.metadata.IIOMetadata)mtda)
if((imgThmbNl!=null) && (imgThmbNl.size()>0)){
if((thumbleep.isSelected())==true){
iowrtImg.setThumbnails(null)
setMkImg(iowrtImg)
}else{
iowrtImg.setThumbnails(imgThmbNl)
setMkImg(iowrtImg)
}
}else{
if(imgIIOmtda!=null){
setMkImg(iowrtImg)
}else{
setMkImg(new javax.imageio.IIOImage(((RenderedImage)bumi),null,null))
}
}//thumbcheckforimagesetreaddto
}//enmeth

void annIhalAte(){
if(imgInpStr!=null){
imgInpStr=null
}
//javax.imageio.ImageReaderreadIMG
if(rdrPRM!=null){
rdrPRM=null
}
if(iioiMIG!=null){
iioiMIG=null
}

Page 11 / 32

void annIhalAte(){
if(imgInpStr!=null){
imgInpStr=null
}
//javax.imageio.ImageReaderreadIMG
if(rdrPRM!=null){
rdrPRM=null
}
if(iioiMIG!=null){
iioiMIG=null
}
if(imgIIOmtda!=null){
imgIIOmtda=null
}
if(imgIIOmtdaRead!=null){
imgIIOmtdaRead=null
}
}//enmeth
javax.imageio.IIOImage setMkImg(javax.imageio.IIOImage ioIIO){
if(ioIIO != null){
iowrtImg=(javax.imageio.IIOImage)ioIIO
return iowrtImg
}else{
iowrtImg=null
return iowrtImg
}
}//enmeth
public void writeImage(){
try{
if(((extstyp.equals("png"))==false) && ((extstyp.equals("bmp"))==false)){
this.writeCall() //custommethod
}else{ //e.g..jpg.pngbothonfilename[BADSTRINGHANDLING]
iwRT.write(((RenderedImage)bumi)) //ImageWriterAPImethod
//
foutstrm.flush()
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
annIhalAte()
printField(ctc,qlvals)
iwRT.reset()
thumboo.setSelected(false)
sp2doGarbageClear()
doGarbageClear()
//this.writeCall(((RenderedImage)bumi))//versionisonlyjava6andlater????????????????????????
}//enifels
}catch(javax.imageio.IIOException imgwrtEx){
stackExPasthru((Throwable)imgwrtEx)
}catch(IOException ioexcepA60){
stackExPasthru((Throwable)ioexcepA60)
}finally{}
}//enrun

/*
catch(java.lang.InterruptedExceptionioexcepA3){
stackExPasthru((Throwable)ioexcepA3)
}
*/
void writeCall(){
try{
//
iwRT.write(null,iowrtImg,imgWtPrm)
foutstrm.flush()
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
annIhalAte()
printField(ctc,qlvals)
iwRT.reset()
//
}catch(IllegalStateException ioexcepA56){
stackExPasthru((Throwable)ioexcepA56)
}catch(IllegalArgumentException ioexcepA57){
stackExPasthru((Throwable)ioexcepA57)
}catch(UnsupportedOperationException ioexcepA58){
stackExPasthru((Throwable)ioexcepA58)
}catch(IIOException ioexcepA59){
stackExPasthru((Throwable)ioexcepA59)
}catch(IOException ioexcepA60){
stackExPasthru((Throwable)ioexcepA60)
}finally{}
//
thumboo.setSelected(false)
sp2doGarbageClear()
}//enmeth
java.awt.Dimension thumbAddSizer(int addszcompare){
int mainImWid = bumi.getWidth()
int mainImHit = bumi.getHeight()
int[] divis = new int[100]
for(int cif=0cif<100cif++){
divis[cif]=((int)cif)
}//enif
int setflagcannot=0
int wsz=0
int hsz=0
//
int whCnt=0
int whlstplen=divis.length
//
int tstcmsz = (addszcompare+2)
while(whCnt<whlstplen){
wsz = (int)new Float((new Float(mainImWid).floatValue())/(new Float(divis[whCnt]).floatValue())).intValue()
hsz = (int)new Float((new Float(mainImHit).floatValue())/(new Float(divis[whCnt]).floatValue())).intValue()
if((wsz<tstcmsz)&&(hsz<tstcmsz)){
whCnt=(whlstplen+1)
}else{
if(whCnt==(whlstplen1)){
setflagcannot=1
}//enif
}//enifels
whCnt+=1
}//enwhl
if(setflagcannot==1){
JOptionPane.showMessageDialog(new JFrame(),"Cannotfind/makesuitableThumbImagesize!~CannotaddathumbImage!")
}//enif
return (new java.awt.Dimension(wsz,hsz))
}//enmeth
void sp2doGarbageClear(){
iowrtImg=null
ityp=null
iwRT=null
reassThmb=null
foutstrm=null
//outstrImg=null
bummer=null
//SPECIALCHECKswitchoffthumbaddframeiftheusercancelsthedialog
if(thmbFrm!=null){
thmbFrm.setVisible(false)
thmbFrm.dispose()
}//enif
thmbFrm=null
//
doGarbageClear()
}//enmeth
void printField(String ct,String qvl){
Raster wrtRstr = bumi.getRaster()
passPane="===filename:"+(inputimage.getAbsoluteFile().getName())+"==="+linesep
passPane+="===abspath:"+(inputimage.getAbsolutePath())+"==="+linesep
passPane+="imagewidth:"+wrtRstr.getWidth()+""+linesep
passPane+="imageheight:"+wrtRstr.getHeight()+""+linesep
passPane+="NumberofThumbImages:"+numThumb+""+linesep
passPane+="writerdesc:"+(iwRT.getOriginatingProvider()).getDescription(new java.util.Locale("en","US"))+""+linesep
passPane+="writervendor:"+(iwRT.getOriginatingProvider()).getVendorName()+""+linesep
passPane+="writerversion:"+(iwRT.getOriginatingProvider()).getVersion()+""+linesep
passPane+="Writercodecsregistered:"+qtywrt
if(ct!=null){
passPane+=linesep+"CompressionType:"+ct
passPane+=qvl
}//enif
metaPne.setText(passPane)
//returnpassPane
}//enmeth
//!!!MALFUNCCHECKCALLINGnullpointerexception
void dispWrtStrmCheck(){
if(iwRT!=null){
iwRT.dispose()
}
}//enmeth
int qwRt(int pss){
qtywrt=pss
return qtywrt
}//enmeth
Image scaledData(int wide,int hite){
return ((java.awt.Image)bumi.getScaledInstance(wide,hite,4))
}//enmeth
BufferedImage thumbImgsys(int widthm,int htthm){
BufferedImage barm = new BufferedImage(widthm,htthm,bumi.getType()) //TYPE_INT_RGB=1
Image ima = scaledData(widthm,htthm)
Graphics2D gd = barm.createGraphics()
gd.drawImage(ima,0,0,widthm,htthm,null) //imgthmb
//gd.drawImage(((java.awt.Image)newjavax.swing.ImageIcon(imgthmb).getImage()),0,0,widthm,htthm,null)
gd.dispose()
return ((BufferedImage)barm) //ThmbTrnsthmkr
}//enmeth
//
}//enclss
//======ENDWRITENESTEDSUBCLASS
//=================NESTEDSUBCLASS
class WritImgOutPNG extends java.lang.Thread{
javax.imageio.IIOImage iowrtImg
javax.imageio.ImageWriter iwRT
javax.imageio.ImageWriteParam imgWtPrm
ImageTypeSpecifier ityp
Object extstyp
int qtywrt
int cando
int wid
int hit
String typemoder
String qlvals = null
String ctc = null
String flnmeimg = null
long slp
/*
DONOTDECLARETYPESINSIDETHECONSTRUCTOR!!!!!!!!
*/
//OUTSIDECONSTRUCTORSTART
WritImgOutPNG(){
super()
slp=100L
setDaemon(false)
setPriority(10)
qtywrt=0
cando=0
//
try{
if(iwRT!=null){
iwRT=null
}//enif
//
if(foutstrm != null){
foutstrm=null
}//enif
//
flnmeimg = (inputimage.getAbsoluteFile()).getName()
typemoder = flnmeimg.substring(((int)flnmeimg.lastIndexOf(".")+1))
extstyp=(Object)typemoder.toLowerCase()
//
inputimage.createNewFile()
//
ioStreamSyscalls2.scanForPlugins()
//!!!WARNINGEXCEPTION.PNGMUSTNOTBEWRITTENBYUSINGRASTER
ityp = new ImageTypeSpecifier(((RenderedImage)bumi))
if((extstyp.equals("png"))==true){
//WritImgOutPNG
iwrtRs = ioStreamSyscalls2.getImageWriters(ityp,"PNG")
}else{}
while(iwrtRs.hasNext()){
//NOTEcandodoesnotactuallyappeartoberequiredbutisonlyusedasaSTOP
if(cando!=1){
iwRT = ((javax.imageio.ImageWriter)iwrtRs.next())
cando+=1
}//enif
qtywrt+=1
}//enwhl
qwRt(qtywrt)
//
foutstrm = new java.io.FileOutputStream(inputimage)
iwRT.setOutput(((javax.imageio.stream.ImageOutputStream)ioStreamSyscalls2.createImageOutputStream(foutstrm)))
//
}catch(IllegalStateException excvcstat){
stackExPasthru((Throwable)excvcstat)
}catch(IllegalArgumentException excvcarg){
stackExPasthru((Throwable)excvcarg)
}catch(UnsupportedOperationException excvcodf){
stackExPasthru((Throwable)excvcodf)
}catch(IIOException excvioii){
stackExPasthru((Throwable)excvioii)
}catch(java.io.IOException excvioded){
stackExPasthru((Throwable)excvioded)
}catch(java.lang.Exception excvded){
stackExPasthru((Throwable)excvded)
}finally{}
try{
sleep(slp)
}catch(java.lang.InterruptedException excvdedint){
stackExPasthru((Throwable)excvdedint)
}finally{}
//
writeImage()
}//enconstr
public void writeImage(){
try{
iwRT.write(((RenderedImage)bumi)) //ImageWriterAPImethod

Page 12 / 32

sleep(slp)
}catch(java.lang.InterruptedException excvdedint){
stackExPasthru((Throwable)excvdedint)
}finally{}
//
writeImage()
}//enconstr
public void writeImage(){
try{
iwRT.write(((RenderedImage)bumi)) //ImageWriterAPImethod
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
printField(ctc,qlvals)
iwRT.reset()
thumboo.setSelected(false)
sp2doGarbageClear()
}catch(javax.imageio.IIOException imgwrtEx){
stackExPasthru((Throwable)imgwrtEx)
}catch(java.io.IOException ioexcepA3){
stackExPasthru((Throwable)ioexcepA3)
}finally{}
}//enrun
void writeCall(javax.imageio.IIOImage iwrIIOmg)throws IllegalStateException,IllegalArgumentException,UnsupportedOperationException,IIOException,IOException{
iwRT.write(iwrIIOmg)
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
printField(ctc,qlvals)
iwRT.reset()
thumboo.setSelected(false)
sp2doGarbageClear()
}//enmeth
void sp2doGarbageClear(){
iowrtImg=null
ityp=null
iwRT=null
foutstrm=null
//
doGarbageClear()
}//enmeth
void printField(String ct,String qvl){
Raster wrtRstr = bumi.getRaster()
metaPne.setText("===filename:"+(inputimage.getAbsoluteFile().getName())+"==="+linesep)
metaPne.append("===abspath:"+(inputimage.getAbsolutePath())+"==="+linesep)
metaPne.append("imagewidth:"+wrtRstr.getWidth()+""+linesep)
metaPne.append("imageheight:"+wrtRstr.getHeight()+""+linesep)
metaPne.append("NumberofThumbImages:"+numThumb+""+linesep)
metaPne.append("writerdesc:"+(iwRT.getOriginatingProvider()).getDescription(new java.util.Locale("en","US"))+""+linesep)
metaPne.append("writervendor:"+(iwRT.getOriginatingProvider()).getVendorName()+""+linesep)
metaPne.append("writerversion:"+(iwRT.getOriginatingProvider()).getVersion()+""+linesep)
metaPne.append("Writercodecsregistered:"+qtywrt)
if(ct!=null){
metaPne.append(linesep+"CompressionType:"+ct)
metaPne.append(qvl)
}//enif
}//enmeth
//!!!MALFUNCCHECKCALLINGnullpointerexception
void dispWrtStrmCheck(){
if(iwRT!=null){
iwRT.dispose()
}
}//enmeth
int qwRt(int pss){
qtywrt=pss
return qtywrt
}//enmeth
//
}//enclss
//======ENDpngWRITENESTEDSUBCLASS
//=================NESTEDSUBCLASS
class WritImgOutBMP extends java.lang.Thread{
//java.util.Iterator<javax.imageio.ImageWriter>iwrtRs//GENERICS
javax.imageio.IIOImage iowrtImg
javax.imageio.ImageWriter iwRT
javax.imageio.ImageWriteParam imgWtPrm
ImageTypeSpecifier ityp
Object extstyp
int qtywrt
int cando
int wid
int hit
String typemoder
String qlvals = null
String ctc = null
String flnmeimg = null
long slp
//OUTSIDECONSTRUCTORSTART
WritImgOutBMP(){
super()
slp=100L
setDaemon(false)
setPriority(10)
qtywrt=0
cando=0
//
try{
if(iwRT!=null){
iwRT=null
}//enif
//
if(foutstrm != null){
foutstrm=null
}//enif
//
flnmeimg = (inputimage.getAbsoluteFile()).getName()
typemoder = flnmeimg.substring(((int)flnmeimg.lastIndexOf(".")+1))
extstyp=(Object)typemoder.toLowerCase()
//
inputimage.createNewFile()
//
ioStreamSyscalls2.scanForPlugins()
//
ityp = new ImageTypeSpecifier(((RenderedImage)bumi))
if((extstyp.equals("bmp"))==true){
//WritImgOutPNG
iwrtRs = ioStreamSyscalls2.getImageWriters(ityp,"BMP")
}else{}
//
while(iwrtRs.hasNext()){
//NOTEcandodoesnotactuallyappeartoberequiredbutisonlyusedasaSTOP
if(cando!=1){
iwRT = ((javax.imageio.ImageWriter)iwrtRs.next())
cando+=1
}//enif
qtywrt+=1
}//enwhl
qwRt(qtywrt)
//
foutstrm = new java.io.FileOutputStream(inputimage)
iwRT.setOutput(((javax.imageio.stream.ImageOutputStream)ioStreamSyscalls2.createImageOutputStream(foutstrm)))
//
}catch(IllegalStateException excvcstat){
stackExPasthru((Throwable)excvcstat)
}catch(IllegalArgumentException excvcarg){
stackExPasthru((Throwable)excvcarg)
}catch(UnsupportedOperationException excvcodf){
stackExPasthru((Throwable)excvcodf)
}catch(IIOException excvioii){
stackExPasthru((Throwable)excvioii)
}catch(java.io.IOException excvioded){
stackExPasthru((Throwable)excvioded)
}catch(java.lang.Exception excvded){
stackExPasthru((Throwable)excvded)
}finally{}
try{
sleep(slp)
}catch(java.lang.InterruptedException excvdedint){
stackExPasthru((Throwable)excvdedint)
}finally{}
//
writeImage()
//
}//enconstr
public void writeImage(){
try{
iwRT.write(((RenderedImage)bumi)) //ImageWriterAPImethod
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
printField(ctc,qlvals)
iwRT.reset()
thumboo.setSelected(false)
sp2doGarbageClear()
}catch(javax.imageio.IIOException imgwrtEx){
stackExPasthru((Throwable)imgwrtEx)
}catch(java.io.IOException ioexcepA3){
stackExPasthru((Throwable)ioexcepA3)
}finally{}
}//enrun
void writeCall(javax.imageio.IIOImage iwrIIOmg)throws IllegalStateException,IllegalArgumentException,UnsupportedOperationException,IIOException,IOException{
iwRT.write(iwrIIOmg)
foutstrm.close()
//importantclose()ortheimagecannotbeopenedtobeviewed!!!
printField(ctc,qlvals)
iwRT.reset()
thumboo.setSelected(false)
sp2doGarbageClear()
}//enmeth
void sp2doGarbageClear(){
iowrtImg=null
ityp=null
iwRT=null
foutstrm=null
//
doGarbageClear()
}//enmeth
void printField(String ct,String qvl){
Raster wrtRstr = bumi.getRaster()
metaPne.setText("===filename:"+(inputimage.getAbsoluteFile().getName())+"==="+linesep)
metaPne.append("===abspath:"+(inputimage.getAbsolutePath())+"==="+linesep)
metaPne.append("imagewidth:"+wrtRstr.getWidth()+""+linesep)
metaPne.append("imageheight:"+wrtRstr.getHeight()+""+linesep)
metaPne.append("NumberofThumbImages:"+numThumb+""+linesep)
metaPne.append("writerdesc:"+(iwRT.getOriginatingProvider()).getDescription(new java.util.Locale("en","US"))+""+linesep)
metaPne.append("writervendor:"+(iwRT.getOriginatingProvider()).getVendorName()+""+linesep)
metaPne.append("writerversion:"+(iwRT.getOriginatingProvider()).getVersion()+""+linesep)
metaPne.append("Writercodecsregistered:"+qtywrt)
if(ct!=null){
metaPne.append(linesep+"CompressionType:"+ct)
metaPne.append(qvl)
}//enif
}//enmeth
//!!!MALFUNCCHECKCALLINGnullpointerexception
void dispWrtStrmCheck(){
if(iwRT!=null){
iwRT.dispose()
}
}//enmeth
int qwRt(int pss){
qtywrt=pss
return qtywrt
}//enmeth
//
}//enclss
//======ENDbmpWRITENESTEDSUBCLASS

//=======STARTREADNESTEDCLASS
class ImageSysTest{
//================CONSTRUCTORSTART
ImageSysTest(File imgFilingb)throws java.io.IOException,Exception{
imgFiling = imgFilingb
numThumb=0
String imgfilenme = (imgFiling.getAbsoluteFile()).getName()
String lsepa = System.getProperty("line.separator")
flimstrm = new FileInputStream(imgFiling)
imgInpStr = ioStreamSyscalls.createImageInputStream(flimstrm)
//
int stpsttr=0
//<javax.imageio.ImageReader>shouldbestatic
imReaders = ioStreamSyscalls.getImageReaders(imgInpStr)
while((imReaders.hasNext())&&(stpsttr<1)){
readIMG = (javax.imageio.ImageReader)imReaders.next()
stpsttr+=1
}//ENWHL
readIMG.setInput(imgInpStr,true,false)//mayneedtobecastbecauseSTATIC(ImageInputStream)
//
readIMG.getNumImages(false) //[illegalstateEXCEPTIONifseekforwardonlyistruealsoDOTHISPAST/AFTERsetInput()]
rdrPRM = readIMG.getDefaultReadParam()
//
iioiMIG = readIMG.readAll(0,rdrPRM)
if(readIMG.hasThumbnails(0)){
numThumb = readIMG.getNumThumbnails(0)
imgThmbNl = iioiMIG.getThumbnails()
}
//
bumi = (BufferedImage)iioiMIG.getRenderedImage() //returnsinterfaceRenderedImage
int bumtyp = bumi.getType()
//java.awt.AlphaComposite===============
if(bumtyp==3 || bumtyp==7 || bumtyp==2 || bumtyp==6){ //ALPHAandPREMULTIPLIED
//alphatypes
JOptionPane.showMessageDialog(new JFrame(),"DONOTATTEMPTTOEDIT\"Alpha\"IMAGEtype[Java"+bumtyp+"]NOTACCEPTABLEINEDITOR")
}else{
if(bumtyp==5 || bumtyp==4 || bumtyp==1){ //normalRGB
if((imgFilingb.getPath().toString()).indexOf("SidewinderA400")==1){
JOptionPane.showMessageDialog(new JFrame(),"ACCEPTEDIMAGEtype[Java"+bumtyp+"](NoAlphaimage)" )
}
}else{
JOptionPane.showMessageDialog(new JFrame(),"DONOTATTEMPTTOEDITIMAGETYPENOTACCEPTABLEtype[Java"+bumtyp+"]" )
}

Page 13 / 32

//java.awt.AlphaComposite===============
if(bumtyp==3 || bumtyp==7 || bumtyp==2 || bumtyp==6){ //ALPHAandPREMULTIPLIED
//alphatypes
JOptionPane.showMessageDialog(new JFrame(),"DONOTATTEMPTTOEDIT\"Alpha\"IMAGEtype[Java"+bumtyp+"]NOTACCEPTABLEINEDITOR")
}else{
if(bumtyp==5 || bumtyp==4 || bumtyp==1){ //normalRGB
if((imgFilingb.getPath().toString()).indexOf("SidewinderA400")==1){
JOptionPane.showMessageDialog(new JFrame(),"ACCEPTEDIMAGEtype[Java"+bumtyp+"](NoAlphaimage)" )
}
}else{
JOptionPane.showMessageDialog(new JFrame(),"DONOTATTEMPTTOEDITIMAGETYPENOTACCEPTABLEtype[Java"+bumtyp+"]" )
}
}
//==========================
bumiSZpaint=bumi
//imgIIOmtda=iioiMIG.getMetadata()//IIOIMGetadatajavax.imageio.metadata.IIOMetadata
imgIIOmtda = readIMG.getImageMetadata(0)
clearReaderImg()
//!!streamsclosedandnulledoutside
//==
}//enconstr
}//enclss
//=============ENDNESTEDREADCLASS
//==========================STARTNESTEDCLASSImwin
class ImWin extends JLabel implements java.awt.event.MouseListener,java.awt.event.MouseMotionListener{
Cropcoords cropattr
ImageObserver obstop
java.util.Locale oriale
ComponentOrientation cmpo
Graphics g,gg
Point point1
Point point2
int animint = 0
boolean textwriteFlg
int[] textPointset={0,0}
int[] textLen={0,0}
int txtTimeFlg //0=off1=on
boolean mouseoutflag
boolean croponflag
public boolean hascroponflag
int xleft
int yleftdown
int sidelateral
int sidevertical
int tmP
ImWin(Image ico){
super(new ImageIcon(ico))
tmP=0
textwriteFlg=false
oriale = (java.util.Locale)Locale.US
cmpo = ComponentOrientation.getOrientation(oriale)
super.setComponentOrientation(cmpo)
this.setHorizontalAlignment(0)
this.setVerticalAlignment(1)
this.setBackground(new Color(255,255,255))
g = this.getGraphics()
repaint()
Runtime.getRuntime().gc()
Runtime.getRuntime().runFinalization()
this.addMouseListener(this)
this.addMouseMotionListener(this)
xleft=0
yleftdown=0
sidelateral=0
sidevertical=0
mouseoutflag=false //allowcropping
croponflag=false
hascroponflag=false
txtTimeFlg=0 //0=off1=on
}//enconstr
boolean getTextFlag(){
return ((boolean)textwriteFlg)
}//enmeth
boolean textWriteFlgOFF(){
textwriteFlg=false
return textwriteFlg
}//enmeth
boolean textWriteFlgON(){
textwriteFlg=true
return textwriteFlg
}//enmeth

//textWriteFlgOFF()textWriteFlgON()textPointset

public int anintcount(){


animint += 1
return animint
}
public int anint(){
animint = 0
return animint
}
int xl(int xlp){
xleft=xlp
return xleft
}
int yd(int yd){
yleftdown=yd
return yleftdown
}
int sxLt(int sx){
sidelateral=sx
return sidelateral
}
int syVt(int sv){
sidevertical=sv
return sidevertical
}
//crx.getSelectedIndex()
public void cropRectPainter(){
cropattr = new Cropcoords(point1,point2)
xl((new Double(cropattr.ltp.getX()).intValue()))
yd((new Double(cropattr.ltp.getY()).intValue()))
sxLt(cropattr.sideX)
syVt(cropattr.sideY)
//
if(croponflag==true){
if(animint==5){
anint()
repaint()
}else{
anintcount()
}
//
gg = (this.getGraphics())
gg.setColor(mkDrwColor(crx.getSelectedIndex()))
gg.drawRect(xleft,yleftdown,sidelateral,sidevertical)
}
}//enmeth
public void mouseDragged(java.awt.event.MouseEvent e){
if(textwriteFlg!=true){
mkPoint2(new Point(e.getX(),e.getY()))
xfield.setText(new Integer(e.getX()).toString())
yfield.setText(new Integer(e.getY()).toString())
cropRectPainter()
}//entextflag
}//enmotionmeth
public void mouseMoved(java.awt.event.MouseEvent e){ //SYSTEMFORTHEFONTPOSITIONRATIO
if(textwriteFlg==true){ //donotallowcroptextfieldstooperatewithmovement(onlyallowedwhentextinsertboardisused)
int egX=e.getX()
int hamY=e.getY()
int sztoit=0
int rszto=jox.getSelectedIndex()
//sidd.makeImgRsz(brsZidx)
if(rszto==3){//1/2
sztoit=2
}else if(rszto==5){//1/3
sztoit=3
}else if(rszto==6){//1/4
sztoit=4
}else if(rszto==7){//1/5
sztoit=5
}else if(rszto==9){//1/6
sztoit=6
}else if(rszto==10){//1/8
sztoit=8
}else if(rszto==11){//1/10
sztoit=10
}else if(rszto==12){//1/12
sztoit=12
}else if(rszto==13){//1/16
sztoit=16
}else{}

if(rszto!=0){ //*0BYZEROBRINGSBACK0
if(rszto==1){ //3/4
egX = (int)new Double((double)(new Integer(egX).doubleValue()/3D)*4D).intValue()
hamY = (int)new Double((double)(new Integer(hamY).doubleValue()/3D)*4D).intValue()
}else if(rszto==2){ //2/3
egX = (int)new Double((double)(new Integer(egX).doubleValue()/2D)*3D).intValue()
hamY = (int)new Double((double)(new Integer(hamY).doubleValue()/2D)*3D).intValue()
}else if(rszto==4){ //5/12
egX = (int)new Double((double)(new Integer(egX).doubleValue()/5D)*12D).intValue()
hamY = (int)new Double((double)(new Integer(hamY).doubleValue()/5D)*12D).intValue()
}else if(rszto==8){ //3/16
egX = (int)new Double((double)(new Integer(egX).doubleValue()/3D)*16D).intValue()
hamY = (int)new Double((double)(new Integer(hamY).doubleValue()/3D)*16D).intValue()
}else{
egX = ((int)egX*sztoit)
hamY = ((int)hamY*sztoit)
}
}//enif
xfield.setText(new Integer(egX).toString())
yfield.setText(new Integer(hamY).toString())
}//enif
}//enlistenermousemoved

boolean cropIsOnflag(boolean crpn){


hascroponflag=crpn
return hascroponflag
}
boolean cropflag(boolean crp){
croponflag=crp
return croponflag
}
boolean mouseflg(boolean mfg){
mouseoutflag=mfg
return mouseoutflag
}
/**/
public void mouseClicked(java.awt.event.MouseEvent e){}
public void mouseEntered(java.awt.event.MouseEvent e){
mouseflg(false)
cropflag(true)
}
public void mouseExited(java.awt.event.MouseEvent e){
mouseflg(true)
//WARNINGmouseisoutofbounds
cropflag(false)
//JOptionPane.showMessageDialog(newJFrame(),"Yourequire")
}
/**/
Point mkPoint1(Point pn1){
point1=pn1
return point1
}
Point mkPoint2(Point pn2){ //!!!avoidinitclickcausingpainterrorfromapointnotinitialised
point2=pn2
return point2
}
public void mousePressed(java.awt.event.MouseEvent e){
if(textwriteFlg!=true){
cropflag(true)
//NEEDTOADDABOOLEANTOKNOWASELECTIONPROCESSHASBEGUNSOITCANEITHERBE
//SUCCESFULABORTEDORRETRIEVED
//point1=newPoint(e.getX(),e.getY())
mkPoint1((new Point(e.getX(),e.getY())))
mkPoint2((new Point(e.getX(),e.getY()))) //gorinitonlynonullpointerexception
tm = new java.util.Timer()
tm.scheduleAtFixedRate(new CropTimer(),100,100)
}//entexflag
}//enpressedkeylistener
//
int[] setArrTxlenwid(int widR,int hitR){
textLen = new int[2]
textLen[0]=widR
textLen[1]=hitR
return textLen
}//enmeth
int timeflag(int tflg){
txtTimeFlg=tflg
return txtTimeFlg
}//enmeth
public void timeMarginBox(){
if(txtTimeFlg==0){
timeflag(1)
tm = new java.util.Timer()
tm.scheduleAtFixedRate(new TxTimer(),500L,500L)
}//enif
}//enmeth
public void spRepainter(){

Page 14 / 32

return txtTimeFlg
}//enmeth
public void timeMarginBox(){
if(txtTimeFlg==0){
timeflag(1)
tm = new java.util.Timer()
tm.scheduleAtFixedRate(new TxTimer(),500L,500L)
}//enif
}//enmeth
public void spRepainter(){
this.repaint()
}//enmeth
int setTmp(int t){
tmP=t
return tmP
}//enmeth

//=============================================================================================================
class TxTimer extends java.util.TimerTask{
public void run(){
if(tmP==4){
spRepainter()
tmP=0
setTmp(tmP)
}else{
tmP++
setTmp(tmP)
}
callPainter()
}//enrun
public void callPainter(){
if(txtTimeFlg!=0){
paintMarginBox()
}else{
tm.cancel()
}
}//enmeth
}//enclss//=========================================

public void paintMarginBox(){ //,Fontfrbu.setFont(fr)


gg = (this.getGraphics())
gg.setColor(mkDrwColor(crx.getSelectedIndex()))
gg.drawRect((textPointset[0]),(textPointset[1]),textLen[0],textLen[1])
}//enmeth
//=============================================================================================================
class CropTimer extends java.util.TimerTask{
public void run(){
callPainter()
}//enrun
public void callPainter(){
cropRectPainter()
//crx.getSelectedIndex()
}//enmeth
}//enclss//=========================================
public void mouseReleased(java.awt.event.MouseEvent e){
if(textwriteFlg!=true){
if((mouseoutflag==false) && (croponflag==true)&&(hascroponflag==false)){
cropIsOnflag(true)
point2=new Point(e.getX(),e.getY())
cropattr = new Cropcoords(point1,point2)
int joxMultiplier= jox.getSelectedIndex()
xl((new Double(cropattr.ltp.getX()).intValue()))
yd((new Double(cropattr.ltp.getY()).intValue()))
sxLt(cropattr.sideX)
syVt(cropattr.sideY)
//
if(joxMultiplier==1){
//3/4
xleft = new Double((new Integer(xleft).doubleValue()/3D)*4D).intValue()
yleftdown = new Double((new Integer(yleftdown).doubleValue()/3D)*4D).intValue()
sidelateral = new Double((new Integer(sidelateral).doubleValue()/3D)*4D).intValue()
sidevertical = new Double((new Integer(sidevertical).doubleValue()/3D)*4D).intValue()
}else if(joxMultiplier==2){
//2/3
xleft = new Double((new Integer(xleft).doubleValue()/2D)*3D).intValue()
yleftdown = new Double((new Integer(yleftdown).doubleValue()/2D)*3D).intValue()
sidelateral = new Double((new Integer(sidelateral).doubleValue()/2D)*3D).intValue()
sidevertical = new Double((new Integer(sidevertical).doubleValue()/2D)*3D).intValue()
}else if(joxMultiplier==3){ //1/2
xleft = (xleft*2)
yleftdown = (yleftdown*2)
sidelateral = (sidelateral*2)
sidevertical = (sidevertical*2)
}else if(joxMultiplier==4){
//5/12
xleft = new Double((new Integer(xleft).doubleValue()/5D)*12D).intValue()
yleftdown = new Double((new Integer(yleftdown).doubleValue()/5D)*12D).intValue()
sidelateral = new Double((new Integer(sidelateral).doubleValue()/5D)*12D).intValue()
sidevertical = new Double((new Integer(sidevertical).doubleValue()/5D)*12D).intValue()
}else if(joxMultiplier==5){ //1/3
xleft = (xleft*3)
yleftdown = (yleftdown*3)
sidelateral = (sidelateral*3)
sidevertical = (sidevertical*3)
}else if(joxMultiplier==6){
xleft = (xleft*4)
yleftdown = (yleftdown*4)
sidelateral = (sidelateral*4)
sidevertical = (sidevertical*4)
}else if(joxMultiplier==7){
xleft = (xleft*8)
yleftdown = (yleftdown*8)
sidelateral = (sidelateral*8)
sidevertical = (sidevertical*8)
}else if(joxMultiplier==8){
xleft = (xleft*10)
yleftdown = (yleftdown*10)
sidelateral = (sidelateral*10)
sidevertical = (sidevertical*10)
}else if(joxMultiplier==9){
xleft = (xleft*12)
yleftdown = (yleftdown*12)
sidelateral = (sidelateral*12)
sidevertical = (sidevertical*12)
}else if(joxMultiplier==10){
xleft = (xleft*16)
yleftdown = (yleftdown*16)
sidelateral = (sidelateral*16)
sidevertical = (sidevertical*16)
}else{}
xfield.setText(""+new Integer(xleft).toString())
//settopleftYtothetextfield
yfield.setText(""+new Integer(yleftdown).toString())
//setwidthtothetextfield
widefield.setText(""+new Integer(sidelateral).toString())
//setheighttothetextfield
heightfield.setText(""+new Integer(sidevertical).toString())
//popupajoptionpaneCHOICEDIALOGtoinformtheusertheycansettheaction
int brsZidx = rSzIdx(jox.getSelectedIndex())
rSzIdx(0) //inmkimreszitasksfirstwhatthe"bumi"imageusageismustbesuppliedaszerobeforeitwilluseittosizefrom???alwaysdoesanyhow???
cropstater(true)
mkImCrpPaintSelect()
makeImgRsz(brsZidx)
cropstater(false)
cropflag(false)
mouseflg(false)
tm.cancel()
}else{
setIcon(new ImageIcon((java.awt.Image)bumi))
repaint()
tm.cancel()
repaint() //SP
preCropClear()
JOptionPane.showMessageDialog(new JFrame(),"(preselectCroppingCleared1xonly)secondoppositediagonalcornermustbeinsidetheimagebound")
}//enif
}else{
int[] apTx ={e.getX(),e.getY()}
mkTextPoint(apTx)
toPointsFields(apTx[0],apTx[1])
}//entexflag
}//enmousereleased
int[] mkTextPoint(int[] arrPoint){
textPointset=(int[])arrPoint
return textPointset
}//enmeth

public void preCropClear(){


rotationPopulator(bumi.getWidth(),bumi.getHeight())
//copybumi=null
doGarbageClear()
cropflag(false)
mouseflg(false)
cropIsOnflag(false)
}//enmeth
} //enclss
//=======================ENDNESTEDCLASSImwin
}//enclssENDMAINCLASS
//=======================
class Splashframe extends javax.swing.JFrame{
Dimension scrdm
int wdloc
int htloc
JLabel sidewindersplash
JPanel holder
Toolkit swdlabtk
Image swindsplash
String classpathIMGPTH//app_PATH+flsep+"dat"+flsep+"SidewinderA400.jpg"
Font fon
Font appfon
String mssg
//OUTSIDECONSTRUCTOR
Splashframe(String classpathIMGPTH)throws java.io.FileNotFoundException,java.io.IOException,java.lang.Exception{
//INSIDECONSTRUCTOR
this.classpathIMGPTH=classpathIMGPTH
setUndecorated(true)
mssg="StartingSidewinder"
havingFon()
appfon=(Font)fon //(nopointing)originalwillsoonbeinanullclass
//mkSwngSz()!!!!!!!!!!!!!!!!!!WARNINGBUGOFNOTSETTINGINRUNORCONSTRUCTOR1.4.2
sidewindersplash = new JLabel()
sidewindersplash.setForeground(new Color(255,255,0))
sidewindersplash.setPreferredSize(new Dimension(400,281)) //imagesize
sidewindersplash.setMinimumSize(new Dimension(400,281))
sidewindersplash.setSize(new Dimension(400,281))
swdlabtk = (Toolkit)this.getToolkit()
swindsplash = swdlabtk.getImage(classpathIMGPTH) //NOTE:getImagerequiresusingclasspath
sidewindersplash.setIcon(new ImageIcon(swindsplash))
//
holder = new JPanel()
holder.setLayout(new BorderLayout())
holder.setPreferredSize(new Dimension(400,281))
holder.setMinimumSize(new Dimension(400,281))
holder.setSize(new Dimension(400,281))
//
setDefaultCloseOperation(2)
holder.add(sidewindersplash)
getContentPane().add(holder)
//.setMinimumSize(400,281)
sidewindersplash.setIgnoreRepaint(false)
setIgnoreRepaint(false)
scrdm=(Dimension)swdlabtk.getScreenSize()
wdloc=(int)(((int)(new Double(scrdm.getWidth())).intValue())/2)240
htloc=(int)(((int)(new Double(scrdm.getHeight())).intValue())/2)140
//
this.setSize(new java.awt.Dimension(400,281))
//this.setMinimumSize(newjava.awt.Dimension(400,281))
//this.setPreferredSize(newjava.awt.Dimension(400,281))//imagesize
//
setLocation(new Point(wdloc,htloc))
setVisible(true)
}//enconstr
void havingFon(){
for(int teu=0teu<7teu++){
if((fon=new Font("BitstreamVreaSansMonoBold",1,13))!=null){
appfon=new Font("BitstreamVreaSansMonoBold",1,8)
teu=7
}
if(((fon=new Font("DejavuSansBold",1,13))!=null) && (teu<7)){
appfon=new Font("DejavuSansBold",1,8)
teu=7
}
if(((fon=new Font("FreeMonospacedBoldOblique",1,13))!=null) && (teu<7)){
appfon=new Font("FreeMonospacedBoldOblique",1,8)
teu=7
}
if(((fon=new Font("SansSerif.bold",1,13))!=null) && (teu<7)){
appfon=new Font("SansSerif.bold",1,8)
teu=7
}
if(((fon=new Font("Courier10PitchBold",1,13))!=null) && (teu<7)){
appfon=new Font("Courier10PitchBold",1,8)
teu=7
}
if(((fon=new Font("Courier",1,13))!=null) && (teu<7)){
appfon=new Font("Courier",1,8)
teu=7
}
if(((fon=new Font("Times",1,13))!=null) && (teu<7)){
appfon=new Font("Times",1,8)
teu=7
}
}//enfr
}
void repSplat(){
sidewindersplash.repaint()
}

Page 15 / 32

teu=7
}
if(((fon=new Font("Times",1,13))!=null) && (teu<7)){
appfon=new Font("Times",1,8)
teu=7
}
}//enfr
}
void repSplat(){
sidewindersplash.repaint()
}
void mssgPrs(){
Graphics g = ((Graphics)sidewindersplash.getGraphics())
g.setFont(fon)
g.setColor(new Color(255,255,0))
g.drawString(mssg,30,200)
return
}
}//enclss

/***********************************************************************/
class StackPrinterPasthrough extends Throwable{
String flsep=System.getProperty("file.separator")
String wnei = System.getProperty("os.name")
String app_Classpath_PATH=System.getProperty("java.class.path")
String app_PATH=""
String errF=""
//
StackPrinterPasthrough(Throwable inputEXC)throws IOException,FileNotFoundException,Exception{
if((wnei.equals("WindowsXP"))||(wnei.equals("WindowsNT"))||(wnei.equals("Windows2000"))||(wnei.equals("Windows98"))||(wnei.equals("WindowsMe"))||(wnei.equals("Windows2003"))||(wnei.equals("Windows_NT"))||(wnei.equals("WindowsNT(unknown)"))||(wnei.equals("WindowsVista"))){
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf(("\\"+"engine"))))
}else{
app_PATH=""+app_Classpath_PATH.substring(0,((int)app_Classpath_PATH.lastIndexOf("/engine")))
}
//windows>app_PATH=""+app_Classpath_PATH.substring(0,(app_Classpath_PATH.length()9))//\engine[+2windows>"."]
errF=app_PATH+flsep+"dat"+flsep+"errTraceSidewinder.txt"
File errFil=new File(errF)
PrintStream pr=new PrintStream(((OutputStream)new FileOutputStream(errFil,true)))
inputEXC.printStackTrace(pr)
} //enconstr
} //enclss

/***********************************************************************/
class FchComp extends JLabel{
FchComp(){
setIgnoreRepaint(false)
setPreferredSize(new Dimension(200,200))
setMinimumSize(new Dimension(200,200))
//setSize(newDimension(200,200))
//setBackground(newColor(100,50,60))
}
//
public Graphics getCompGraphics(){
return (this.getGraphics())
}
//
}//enclss
/***********************************************************************/
class FileChoiceComp extends JFileChooser implements java.beans.PropertyChangeListener{
FchComp fcmp
PrintStream pr
String iconpath
ImageIcon icoflc
ImageIcon icoflcb
int icwid
int icht
File errFil
String errF
String flsep
javax.imageio.ImageReader imR
//
FileChoiceComp(String iconpath,String applicationPth,String curr){ //app_PATH
this.iconpath=iconpath
flsep=System.getProperty("file.separator")
try{
errF=applicationPth+flsep+"dat"+flsep+"errTraceSidewinder.txt"
errFil=new File(errF)
pr=new PrintStream(((OutputStream)new FileOutputStream(errFil,true)))
//==//eiyti.printStackTrace(pr)
}catch(java.io.FileNotFoundException fifterr){
System.out.println("ConstructorEXCEPTION:java.io.FileNotFoundException"+errF+"ErrorhandlersystemdownSidewinderPhotoColourBalancer.java")
}catch(java.lang.Exception excA){
System.out.println("ConstructorEXCEPTION:java.lang.ExceptionErrorhandlersystemdownSidewinderPhotoColourBalancer.java")
}finally{}
setPreferredSize(new Dimension(700,500))
setSize(new Dimension(700,500))
setCurrentDirectory(new File(curr))
setFileFilter(new IMGextensions())
/*
imageiconclassdoesnottake.bmpitappearsneither.ico
*/
icoflc = new ImageIcon(iconpath+"sidewinder200.jpg")
icwid=icoflc.getIconWidth()
icht=icoflc.getIconHeight()
fcmp = new FchComp()
SwingUtilities.invokeLater(new Runnable(){
public void run(){
setAccessory(((JComponent)fcmp))
cmpRender()
}
})
this.addPropertyChangeListener(this)
}//enconstr
int cwi(int iw){
icwid=iw
return icwid
}
int chi(int ih){
icht=ih
return icht
}
void cmpRender(){ //JComponent//javax.swing.ImageIconic
fcmp.setIcon(icoflc)
setPreferredSize(new Dimension(icwid,icht))
setMinimumSize(new Dimension(icwid,icht))
fcmp.repaint()
return
}//enmeth
javax.swing.ImageIcon mkIcoCmp(ImageIcon icc){
//Toolkittoot=(Toolkit)this.getToolkit()
//Imagedialimg=toot.getImage(pthico)//NOTE:getImagerequiresusingclasspath
//javax.swing.ImageIconicc=newjavax.swing.ImageIcon(pthico)
boolean longside=false
int lsdz=200 //iconmax200pixels
int wz=icc.getIconWidth()
int hz=icc.getIconHeight()
if(wz>hz){
longside=true
}
float coef=0
float lngz = new Integer(lsdz).floatValue()
float hiz = new Integer(hz).floatValue()
float wiz = new Integer(wz).floatValue()
if(longside==true){ //"otherelse"istheheight
coef=lngz/wiz
}else{//
coef=lngz/hiz
}
float nht=coef*hiz
float nwd=coef*wiz
int wdin = (new Float(nwd).intValue())
int hdin = (new Float(nht).intValue())
//
Image bmiresiz = (icc.getImage()).getScaledInstance(wdin,hdin,4)
icoflc = new javax.swing.ImageIcon(bmiresiz)
cwi(icoflc.getIconWidth())
chi(icoflc.getIconHeight())
return icoflc
}//enmeth
public void propertyChange(java.beans.PropertyChangeEvent e){
String namedprop = e.getPropertyName()
File fprop=null
if(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(namedprop)){
//"SelectedFileChangedProperty"
try{
fprop=(File)e.getNewValue()
if(((boolean)fprop.isDirectory())==false){
//JOptionPane.showMessageDialog(newJFrame(),""+(fprop.getAbsoluteFile()).getName())//(fprop.getAbsoluteFile()).getName()fprop.getPath()
int prt = (fprop.getPath()).lastIndexOf(".")
if((prt!=1) && (fprop.isAbsolute() == true) &&(fprop.isFile() ==true)){
String cmpre = (fprop.getPath()).substring(prt)
if((cmpre.equalsIgnoreCase(".png")==true)||(cmpre.equalsIgnoreCase(".jpg")==true)||(cmpre.equalsIgnoreCase(".jpeg")==true)||(cmpre.equalsIgnoreCase(".bmp")==true)){
if(cmpre.equalsIgnoreCase(".bmp")==true){
String fillin=(String)fprop.getPath()
//javax.imageio.ImageReaderimR
java.util.Iterator<javax.imageio.ImageReader> rdIt = (java.util.Iterator<javax.imageio.ImageReader>) javax.imageio.ImageIO.getImageReadersByFormatName("bmp")
while(rdIt.hasNext()){
javax.imageio.ImageReader imRead = (javax.imageio.ImageReader)rdIt.next()
imR=(javax.imageio.ImageReader)imRead
}//enwhl
//
try{
javax.imageio.stream.FileImageInputStream iostrMfile = new javax.imageio.stream.FileImageInputStream(new java.io.File(fillin))
imR.setInput(iostrMfile,true,false)
//
javax.imageio.IIOImage ioImage=imR.readAll(0,null)
//ioImage.getRenderedImage()
javax.swing.ImageIcon aicc = new javax.swing.ImageIcon(((Image)ioImage.getRenderedImage()))
iostrMfile.close()
mkIcoCmp(aicc)
}catch(java.io.FileNotFoundException fio){
fio.printStackTrace(pr)
}catch(java.io.IOException ooumio){
ooumio.printStackTrace(pr)
}finally{}
}else{
String fillin=(String)fprop.getPath()
javax.swing.ImageIcon aicc = new javax.swing.ImageIcon(fillin)
mkIcoCmp(aicc)
}
cmpRender()
//}
}
}else{
javax.swing.ImageIcon aicc = new javax.swing.ImageIcon(iconpath+"sidewinder200.jpg")
mkIcoCmp(aicc)
cmpRender()
}
}//enifisdirectory
}catch(Exception jflchsFlProp){
jflchsFlProp.printStackTrace(pr)
}finally{}
}//enif
}//enlstnrpropertychange
}//enclss

//bmp

//===========================
class QuickBoardColour extends JFrame implements java.awt.event.MouseListener{
SidewinderPhotoColourBalancer spcan
BufferedImage bu //tobeconvertedfromtheoriginalintheeditor
//NOTE:onconstructing,resizeacopyforthebufferedimage"BEFOREsending"ITINTOTHECONSTRUCTOR
BufferedImage[] setBu //28
JPanel mpan
//JPanelcontrol
JPanel insetV
JPanel[] imgBands //7rowsintheviewportspanelview
JPanel[] imgBandsets //28x(and4ofthe28perimgBands[])
JLabel[] imgLabelsets //28x(and4ofthe28perimgBands[])
JPanel[] colpanLb //7xforcolourrecognition
//
JScrollPane boardScr
JViewport viPw
boolean updnFlg
//
//finalint[]vals={2,4,6,10}//(3xcoloursandwhite"4p/coloureach"7x4=28)
final int[] vals={3,5,8,12} //(3xcoloursandwhite"4p/coloureach"7x4=28)
//finalString[]valsColorsets={"R","G","B","W","RG","RB","GB"}
//POSSIBLYAMENUONTHEFRAMEISBETTER
//JButtonupvals
//JButtondownvals
String[] rgbVals
//String[]rgbValsDWN
//rgbValsUPrgbValsDWN
//widthittPOSSIBLYNOTNEEDEDSODIRECTLYIFObject.clone()OPERATESTOGETTHEIMAGE
int widt
int hitt
boolean upndwn
String linesep
//
QuickBoardColour(SidewinderPhotoColourBalancer spcan,BufferedImage bu,String AppPath,int widt,int hitt,boolean upndwn){
super("SidewinderQuickColourPresenter")
this.spcan=spcan
this.bu=bu
//widthittPOSSIBLYNOTNEEDEDSODIRECTLYIFObject.clone()OPERATESTOGETTHEIMAGE
this.widt=widt
this.hitt=hitt
this.upndwn=upndwn
linesep=System.getProperty("line.separator")
try{
setIconImage(((Toolkit)this.getToolkit()).getImage(AppPath+System.getProperty("file.separator")+"Sidewinder32.gif"))
}catch(java.lang.Exception excaf1){
//NEEDTOSETUPTHEEXCEPTIONCLASSHERE
}finally{}
//
rgbVals=new String[28]
//rgbValsUPrgbValsDWN
for(int kgt=0kgt<28kgt++){
rgbVals[kgt]=new String(":")
}//enfr
//setframesicon
setDefaultCloseOperation(2)

Page 16 / 32

setIconImage(((Toolkit)this.getToolkit()).getImage(AppPath+System.getProperty("file.separator")+"Sidewinder32.gif"))
}catch(java.lang.Exception excaf1){
//NEEDTOSETUPTHEEXCEPTIONCLASSHERE
}finally{}
//
rgbVals=new String[28]
//rgbValsUPrgbValsDWN
for(int kgt=0kgt<28kgt++){
rgbVals[kgt]=new String(":")
}//enfr
//setframesicon
setDefaultCloseOperation(2)
setSize(800,700)
mpan=new JPanel()
mpan.setLayout(new BorderLayout())

addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
disncusnButt(true) //sidewinder.disnableButtons(false)
}
})

setBu = new BufferedImage[28]


for(int hi=0hi<28hi++){
setBu[hi]=new BufferedImage(bu.getWidth(),bu.getHeight(),bu.getType())
setBu[hi].setData(((Raster)bu.getData()))
}//enfr
imgLabelsets=new JLabel[28]
for(int ieq=0ieq<28ieq++){
ImageIcon iin = new ImageIcon(setBu[ieq]) //iin
imgLabelsets[ieq]=new JLabel(iin) //getIconImage()getWidth()getHeight()andsetSizeLabelsizeaddActionListener(this)addActionCommand()
imgLabelsets[ieq].setPreferredSize(new Dimension(widt,hitt)) //OR.setSize(800,700)ifitdidn'tlikethat
imgLabelsets[ieq].setMaximumSize(new Dimension(widt,hitt))
imgLabelsets[ieq].setBackground(new Color(0,0,0))
imgLabelsets[ieq].setLayout(new java.awt.FlowLayout(1,10,10)) //center
imgLabelsets[ieq].setName((new Integer(ieq).toString()))
imgLabelsets[ieq].addMouseListener(this)
}//enfr
imgBandsets=new JPanel[28]
for(int ieq=0ieq<28ieq++){
imgBandsets[ieq]=new JPanel()
imgBandsets[ieq].add(imgLabelsets[ieq])
imgBandsets[ieq].setSize(350,350)
}//enfr
colpanLb=new JPanel[7]
for(int kn=0kn<7kn++){
colpanLb[kn]=new JPanel()
colpanLb[kn].setPreferredSize(new Dimension(20,350))
colpanLb[kn].setMinimumSize(new Dimension(20,350))
if(kn==0){
colpanLb[kn].setBackground(new Color(255,0,0))
}else if(kn==1){
colpanLb[kn].setBackground(new Color(0,255,0))
}else if(kn==2){
colpanLb[kn].setBackground(new Color(0,0,255))
}else if(kn==3){
colpanLb[kn].setBackground(new Color(255,255,0))
}else if(kn==4){
colpanLb[kn].setBackground(new Color(255,0,255))
}else if(kn==5){
colpanLb[kn].setBackground(new Color(0,255,255))
}else if(kn==6){
colpanLb[kn].setBackground(new Color(255,255,255))
}else{}
}//enfr

int counter=0
imgBands=new JPanel[7]
for(int ieq=0ieq<7ieq++){ //ad4toeachofthesevenrows
imgBands[ieq]=new JPanel()
imgBands[ieq].setPreferredSize(new Dimension(1520,380))
imgBands[ieq].setMinimumSize(new Dimension(1520,380))
imgBands[ieq].setBackground(new Color(0,0,0))
//imgBands[ieq].setSize(1520,300)
imgBands[ieq].add(colpanLb[ieq])
imgBands[ieq].add(imgBandsets[counter])counter+=1
imgBands[ieq].add(imgBandsets[counter])counter+=1
imgBands[ieq].add(imgBandsets[counter])counter+=1
imgBands[ieq].add(imgBandsets[counter])counter+=1
}//enfr
//
insetV = new JPanel()
for(int gd=0gd<7gd++){
insetV.add(imgBands[gd])
}//enfr
insetV.setPreferredSize(new Dimension(1520,3000)) //OR.setSize(800,700)ifitdidn'tlikethat
insetV.setMaximumSize(new Dimension(1520,3000))
insetV.setBackground(new Color(0,0,0))
viPw=new JViewport()
viPw.setView(insetV)
//
boardScr=new JScrollPane(viPw,22,32)
boardScr.setBackground(new Color(0,0,0))
boardScr.setSize(800,700)
//
mpan.add(boardScr,BorderLayout.CENTER)
mpan.setSize(800,700)
mpan.setBackground(new Color(0,0,0))
//
getContentPane().add(mpan)
setIgnoreRepaint(false)
setAlwaysOnTop(true)
setLocation(100,100)
//setVisible(true)
//////////////////////////////////////////////////TESTMETHODPLACINGONLY
procede(upndwn)
}//enconstr
//
private boolean mkFlagUpDwn(boolean kli){
updnFlg=kli
return updnFlg
}
//
public void procede(boolean mUD){
mkFlagUpDwn(mUD) //placetheglobalflag
//processgoesinonedirectionCOMPLETELYeachtime(NOTbothbutoneofeitherupanddownstipulatedbyuserGUIbutton)
int rgbClr=0
int rgbC2=0
int all=1 //allimagesto28
int ko=0
try{
for(int cv=0cv<7cv++){ //valsColorsets={"R","G","B","RG","RB","GB","W"}
ko=0
while(ko < 4){
all++
makePixel(((WritableRaster)(setBu[all].getData())),cv,all,vals[ko],mUD) //booleanmoveUDandmUDuserdictatedforup/downbybutton
String prfxUpDwn=""
if(mUD==true){
prfxUpDwn="RGBUP"
}else{
prfxUpDwn="RGBDOWN"
}
if(all<4){
rgbVals[all]+=prfxUpDwn+":Red:{"+vals[ko]+"}"
//rgbValsUP[all]rgbValsDWN[all]
}else if(all>3 && all<8){
rgbVals[all]+=prfxUpDwn+":Green:{"+vals[ko]+"}"
}else if(all>7 && all<12){
rgbVals[all]+=prfxUpDwn+":Blue:{"+vals[ko]+"}"
}else if(all>11 && all<16){
rgbVals[all]+=prfxUpDwn+":Red:Green:{"+vals[ko]+","+vals[ko]+"}"
}else if(all>15 && all<20){
rgbVals[all]+=prfxUpDwn+":Red:Blue:{"+vals[ko]+","+vals[ko]+"}"
}else if(all>19 && all<24){
rgbVals[all]+=prfxUpDwn+":Green:Blue:{"+vals[ko]+","+vals[ko]+"}"
}else if(all>23 && all<28){
rgbVals[all]+=prfxUpDwn+":Red:Green:Blue:{"+vals[ko]+","+vals[ko]+","+vals[ko]+"}"
}else{}
ko+=1
}//frWH
}//enfr
}catch(Exception ifels){
System.out.println(ifels.getMessage())
}finally{}
}//enmeth

//intwidt
//inthitt
//intrgbClr,either0,1,2(R,G,B)corespondenttotheint[]rgbPpixelCOLOURVALUESarrayfromgetPixel(,,)
//intimgNumber,theJLabelandBufferedimagecorespondentindex
//intincrQUpDowntheindexofthevals[]soringthesetofproducedvaluesperlineofimages
//intrgbC2isonlyoneofpairedindex
public void makePixel(WritableRaster razzz,int cv,int imgNumber,int incrQUpDown,boolean moveUD){
//rgbClr[0,1,2]
int[] rgbP={0,0,0,0}
int wwwid=0
int rgbClr=0
int rgbC2=0
if(cv==0){ //valsColorsets[cv].equals("R")==true)
rgbClr=0
}else if(cv==1){ //valsColorsets[cv].equals("G")==true
rgbClr=1
}else if(cv==2){ //valsColorsets[cv].equals("B")==true
rgbClr=2
}else if(cv==3){ //valsColorsets[cv].equals("RG")==true
rgbClr=0rgbC2=1
}else if(cv==4){ //valsColorsets[cv].equals("RB")==true
rgbClr=0rgbC2=2
}else if(cv==5){ //valsColorsets[cv].equals("GB")==true
rgbClr=1rgbC2=2
}else{}
/*
seeelse{}!!!!warninglastsetareautoassignedASLITERALS
valsColorsets={"R","G","B","W","RG","RB","GB"}
*/
for(int hup=0hup<hitthup++){
wwwid=0
while(wwwid<widt){
razzz.getPixel(wwwid,hup,rgbP)
if(moveUD==true){
if(imgNumber<12){
rgbP[rgbClr]+=incrQUpDown
}
if((imgNumber>11) && (imgNumber<24)){
rgbP[rgbClr]+=incrQUpDown
rgbP[rgbC2]+=incrQUpDown
}else if(imgNumber>23){
rgbP[0]+=incrQUpDown
rgbP[1]+=incrQUpDown
rgbP[2]+=incrQUpDown
}else{}
}else{
if(imgNumber<12){
rgbP[rgbClr]=incrQUpDown
}
if((imgNumber>11) && (imgNumber<24)){
rgbP[rgbClr]=incrQUpDown
rgbP[rgbC2]=incrQUpDown
}else if(imgNumber>23){
rgbP[0]=incrQUpDown
rgbP[1]=incrQUpDown
rgbP[2]=incrQUpDown
}else{}
}//enifelsupdownboolean
//checktheimagecanberenderedumerically
for(int nmbChk=0nmbChk<4nmbChk++){
if(rgbP[nmbChk]>255){
rgbP[nmbChk]=255
}else if(rgbP[nmbChk]<0){
rgbP[nmbChk]=0
}else{}
}//enfr
razzz.setPixel(wwwid,hup,rgbP)
wwwid++
}//enwhl
}//enfr
//System.out.println("imgNumber:"+imgNumber)
setBu[imgNumber].setData(razzz)
imgLabelsets[imgNumber].repaint()
//System.out.println("======================ENDPROCEDE===========================")
}//enmeth

void disncusnButt(boolean boot){


spcan.disnableButtons(boot)
}//enmeth
public void mouseClicked(java.awt.event.MouseEvent ek){
disncusnButt(false)
if(ek.isPopupTrigger()==false){
//rgbValsUP[all]rgbValsDWN[all]
String snme = ek.getComponent().getName()
int vg=new Integer(snme).intValue()
//JOptionPane.showMessageDialog(newJFrame(),""+snme)
JFrame frame=new JFrame()
//intchose=JOptionPane.showInternalConfirmDialog(frame,("SetColourValues:"+snme+"OnMainImage?"),"PreSelectorImage",JOptionPane.YES_NO_OPTION)//((Object){"SetOnMainImage","Nuh'"})
Object[] options = {"UseColours","Cancel"}
int idxA=0
idxA=rgbVals[vg].indexOf("{")
idxA+=1
int snmL=rgbVals[vg].length()
String[] triset={"","",""}
String trist=null
trist=""
int chose=JOptionPane.showOptionDialog(frame,("SetColourValues:"+rgbVals[vg]+"OnMainImage?"),("PreSelectorImage"+snme),JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1])
if(chose==0){ //callsidewinderhere
this.setVisible(true)
//
String qbrd = "Quickboard:"
String updnCo=""
String colour=""
if(vg<4){ //vals{3,5,8,12}

Page 17 / 32

String[] triset={"","",""}
String trist=null
trist=""
int chose=JOptionPane.showOptionDialog(frame,("SetColourValues:"+rgbVals[vg]+"OnMainImage?"),("PreSelectorImage"+snme),JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[1])
if(chose==0){ //callsidewinderhere
this.setVisible(true)
//
String qbrd = "Quickboard:"
String updnCo=""
String colour=""
if(vg<4){ //vals{3,5,8,12}
////////////////====================trist=eitherrgbValsUP[vg]ordownversion//quickcolourboardqbourdColoffsqbourdColoffl(
trist=rgbVals[vg].substring(idxA,(snmL1))
colour="RED:"
if(upndwn==true){ //upistrueofboth
spcan.qbourdColoffs(true,false,0,new Integer(trist).intValue())
updnCo="UP:"+new Integer(trist).intValue()
}else{
spcan.qbourdColoffs(false,false,0,new Integer(trist).intValue())
updnCo="DOWN:"+new Integer(trist).intValue()
}
//spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else if(vg>3 && vg<8){
trist=rgbVals[vg].substring(idxA,(snmL1))
colour="GREEN:"
if(upndwn==true){
spcan.qbourdColoffs(true,false,1,new Integer(trist).intValue())
updnCo="UP:"+new Integer(trist).intValue()
}else{
spcan.qbourdColoffs(false,false,1,new Integer(trist).intValue())
updnCo="DOWN:"+new Integer(trist).intValue()
}
//spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else if(vg>7 && vg<12){
trist=rgbVals[vg].substring(idxA,(snmL1))
colour="BLUE:"
if(upndwn==true){
spcan.qbourdColoffs(true,false,2,new Integer(trist).intValue())
updnCo="UP:"+new Integer(trist).intValue()
}else{
spcan.qbourdColoffs(false,false,2,new Integer(trist).intValue())
updnCo="DOWN:"+new Integer(trist).intValue()
}
//spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else if(vg>11 && vg<16){
trist=rgbVals[vg].substring(idxA,(snmL1))
triset=trist.split(",")
colour="RED,GREEN:"
if(upndwn==true){
spcan.qbourdColoffs(true,false,0,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(true,false,1,new Integer(triset[1]).intValue())
updnCo="UP:"+new Integer(triset[0]).intValue()
}else{
spcan.qbourdColoffs(false,false,0,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(false,false,1,new Integer(triset[1]).intValue())
updnCo="DOWN:"+new Integer(triset[0]).intValue()
}
//spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else if(vg>15 && vg<20){
trist=rgbVals[vg].substring(idxA,(snmL1))
triset=trist.split(",")
colour="RED,BLUE:"
if(upndwn==true){
spcan.qbourdColoffs(true,false,0,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(true,false,2,new Integer(triset[1]).intValue())
updnCo="UP:"+new Integer(triset[0]).intValue()
}else{
spcan.qbourdColoffs(false,false,0,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(false,false,2,new Integer(triset[1]).intValue())
updnCo="DOWN:"+new Integer(triset[0]).intValue()
}
//spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else if(vg>19 && vg<24){
trist=rgbVals[vg].substring(idxA,(snmL1))
triset=trist.split(",")
colour="BLUE,GREEN:"
if(upndwn==true){
spcan.qbourdColoffs(true,false,1,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(true,false,2,new Integer(triset[1]).intValue())
updnCo="UP:"+new Integer(triset[0]).intValue()
}else{
spcan.qbourdColoffs(false,false,0,new Integer(triset[0]).intValue())
spcan.qbourdColoffs(false,false,2,new Integer(triset[1]).intValue())
updnCo="DOWN:"+new Integer(triset[0]).intValue()
}
//
spcan.metaPne.append(qbrd+colour+updnCo+linesep)
//WHITEUPDOWNQUICKBOARD
}else if(vg>23 && vg<28){
trist=rgbVals[vg].substring(idxA,(snmL1))
triset=trist.split(",")
colour="RED,GREEN,BLUE>(WHITE):"
if(upndwn==true){
spcan.qbourdColoffl(true,true,0,new Integer(triset[0]).intValue())
updnCo="UP:"+new Integer(triset[0]).intValue()
}else{
spcan.qbourdColoffl(false,true,0,new Integer(triset[0]).intValue())
updnCo="DOWN:"+new Integer(triset[0]).intValue()
}
spcan.metaPne.append(qbrd+colour+updnCo+linesep)
}else{}

//spcan.tpn.setSize(newDimension(spcan.bumi.getWidth(),spcan.bumi.getHeight()))
//spcan.tpn.setIcon(newImageIcon((Image)spcan.bumi))
//spcan.tpn.repaint()
//
if(spcan.oldrsZidx!=spcan.rsZidx){
spcan.makeImgRsz(spcan.rsZidx)
}//enif
spcan.tpn.repaint()
spcan.guiOpOccurPresent(false)
disncusnButt(true)
spcan.doGarbageClear()
this.dispose()
}else{}
spcan.doGarbageClear()
}//popuptrigger
} //
public void mousePressed(java.awt.event.MouseEvent ek){}
public void mouseReleased(java.awt.event.MouseEvent ek){}
public void mouseEntered(java.awt.event.MouseEvent ek){}
public void mouseExited(java.awt.event.MouseEvent ek){}
//publicvoidactionPerformed(ActionEventacvt){}//enactionperformedlistener
}//enclss
//=========================================================================================================================================================================================
class RGBchangeCoeffLinearTest{
SidewinderPhotoColourBalancer swinder
HueBoard hubbd
WritableRaster wras
int[] paramBalsettVals
double redcff = new Integer(0).doubleValue()
double greencff = new Integer(0).doubleValue()
double bluecff = new Integer(0).floatValue()
int rdnow
int grnow
int blnow
int cf
//
boolean boosetpass
boolean boopin
//
RGBchangeCoeffLinearTest(HueBoard hubbd,SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
boopin=false
boosetpass=true
wras = hubbd.bimbB.getRaster() //initallocpointonly
}//enconstr
RGBchangeCoeffLinearTest(HueBoard hubbd,SidewinderPhotoColourBalancer swinder,int[] paramBalsettVals){
this.hubbd=hubbd
this.swinder=swinder
this.paramBalsettVals=paramBalsettVals
boopin=true
boosetpass=false
wras = hubbd.bimbB.getRaster() //initallocpointonly
}//enconstr
int redNw(int rdi){
rdnow=(int)rdi
return rdnow
}
int greenNw(int gri){
grnow=(int)gri
return grnow
}
int blueNw(int bli){
blnow=(int)bli
return blnow
}
int colCF(int cin){
cf=(int)cin
return cf
}
double redFl(double rf){
redcff=(double)rf
return redcff
}
double greenFl(double gr){
greencff=(double)gr
return greencff
}
double blueFl(double bl){
bluecff=(double)bl
return bluecff
}
boolean setBoolSetpass(boolean blps){ //<
boosetpass=blps
return boosetpass
}//enmeth

void buildColourCalibrate(boolean asu,int hgst,int addecritive,double redfloat,double greenfloat,double bluefloat){


//PREVENTCALIBRATIONCONFLICTOFBELOWZEROaddonaparisiticvaluetokeepdivisionabovezero
boolean underoverStatus=false
double pixval=new Double("0.0001").doubleValue() //<
try{

if(boopin==true){ //<
if(hgst==0){ //<
pixval=redfloat
}else if(hgst==1){
pixval=greenfloat
}else{
pixval=bluefloat
}
if((pixval > 240) && (pixval < 256)){ //(pixval>240)&&(pixval<256)
addecritive=paramBalsettVals[0]
setBoolSetpass(true)
}else if((pixval > 224) && (pixval < 241)){
addecritive=paramBalsettVals[1]
setBoolSetpass(true)
}else if((pixval > 208) && (pixval < 225)){
addecritive=paramBalsettVals[2]
setBoolSetpass(true)
}else if((pixval > 192) && (pixval < 209)){
addecritive=paramBalsettVals[3]
setBoolSetpass(true)
}else if((pixval > 176) && (pixval < 193)){
addecritive=paramBalsettVals[4]
setBoolSetpass(true)
}else if((pixval > 160) && (pixval < 177)){
addecritive=paramBalsettVals[5]
setBoolSetpass(true)
}else if((pixval > 144) && (pixval < 161)){
addecritive=paramBalsettVals[6]
setBoolSetpass(true)
}else if((pixval > 128) && (pixval < 145)){
addecritive=paramBalsettVals[7]
setBoolSetpass(true)
}else if((pixval > 112) && (pixval < 129)){
addecritive=paramBalsettVals[8]
setBoolSetpass(true)
}else if((pixval > 96) && (pixval < 113)){
addecritive=paramBalsettVals[9]
setBoolSetpass(true)
}else if((pixval > 80) && (pixval < 97)){
addecritive=paramBalsettVals[10]
setBoolSetpass(true)
}else if((pixval > 64) && (pixval < 81)){
addecritive=paramBalsettVals[11]
setBoolSetpass(true)
}else if((pixval > 48) && (pixval < 65)){
addecritive=paramBalsettVals[12]
setBoolSetpass(true)
}else if((pixval > 32) && (pixval < 49)){
addecritive=paramBalsettVals[13]
setBoolSetpass(true)
}else if((pixval > 16) && (pixval < 33)){
addecritive=paramBalsettVals[14]
setBoolSetpass(true)
}else if((pixval > 1) && (pixval < 17)){
addecritive=paramBalsettVals[15]
setBoolSetpass(true)
}else{
setBoolSetpass(false)
}

}//endparamvalifboopin

Page 18 / 32

addecritive=paramBalsettVals[14]
setBoolSetpass(true)
}else if((pixval > 1) && (pixval < 17)){
addecritive=paramBalsettVals[15]
setBoolSetpass(true)
}else{
setBoolSetpass(false)
}

}//endparamvalifboopin

if(boosetpass==true){ //<
redfloat+=257D
greenfloat+=257D
bluefloat+=257D

if(hgst==0){
greenFl((greenfloat/redfloat))
blueFl((bluefloat/redfloat))
if(asu==true){
colCF((new Double(redfloat).intValue())+addecritive)
}else{
colCF((new Double(redfloat).intValue())addecritive)
}
redNw(cf)
greenNw((new Double(((new Integer(cf).doubleValue())*greencff)).intValue())257)
blueNw((new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())257)
redNw(cf257)
}else if(hgst==1){
redFl((redfloat/greenfloat))
blueFl((bluefloat/greenfloat))
if(asu==true){
colCF((new Double(greenfloat).intValue())+addecritive)
}else{
colCF((new Double(greenfloat).intValue())addecritive)
}
greenNw(cf)
redNw((new Double(((new Integer(cf).doubleValue())*redcff)).intValue())257)
blueNw((new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())257)
greenNw(cf257)
}else{//hgst==2
redFl((redfloat/bluefloat))
greenFl((greenfloat/bluefloat))
if(asu==true){
colCF((new Double(bluefloat).intValue())+addecritive)
}else{
colCF((new Double(bluefloat).intValue())addecritive)
}
blueNw(cf)
redNw((new Double(((new Integer(cf).doubleValue())*redcff)).intValue())257)
greenNw((new Double(((new Integer(cf).doubleValue())*greencff)).intValue())257)
blueNw(cf257)//PREVENTCALIBRATIONCONFLICTOFBELOWZEROremovalparisiticvalue
}

if(boopin==true){
//RESETBOOPASSfornext//<
setBoolSetpass(false)
}
}else{//<
redNw(new Double(redfloat).intValue())
greenNw(new Double(greenfloat).intValue())
blueNw(new Double(bluefloat).intValue())
//boosetpassmustbecontinuallytrueiftheoverallgammaisbeingused//if(boopin==true){//RESETBOOPASSfornext//<//setBoolSetpass(false)//}
}//boosetpass
}catch(Exception exa){
swinder.stackExPasthru((Throwable)exa)
}finally{}
}//enmeth
//WritableRastersetImageRaster(){
//wras=swinder.bumi.getRaster()
//returnwras
//}
WritableRaster setImageRaster(){ //SidewinderPhotoColourBalancerswinder
wras = hubbd.bimbB.getRaster()
return wras
}
void changePixelsInRaster(boolean updown,boolean coeffreq,int arrcolnumber,int addecritive){ //up=truedown=false
//disnableButtons(false)
//
int wd = wras.getWidth()
int ht = wras.getHeight()
int alng=0
int pixval=0
int pixvalG=0
int pixvalB=0
//intalngPVal=0
while(alng<ht){
for(int a=0a<wda++){
int[] pxlarr=new int[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
//
pxlarr=wras.getPixel(a,alng,pxlarr)
//addecritivemustbemodifiedhere
int hgst=1

if(coeffreq==true){
//======================================TOBECOMEAMETHODTOREMOVEEXCESSCODETOSET"inthgst"
if(hgst==1){
hgst=hgstSetter(pxlarr[0],pxlarr[1],pxlarr[2])
buildColourCalibrate(updown,hgst,addecritive,(new Integer(pxlarr[0]).doubleValue()),(new Integer(pxlarr[1]).doubleValue()),(new Integer(pxlarr[2]).doubleValue()))
}//enifhgsttest
}//endifcooeffrequired
if((addecritive > 0) && (addecritive < 256)){ //partoftheMANUALISEDfillincheckoftextfield
if(coeffreq==true){
pixval=rdnow
pixvalG=grnow
pixvalB=blnow
}

//anditshouldbe

if((pixval < 256)&&(pixval > 1)){


pxlarr[0]=pixval
}else{
if(pixval > 255){
pxlarr[0]=255
}else{
pxlarr[0]=0
}//enels
}//enels
if((pixvalG < 256)&&(pixvalG > 1)){
pxlarr[1]=pixvalG
}else{
if(pixvalG > 255){
pxlarr[1]=255
}else{
pxlarr[1]=0
}//enels
}//enels
if((pixvalB < 256)&&(pixvalB > 1)){
pxlarr[2]=pixvalB
}else{
if(pixvalB > 255){
pxlarr[2]=255
}else{
pxlarr[2]=0
}//enels
}//enels
wras.setPixel(a,alng,pxlarr)
}else{
System.out.println("conditioninputnotmet:INCREMENT(ovstep<256)&&(ovstep>0)")
}
}//enfr
alng++
}//enwhl
}//enmeth

int hgstSetter(int redval,int greenval,int blueval){


int ahgst=1
String[] rgb={"R","G","B"}
int[] rgbVal=new int[3]
rgbVal[0]=redval
rgbVal[1]=greenval
rgbVal[2]=blueval
int swp=0
String swap
swap=""
//
while(((rgbVal[2]<rgbVal[1])||(rgbVal[2]<rgbVal[0]))&&((rgbVal[2]!=rgbVal[1])&&(rgbVal[1]!=rgbVal[0]))){

//notrequired&&(rgbVal[1]<rgbVal[0]))

if(rgbVal[0]>rgbVal[1]){
swp=rgbVal[0]
rgbVal[0]=rgbVal[1]
rgbVal[1]=swp
swap=rgb[0]
rgb[0]=rgb[1]
rgb[1]=swap
}//enif
if(rgbVal[1]>rgbVal[2]){
swp=rgbVal[1]
rgbVal[1]=rgbVal[2]
rgbVal[2]=swp
swap=rgb[1]
rgb[1]=rgb[2]
rgb[2]=swap
}//enif

}//enwhl
if(rgb[2].equals("R")){
ahgst=0
}else if(rgb[2].equals("G")){
ahgst=1
}else{ //"B"
ahgst=2
}
return ((int)ahgst)
}

}//enclss
//========================================================================

//======================================
class RGBchangeCoeffLinear{
SidewinderPhotoColourBalancer swinder
int[] paramBalsettVals
double redcff = new Integer(0).doubleValue()
double greencff = new Integer(0).doubleValue()
double bluecff = new Integer(0).floatValue()
int rdnow
int grnow
int blnow
int cf
//
boolean boosetpass
boolean boopin
//
RGBchangeCoeffLinear(SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
boopin=false
boosetpass=true
swinder.work.makeParamWork(swinder.bumi.getHeight())
swinder.work.reshower()
}//enconstr
RGBchangeCoeffLinear(SidewinderPhotoColourBalancer swinder,int[] paramBalsettVals){
this.swinder=swinder
this.paramBalsettVals=paramBalsettVals
boopin=true
boosetpass=false
swinder.work.makeParamWork(swinder.bumi.getHeight())
swinder.work.reshower()
}//enconstr
int redNw(int rdi){
rdnow=(int)rdi
return rdnow
}
int greenNw(int gri){
grnow=(int)gri
return grnow
}
int blueNw(int bli){
blnow=(int)bli
return blnow
}
int colCF(int cin){
cf=(int)cin
return cf
}
double redFl(double rf){
redcff=(double)rf

Page 19 / 32

int blueNw(int bli){


blnow=(int)bli
return blnow
}
int colCF(int cin){
cf=(int)cin
return cf
}
double redFl(double rf){
redcff=(double)rf
return redcff
}
double greenFl(double gr){
greencff=(double)gr
return greencff
}
double blueFl(double bl){
bluecff=(double)bl
return bluecff
}
boolean setBoolSetpass(boolean blps){ //<
boosetpass=blps
return boosetpass
}//enmeth

void buildColourCalibrate(boolean asu,int hgst,int addecritive,double redfloat,double greenfloat,double bluefloat){


//PREVENTCALIBRATIONCONFLICTOFBELOWZEROaddonaparisiticvaluetokeepdivisionabovezero
boolean underoverStatus=false
double pixval=new Double("0.0001").doubleValue() //<

if(boopin==true){ //<
if(hgst==0){ //<
pixval=redfloat
}else if(hgst==1){
pixval=greenfloat
}else{
pixval=bluefloat
}
if((pixval > 240) && (pixval < 256)){ //(pixval>240)&&(pixval<256)
addecritive=paramBalsettVals[0]
setBoolSetpass(true)
}else if((pixval > 224) && (pixval < 241)){
addecritive=paramBalsettVals[1]
setBoolSetpass(true)
}else if((pixval > 208) && (pixval < 225)){
addecritive=paramBalsettVals[2]
setBoolSetpass(true)
}else if((pixval > 192) && (pixval < 209)){
addecritive=paramBalsettVals[3]
setBoolSetpass(true)
}else if((pixval > 176) && (pixval < 193)){
addecritive=paramBalsettVals[4]
setBoolSetpass(true)
}else if((pixval > 160) && (pixval < 177)){
addecritive=paramBalsettVals[5]
setBoolSetpass(true)
}else if((pixval > 144) && (pixval < 161)){
addecritive=paramBalsettVals[6]
setBoolSetpass(true)
}else if((pixval > 128) && (pixval < 145)){
addecritive=paramBalsettVals[7]
setBoolSetpass(true)
}else if((pixval > 112) && (pixval < 129)){
addecritive=paramBalsettVals[8]
setBoolSetpass(true)
}else if((pixval > 96) && (pixval < 113)){
addecritive=paramBalsettVals[9]
setBoolSetpass(true)
}else if((pixval > 80) && (pixval < 97)){
addecritive=paramBalsettVals[10]
setBoolSetpass(true)
}else if((pixval > 64) && (pixval < 81)){
addecritive=paramBalsettVals[11]
setBoolSetpass(true)
}else if((pixval > 48) && (pixval < 65)){
addecritive=paramBalsettVals[12]
setBoolSetpass(true)
}else if((pixval > 32) && (pixval < 49)){
addecritive=paramBalsettVals[13]
setBoolSetpass(true)
}else if((pixval > 16) && (pixval < 33)){
addecritive=paramBalsettVals[14]
setBoolSetpass(true)
}else if((pixval > 1) && (pixval < 17)){
addecritive=paramBalsettVals[15]
setBoolSetpass(true)
}else{
setBoolSetpass(false)
}

}//endparamvalifboopin

if(boosetpass==true){ //<
redfloat+=257D
greenfloat+=257D
bluefloat+=257D

if(hgst==0){
greenFl((greenfloat/redfloat))
blueFl((bluefloat/redfloat))
if(asu==true){
colCF((new Double(redfloat).intValue())+addecritive)
}else{
colCF((new Double(redfloat).intValue())addecritive)
}
redNw(cf)
greenNw((new Double(((new Integer(cf).doubleValue())*greencff)).intValue())257)
blueNw((new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())257)
redNw(cf257)
}else if(hgst==1){
redFl((redfloat/greenfloat))
blueFl((bluefloat/greenfloat))
if(asu==true){
colCF((new Double(greenfloat).intValue())+addecritive)
}else{
colCF((new Double(greenfloat).intValue())addecritive)
}
greenNw(cf)
redNw((new Double(((new Integer(cf).doubleValue())*redcff)).intValue())257)
blueNw((new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())257)
greenNw(cf257)
}else{//hgst==2
redFl((redfloat/bluefloat))
greenFl((greenfloat/bluefloat))
if(asu==true){
colCF((new Double(bluefloat).intValue())+addecritive)
}else{
colCF((new Double(bluefloat).intValue())addecritive)
}
blueNw(cf)
redNw((new Double(((new Integer(cf).doubleValue())*redcff)).intValue())257)
greenNw((new Double(((new Integer(cf).doubleValue())*greencff)).intValue())257)
blueNw(cf257)//PREVENTCALIBRATIONCONFLICTOFBELOWZEROremovalparisiticvalue
}

if(boopin==true){
//RESETBOOPASSfornext//<
setBoolSetpass(false)
}//enif
}else{//<
redNw(new Double(redfloat).intValue())
greenNw(new Double(greenfloat).intValue())
blueNw(new Double(bluefloat).intValue())
//boosetpassmustbecontinuallytrueiftheoverallgammaisbeingused
//if(boopin==true){
//RESETBOOPASSfornext//<
//setBoolSetpass(false)
//}
}//boosetpass

}//enmeth

void changePixelsInRaster(boolean updown,boolean coeffreq,int arrcolnumber,int addecritive){ //up=truedown=false


//
int wd = (int)swinder.bumi.getWidth()
int ht = (int)swinder.bumi.getHeight()
int alng=0
int pixval=0
int pixvalG=0
int pixvalB=0
//
while(alng<ht){
for(int a=0a<wda++){
//addecritivemustbemodifiedhere
int hgst=1
//
if(coeffreq==true){
//======================================TOBECOMEAMETHODTOREMOVEEXCESSCODETOSET"inthgst"
if(hgst==1){
hgst=hgstSetter((new Short(swinder.red_Overstep[alng][a]).intValue()),(new Short(swinder.green_Overstep[alng][a]).intValue()),(new Short(swinder.blue_Overstep[alng][a]).intValue()))
buildColourCalibrate(updown,hgst,addecritive,(new Short(swinder.red_Overstep[alng][a]).floatValue()),(new Short(swinder.green_Overstep[alng][a]).floatValue()),(new Short(swinder.blue_Overstep[alng][a]).floatValue()))
}//enifhgsttest
}//endifcooeffrequired
if(coeffreq==true){ //anditshouldbe
pixval=rdnow
swinder.redsetPix(alng,a,pixval)
pixvalG=grnow
swinder.greensetPix(alng,a,pixvalG)
pixvalB=blnow
swinder.bluesetPix(alng,a,pixvalB)
}
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
alng++
}//enwhl
swinder.work.resetIncreval()
//
}//enmeth
int hgstSetter(int redval,int greenval,int blueval){
int ahgst=1
String[] rgb={"R","G","B"}
int[] rgbVal=new int[3]
rgbVal[0]=redval
rgbVal[1]=greenval
rgbVal[2]=blueval
int swp=0
String swap
swap=""
//
while(((rgbVal[2]<rgbVal[1])||(rgbVal[2]<rgbVal[0]))&&((rgbVal[2]!=rgbVal[1])&&(rgbVal[1]!=rgbVal[0]))){

//notrequired&&(rgbVal[1]<rgbVal[0]))

if(rgbVal[0]>rgbVal[1]){
swp=rgbVal[0]
rgbVal[0]=rgbVal[1]
rgbVal[1]=swp
swap=rgb[0]
rgb[0]=rgb[1]
rgb[1]=swap
}//enif
if(rgbVal[1]>rgbVal[2]){
swp=rgbVal[1]
rgbVal[1]=rgbVal[2]
rgbVal[2]=swp
swap=rgb[1]
rgb[1]=rgb[2]
rgb[2]=swap
}//enif

}//enwhl
if(rgb[2].equals("R")){
ahgst=0
}else if(rgb[2].equals("G")){
ahgst=1
}else{ //"B"
ahgst=2
}
return ((int)ahgst)
}

}//enclss
//========================================================================

//======================================
class RGBchangeCoeffLinearSingle{
SidewinderPhotoColourBalancer swinder
int cf
//
RGBchangeCoeffLinearSingle(SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
swinder.work.makeParamWork(swinder.bumi.getHeight())
swinder.work.reshower()
}//enconstr

Page 20 / 32

//======================================
class RGBchangeCoeffLinearSingle{
SidewinderPhotoColourBalancer swinder
int cf
//
RGBchangeCoeffLinearSingle(SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
swinder.work.makeParamWork(swinder.bumi.getHeight())
swinder.work.reshower()
}//enconstr
void changePixelsInRaster(boolean updown,boolean coeffreq,int arrcolnumber,int addecritive){ //up=truedown=falseNOTREQUUIREDINTHIS>booleancoeffreq
int wd = swinder.bumi.getWidth()
int ht = swinder.bumi.getHeight()
int alng=0
int pixval=0
//
if(updown==true){ //INCREMENT
while(alng<ht){
for(int a=0a<wda++){
/*REDUNDANT2014
int[]pxlarr=newint[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
pxlarr=wras.getPixel(a,alng,pxlarr)
*/
if(arrcolnumber==0){ //red
pixval=((new Short(swinder.red_Overstep[alng][a]).intValue())+addecritive)
swinder.redsetPix(alng,a,pixval)
}else if(arrcolnumber==1){ //green
pixval=((new Short(swinder.green_Overstep[alng][a]).intValue())+addecritive)
swinder.greensetPix(alng,a,pixval)
}else if(arrcolnumber==2){//blue{//blue
pixval=((new Short(swinder.blue_Overstep[alng][a]).intValue())+addecritive)
swinder.bluesetPix(alng,a,pixval)
}else{}
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
alng++
}//enwhl
}else{ //DECREMENT====================================================================
//
while(alng<ht){
for(int a=0a<wda++){
//
if(arrcolnumber==0){ //red
pixval=((new Short(swinder.red_Overstep[alng][a]).intValue())addecritive)
swinder.redsetPix(alng,a,pixval)
}else if(arrcolnumber==1){ //green
pixval=((new Short(swinder.green_Overstep[alng][a]).intValue())addecritive)
swinder.greensetPix(alng,a,pixval)
}else if(arrcolnumber==2){//blue
pixval=((new Short(swinder.blue_Overstep[alng][a]).intValue())addecritive)
swinder.bluesetPix(alng,a,pixval)
}else{}
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
alng++
}//enwhl
}//enifels
//
swinder.work.resetIncreval()
//
}//enmeth
}//enclss
//========================================================================

//===========================================HueBoardclass
//NOTETODOCHANGETHE"contrast"CHECKBOXTOJCOMBOBOXANDADDMOREALGORITHMSWITHEQUALOPPOSITES(NUMERICBACKUPARRAYSYSTEMNEEDSRESYNCAFTERTOKEEPTRUELEVELS)
class HueBoard extends JFrame implements ActionListener,javax.swing.event.ChangeListener{
//implementsActionListener
SidewinderPhotoColourBalancer sidewinder
RGBchangeCoeffLinearGammaTest rgbgamm
RGBchangeCoeffLinearSingleHueTest rgbtest
RGBchangeCoeffLinearTest rgbWhtest
BufferedImage bimb,bimbB
int wdI=0
int htI=0
JScrollPane sropan
JViewport porter
JLabel showimage
JPanel[] viewset
JCheckBox[] colbox
JCheckBox gammbox,chkwhtclbg //rgbgammaandcontrast
JCheckBox whitebox //gammBandbx,
JPanel boxmntpan
JSlider[] parameterBalsett
JTextField paramGammTx
JSlider parameterGamm
JTextField[] paramTxFl
JComboBox jcocolbx,gamjcocolbx
JButton[] activbutt //"apply""test"???"undolast"
JPanel bttpnl
Image bmiresiz
ImageIcon repeatIco
int[] paramBalsettVals={10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10} //16xSETofvaluestopasstotheprocessorclassforthebandsetting
final String[] gammCoeffs = {"1.10","1.20","1.30","1.40","1.50","1.60","1.70","1.80","1.90","2.00","2.10","2.20","2.30","2.40"}
final String[] gammCoeffsDown = {"0.909","0.833","0.769","0.714","0.667","0.624","0.588","0.555","0.526","0.499","0.476","0.454","0.434","0.416"}
final String linsp=System.getProperty("line.separator")
//CONSTRUCTORSTART
HueBoard(SidewinderPhotoColourBalancer sidewinder){
super("SidewinderHueBoard")
this.sidewinder=sidewinder
remakeBimb()
repeatIco=new ImageIcon(bimb)
bimbB=new BufferedImage(bimb.getWidth(),bimb.getHeight(),bimb.getType())
repeatImg()
//
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
disncusnButt(true) //sidewinder.disnableButtons(false)
}
})
viewPanMaker()
//
parameterSlideBuild()
//
paramGammTx=new JTextField("0",5)
paramGammTx.setEditable(false)
parameterGamm=new JSlider(0,0,13,0)
//orinet,min,max,val
parameterGamm.setPreferredSize(new Dimension(280,40))
parameterGamm.setPaintTicks(true)
parameterGamm.setPaintTrack(true)
parameterGamm.setSnapToTicks(true)
parameterGamm.setMajorTickSpacing(3)
parameterGamm.setMinorTickSpacing(1)
parameterGamm.setIgnoreRepaint(false)
parameterGamm.addChangeListener(this)
parameterGamm.setName("gammaslider")
//!!!!!!!!THISMUSTBEDONEINAMETHODFORALISTENERFORTHEUSERTOCHOOSETHECOLOURIFELSEHEREFORRED,GREEN,BLUEFROMALISTENER
((Component)parameterGamm).setBackground(new Color(150,150,150))
((Component)parameterGamm).setForeground(new Color(200,200,200))
//parameterGammsetdisableddownnearsetVisible()
viewset[0].setPreferredSize(new Dimension(1190,800))
viewset[0].setMinimumSize(new Dimension(1190,800))
showimage=new JLabel(repeatIco)
showimage.setBackground(new Color(255,255,255))
showimage.setSize(wdI,htI)
//sizeshouldbethesizeofthesentbufferedimage
//gammBandbx=newJCheckBox("GBanded")
colbox=new JCheckBox[3]
colbox[0]=new JCheckBox("RED",false)
colbox[0].setToolTipText("16bandRGBfilterREDonly")
colbox[0].setName("redbox")
colbox[0].addActionListener(this)
colbox[0].setActionCommand("REDBOX")
//addactionlistener
colbox[1]=new JCheckBox("GREEN",true)
colbox[1].setToolTipText("16bandRGBfilterGREENonly")
colbox[1].setName("greenbox")
colbox[1].addActionListener(this)
colbox[1].setActionCommand("GREENBOX")
colbox[2]=new JCheckBox("BLUE",false)
colbox[2].setToolTipText("16bandRGBfilterBLUEonly")
colbox[2].setName("bluebox")
colbox[2].addActionListener(this)
colbox[2].setActionCommand("BLUEBOX")
whitebox=new JCheckBox("WHITE",false)
whitebox.setToolTipText("16bandRGBfilterBrightDark(white)only")
whitebox.setName("whitebox")
whitebox.addActionListener(this)
whitebox.setActionCommand("WHITEBOX")
boxmntpan=new JPanel()
//boxmntpan.setPreferredSize(newDimension(400,30))
//boxmntpan.setMinimumSize(newDimension(400,30))
boxmntpan.setSize(new Dimension(400,40))
boxmntpan.setForeground(new Color(0,0,0))
viewset[1].setPreferredSize(new Dimension(400,800))
//viewset[1].setSize(newDimension(400,400))
//!!!!
Object[] upordown={"UP","DOWN"} //THISISALSOUSEDINgamjcocolbx
//!!!!
jcocolbx=new JComboBox(upordown)
jcocolbx.setToolTipText("16bandRGBfiltervakuesUPorDOWN")
jcocolbx.setEditable(false)
boxmntpan.add(jcocolbx)
boxmntpan.add(colbox[0])
boxmntpan.add(colbox[1])
boxmntpan.add(colbox[2])
boxmntpan.add(whitebox)
viewset[1].add(boxmntpan)
for(int ce=0ce<16ce++){
viewset[1].add(parameterBalsett[ce])
viewset[1].add(paramTxFl[ce])
}//enfr
//viewset[1].add(parameterGamm)
//viewset[1].add(paramGammTx)
bttpnl=new JPanel()
bttpnl.setPreferredSize(new Dimension(450,65))
//
gamjcocolbx=new JComboBox(upordown)//upordownARRAYDECLAREDABOVE
gamjcocolbx.setToolTipText("Exposurecorrection(Gamma)ELSEContrastUPorDOWN")
gamjcocolbx.setEditable(false)
gammbox=new JCheckBox("RGB",false)
gammbox.setToolTipText("chooseFiltersorExposureContrast")
gammbox.setName("gammabox")
gammbox.addActionListener(this)
gammbox.setActionCommand("GAMMBOX")
chkwhtclbg = new JCheckBox("Contrast",false)
chkwhtclbg.setToolTipText("chooseExposure(Gamma)ORContrast")
chkwhtclbg.setEnabled(false)
chkwhtclbg.setName("contbox")
//chkwhtclbg.setFont(uifont)
viewset[1].setBackground(new Color(150,150,150))
viewset[2].setPreferredSize(new Dimension(600,800))
viewset[2].setBackground(new Color(150,150,150))
activbutt=new JButton[2]
activbutt[0]=new JButton(new ImageIcon(sidewinder.appiconsIMG[8])) //"TEST")
activbutt[0].setToolTipText("TryyoursettingExposurecorrection(Gamma)ELSEContrast")
activbutt[0].setPreferredSize(new Dimension(54,54))
activbutt[0].setSize(new Dimension(54,54))
activbutt[0].addActionListener(this)
activbutt[0].setActionCommand("TESTCOLFILT")
activbutt[1]=new JButton(new ImageIcon(sidewinder.appiconsIMG[7])) //"APPLY")
activbutt[1].setToolTipText("COMMITthesettingonthephotoGammaELSEContrast")
activbutt[1].setPreferredSize(new Dimension(54,54))
activbutt[1].setSize(new Dimension(54,54))
activbutt[1].addActionListener(this)
activbutt[1].setActionCommand("APPLYCOLFILT")
bttpnl.add(gamjcocolbx)
bttpnl.add(gammbox)
bttpnl.add(chkwhtclbg)
bttpnl.add(activbutt[0])
bttpnl.add(activbutt[1])
viewset[2].add(showimage)
viewset[2].add(bttpnl)
viewset[2].add(parameterGamm)
viewset[2].add(paramGammTx)
viewset[0].setLayout(new FlowLayout(0))
viewset[0].add(viewset[1])
viewset[0].add(viewset[2])
//
porter = new JViewport()
porter.setView(viewset[0])
sropan = new javax.swing.JScrollPane(porter,22,32) //v22h32
//
getContentPane().add(sropan)
//
try{
setIconImage(((Toolkit)this.getToolkit()).getImage((sidewinder.app_PATH)+System.getProperty("file.separator")+"Sidewinder32.gif"))
}catch(java.lang.Exception excaf1){
//NEEDTOSETUPTHEEXCEPTIONCLASSHERE
}finally{}
//WARNINGCANNOTDISABLEFROMINSIDECONSTRUCTORLISTENERSETTINGISANEXCEPTEDdisncusnButt(false)
//sidewinder.disnableButtons(false)
SwingUtilities.invokeLater(new Runnable(){
public void run(){
setDefaultCloseOperation(2)
setAlwaysOnTop(true)
setIgnoreRepaint(false)
setPreferredSize(new Dimension(1000,700))
setMinimumSize(new Dimension(1000,700))
setSize(new Dimension(1000,700))
pack()
setVisible(true)

Page 21 / 32

//WARNINGCANNOTDISABLEFROMINSIDECONSTRUCTORLISTENERSETTINGISANEXCEPTEDdisncusnButt(false)
//sidewinder.disnableButtons(false)
SwingUtilities.invokeLater(new Runnable(){
public void run(){
setDefaultCloseOperation(2)
setAlwaysOnTop(true)
setIgnoreRepaint(false)
setPreferredSize(new Dimension(1000,700))
setMinimumSize(new Dimension(1000,700))
setSize(new Dimension(1000,700))
pack()
setVisible(true)
}
})
parameterGamm.setEnabled(false)
//
}//enconstr

void viewPanMaker(){
viewset=new JPanel[3] //0capsule1left2right(JLabelinsidefortheimage)
for(int cz=0cz<3cz++){
viewset[cz]=new JPanel()
viewset[cz].setIgnoreRepaint(false)
//SIZINGSTODOHERE
}//enfr
}//enmeth
void parameterSlideBuild(){
parameterBalsett=new JSlider[16] //16BANDSx30
paramTxFl=new JTextField[16]
int colorint=255
String nmesl="slider"
String mknm=""
for(int ca=0ca<16ca++){
paramTxFl[ca]=new JTextField("0",2)
paramTxFl[ca].setEditable(false)
parameterBalsett[ca]=new JSlider(0,0,30,0)
//orinet,min,max,val
parameterBalsett[ca].setPreferredSize(new Dimension(300,40))
//parameterBalsett[ca].setSize(newDimension(300,5))
parameterBalsett[ca].setPaintTicks(true)
parameterBalsett[ca].setPaintTrack(true)
parameterBalsett[ca].setSnapToTicks(true)
parameterBalsett[ca].setMajorTickSpacing(5)
parameterBalsett[ca].setMinorTickSpacing(1)
parameterBalsett[ca].setForeground(new Color(255,255,255))
parameterBalsett[ca].setIgnoreRepaint(false)
parameterBalsett[ca].addChangeListener(this)
mknm=nmesl+ca
parameterBalsett[ca].setName(mknm)
//!!!!!!!!THISMUSTBEDONEINAMETHODFORALISTENERFORTHEUSERTOCHOOSETHECOLOURIFELSEHEREFORRED,GREEN,BLUEFROMALISTENER
parameterBalsett[ca].setBackground(new Color(0,colorint,0))
colorint=16
if(colorint<0){
colorint=0
}
}//enfr
} //enmeth

//method[]
int[] makeParamArrayValset(){
int[] passArr=new int[16]
for(int kj=0kj<16kj++){
passArr[kj]=parameterBalsett[kj].getValue()
}//enfr
paramBalsettVals=(int[])passArr
return paramBalsettVals
}//enmeth

void disncusnButt(boolean boot){


sidewinder.disnableButtons(boot)
}//enmeth
void repeatImg(){
bimbB.setData(bimb.getData())
}//enmeth
int gtHeight(int ht){
int htI=ht
return htI
}//enmeth

//gtHeight(intht)gtWdth(intwd)

int gtWdth(int wd){


wdI=wd
return wdI
}//enmeth
BufferedImage remakeBimb(){
int bumW=sidewinder.bumi.getWidth()
int bumH=sidewinder.bumi.getHeight()
int cf=0
if(bumW > bumH){
cf=(new Float(((new Integer(550).floatValue())/(new Integer(bumW).floatValue()))*(new Integer(bumH).floatValue())).intValue())
bmiresiz = sidewinder.bumi.getScaledInstance(550,cf,4)
bimb = new BufferedImage(550,cf,sidewinder.bumi.getType())
wdI=550
htI=cf
gtHeight(cf)
gtWdth(550)
}else{
cf=(new Float(((new Integer(550).floatValue())/(new Integer(bumH).floatValue()))*(new Integer(bumW).floatValue())).intValue())
bmiresiz = sidewinder.bumi.getScaledInstance(cf,550,4)
bimb = new BufferedImage(cf,550,sidewinder.bumi.getType())
wdI=cf
htI=550
//methodsifeverneeded
gtHeight(550)
gtWdth(cf)
}
//
Graphics tr = bimb.getGraphics()
tr.drawImage(bmiresiz,0,0,wdI,htI,null)
return bimb
}
public void actionPerformed(ActionEvent e){
disncusnButt(false)
if(e.getActionCommand().equals("GAMMBOX")){
//
if(gammbox.isSelected()==true){
parameterGamm.setEnabled(true)
chkwhtclbg.setEnabled(true)
gammbox.setText("GAMMA")
((Component)parameterGamm).setBackground(new Color(0,0,0))
((Component)parameterGamm).setForeground(new Color(255,255,255))
chkwhtclbg.repaint()
parameterGamm.repaint()
}else{
parameterGamm.setEnabled(false)
parameterGamm.setBackground(new Color(150,150,150))
parameterGamm.setForeground(new Color(200,200,200))
gammbox.setText("RGB")
chkwhtclbg.setSelected(false)
chkwhtclbg.setEnabled(false)
gammbox.repaint()
parameterGamm.repaint()
}
}else if((e.getActionCommand().equals("APPLYCOLFILT")) && (gammbox.isSelected()==true)){
sidewinder.RGBgammaSetterBoot()
//
int setting = ((int)parameterGamm.getValue())
//UPDOWNgammajcombo
String val = gamjcocolbx.getSelectedItem().toString()
boolean upgamm=true
String unip=null
unip=""
if(val.equals("DOWN")){
upgamm=false
unip="DOWN"
unip+=gammCoeffsDown[setting]+"(oppositeUpSetting:"+gammCoeffs[setting]+")"
}else{
unip="UP"
unip+=gammCoeffs[setting]+"(oppositeDownSetting:"+gammCoeffsDown[setting]+")"
}
boolean contra=true //WHETHERLINEARGAMMAORLOGARITHMIC(CONTRAST)
String gammCont = "CONTRAST"
if(chkwhtclbg.isSelected()==false){
gammCont = "GAMMA"
contra=false
}
sidewinder.callGamma(upgamm,true,setting,contra)
String qty=null
qty=""
//
qty+="::HueBoard::"+gammCont+"SET:"+unip+linsp
sidewinder.metaPne.append(qty)
//nulltheclassesRasterhereTODOamethod
disncusnButt(true)
sidewinder.doGarbageClear()
dispose()
}else if((e.getActionCommand().equals("TESTCOLFILT")) && (gammbox.isSelected()==true)){
repeatImg()
showimage.setIcon(new ImageIcon(bimbB))
showimage.setSize(new Dimension(bimbB.getWidth(),bimb.getHeight()))
showimage.repaint()
rgbgamm = new RGBchangeCoeffLinearGammaTest(this,sidewinder)
rgbgamm.setImageRaster()
//UPDOWNgammajcombo
String val = gamjcocolbx.getSelectedItem().toString()
boolean upgamm=true
if(val.equals("DOWN")){
upgamm=false
}
boolean contra=true //WHETHERLINEARGAMMAORLOGARITHMIC(CONTRAST)
if(chkwhtclbg.isSelected()==false){
contra=false
}
rgbgamm.changePixelsInRaster(upgamm,true,((int)parameterGamm.getValue()),contra)
//
bimbB.setData((Raster)rgbgamm.wras)
showimage.setIcon(new ImageIcon(bimbB))
showimage.setSize(new Dimension(bimbB.getWidth(),bimbB.getHeight()))
showimage.repaint()
//paramGammTx
//parameterGamm
}else if(e.getActionCommand().equals("TESTCOLFILT")){
repeatImg()
showimage.setIcon(new ImageIcon(bimbB))
showimage.setSize(new Dimension(bimbB.getWidth(),bimb.getHeight()))
showimage.repaint()
String val = jcocolbx.getSelectedItem().toString()
boolean upn=true
int colnimcolour=0
if(val.equals("DOWN")){
upn=false
}
if(colbox[0].isSelected()==true){
colnimcolour=0
}else if(colbox[1].isSelected()==true){
colnimcolour=1
}else{
colnimcolour=2
}
//
makeParamArrayValset()
if((colbox[0].isSelected()==true)||(colbox[1].isSelected()==true)||(colbox[2].isSelected()==true)){
rgbtest = new RGBchangeCoeffLinearSingleHueTest()
rgbtest.mkHueBoardReference(this)
rgbtest.setImageRaster()
rgbtest.changePixelsInRaster(upn,colnimcolour,paramBalsettVals)
bimbB.setData((Raster)rgbtest.wras)
}else{
rgbWhtest = new RGBchangeCoeffLinearTest(this,sidewinder,paramBalsettVals)
rgbWhtest.setImageRaster()
rgbWhtest.changePixelsInRaster(upn,true,0,1)
bimbB.setData((Raster)rgbWhtest.wras)
}//enif
showimage.setIcon(new ImageIcon(bimbB))
showimage.setSize(new Dimension(bimbB.getWidth(),bimbB.getHeight()))
showimage.repaint()
}else if(e.getActionCommand().equals("APPLYCOLFILT")){
String val = jcocolbx.getSelectedItem().toString()
boolean upn=true
int colnimcolour=0
String colnmrgb=null
colnmrgb=""
String unip=null
unip=""
if(val.equals("DOWN")){
upn=false
unip="DOWN"
}else{
unip="UP"
}
if(colbox[0].isSelected()==true){
colnimcolour=0
colnmrgb="(RED)"
}else if(colbox[1].isSelected()==true){
colnimcolour=1
colnmrgb="(GREEN)"
}else if(colbox[2].isSelected()==true){
colnimcolour=2
colnmrgb="(BLUE)"
}else{
colnmrgb="(WHITEFILTER)"
}
//
makeParamArrayValset()
if(whitebox.isSelected()==false){
sidewinder.callHue(upn,colnimcolour,paramBalsettVals)
}else{
sidewinder.callHue(upn,paramBalsettVals) //WHITEBOX

//RGBSETS

Page 22 / 32

}else if(colbox[2].isSelected()==true){
colnimcolour=2
colnmrgb="(BLUE)"
}else{
colnmrgb="(WHITEFILTER)"
}
//
makeParamArrayValset()
if(whitebox.isSelected()==false){
sidewinder.callHue(upn,colnimcolour,paramBalsettVals)
//RGBSETS
}else{
sidewinder.callHue(upn,paramBalsettVals) //WHITEBOX
}
String qty=null
qty=""
qty="::HueBoard::RGBSET:"+colnmrgb+unip+linsp
for(int rep=0rep<paramBalsettVals.lengthrep++){
qty+=""+paramBalsettVals[rep]+linsp
}//enfr
sidewinder.metaPne.append(qty)
disncusnButt(true)
sidewinder.doGarbageClear()
dispose()
//
}else if(e.getActionCommand().equals("REDBOX")){ //===colorrecodeforsliders
colbox[0].setSelected(true)
colbox[1].setSelected(false)
colbox[2].setSelected(false)
whitebox.setSelected(false)
recolorBackGrSlides(0)
}else if(e.getActionCommand().equals("GREENBOX")){
colbox[0].setSelected(false)
colbox[1].setSelected(true)
colbox[2].setSelected(false)
whitebox.setSelected(false)
recolorBackGrSlides(1)
}else if(e.getActionCommand().equals("BLUEBOX")){
colbox[0].setSelected(false)
colbox[1].setSelected(false)
colbox[2].setSelected(true)
whitebox.setSelected(false)
recolorBackGrSlides(2)
}else if(e.getActionCommand().equals("WHITEBOX")){
colbox[0].setSelected(false)
colbox[1].setSelected(false)
colbox[2].setSelected(false)
whitebox.setSelected(true)
recolorBackGrSlides(3)
}else{}
colbox[0].repaint()
colbox[1].repaint()
colbox[2].repaint()
//===endcolorrecodeforsliders
//disncusnButt(true)
sidewinder.doGarbageClear()
}//enactionlistner
void recolorBackGrSlides(int clr){
int colorint=255
Color al
for(int tbl=0tbl<16tbl++){
if(clr==0){
al=new Color(colorint,0,0)
}else if(clr==1){
al=new Color(0,colorint,0)
}else if(clr==2){
al=new Color(0,0,colorint)
}else{
al=new Color(colorint,colorint,colorint)
}
parameterBalsett[tbl].setBackground(al)
//parameterBalsett[tbl].repaint()
colorint=16
if(colorint<0){
colorint=0
}//enif
}//enmfr
//
parameterBalsett[15].repaint()
parameterBalsett[14].repaint()
parameterBalsett[13].repaint()
parameterBalsett[12].repaint()
parameterBalsett[11].repaint()
parameterBalsett[10].repaint()
parameterBalsett[9].repaint()
parameterBalsett[8].repaint()
parameterBalsett[7].repaint()
parameterBalsett[6].repaint()
parameterBalsett[5].repaint()
parameterBalsett[4].repaint()
parameterBalsett[3].repaint()
parameterBalsett[2].repaint()
parameterBalsett[1].repaint()
parameterBalsett[0].repaint()
}//enmeth
public void stateChanged(javax.swing.event.ChangeEvent eft){
Object obtsrc = eft.getSource()
Component cmpnt = (Component)obtsrc
String cmpn = cmpnt.getName().substring(6)
//JOptionPane.showMessageDialog(newJFrame(),cmpn)
if(cmpnt.getName().equals(("slider"+0))){
paramTxFl[0].setText(new Integer(parameterBalsett[0].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+1))){
paramTxFl[1].setText(new Integer(parameterBalsett[1].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+2))){
paramTxFl[2].setText(new Integer(parameterBalsett[2].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+3))){
paramTxFl[3].setText(new Integer(parameterBalsett[3].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+4))){
paramTxFl[4].setText(new Integer(parameterBalsett[4].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+5))){
paramTxFl[5].setText(new Integer(parameterBalsett[5].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+6))){
paramTxFl[6].setText(new Integer(parameterBalsett[6].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+7))){
paramTxFl[7].setText(new Integer(parameterBalsett[7].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+8))){
paramTxFl[8].setText(new Integer(parameterBalsett[8].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+9))){
paramTxFl[9].setText(new Integer(parameterBalsett[9].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+10))){
paramTxFl[10].setText(new Integer(parameterBalsett[10].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+11))){
paramTxFl[11].setText(new Integer(parameterBalsett[11].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+12))){
paramTxFl[12].setText(new Integer(parameterBalsett[12].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+13))){
paramTxFl[13].setText(new Integer(parameterBalsett[13].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+14))){
paramTxFl[14].setText(new Integer(parameterBalsett[14].getValue()).toString())
}else if(cmpnt.getName().equals(("slider"+15))){
paramTxFl[15].setText(new Integer(parameterBalsett[15].getValue()).toString())
}else if(cmpnt.getName().equals(("gammaslider"))){
String aval = gamjcocolbx.getSelectedItem().toString()
if(aval.equals("DOWN")){
aval = gammCoeffsDown[(parameterGamm.getValue())]
}else{
aval = gammCoeffs[(parameterGamm.getValue())]
}
paramGammTx.setText(aval)
}else{}

}//enstatechngeevt
}//enclss
//=================================================================================================================

class RGBchangeCoeffLinearSingleHueTest{
HueBoard swinder
WritableRaster wras
//
boolean isadsubable
RGBchangeCoeffLinearSingleHueTest(){
isadsubable=false
}//enconstr
RGBchangeCoeffLinearSingleHueTest(HueBoard swinder){
this.swinder=swinder
wras = swinder.bimbB.getRaster() //initallocpointonly
isadsubable=false
}//enconstr
//
HueBoard mkHueBoardReference(HueBoard hbrd){
swinder=(HueBoard)hbrd
return swinder
}//enmeth
WritableRaster setImageRaster(){
wras = (WritableRaster)swinder.bimbB.getRaster()
return wras
}//enmeth
//booleanisadsubable
//isadsubable=false
boolean isadsubCheck(int[] valfilterset){
for(int kp=0kp<valfilterset.lengthkp++){
if(valfilterset[kp]>0){
isadsubable=true
kp=valfilterset.length
}
}//enfr
return isadsubable
}//enmeth
void changePixelsInRaster(boolean updown,int arrcolnumber,int[] valfilterset){ //up=truedown=falseNOTREQUUIREDINTHIS>booleancoeffreq
int wd = wras.getWidth()
int ht = wras.getHeight()
int alng=0
int pixval=0
isadsubCheck(valfilterset)
if(isadsubable==true){
if(updown==true){ //INCREMENT
while(alng<ht){
for(int a=0a<wda++){
int[] pxlarr=new int[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
pxlarr=wras.getPixel(a,alng,pxlarr)
//
if(arrcolnumber==0){ //red
pixval=pxlarr[0]
}else if(arrcolnumber==1){ //green
pixval=pxlarr[1]
}else if(arrcolnumber==2){//blue{//blue
pixval=pxlarr[2]
}else{}
//
if((pixval > 240) && (pixval < 256)){
pixval+=valfilterset[0]
}else if((pixval > 224) && (pixval < 241)){
pixval+=valfilterset[1]
}else if((pixval > 208) && (pixval < 225)){
pixval+=valfilterset[2]
}else if((pixval > 192) && (pixval < 209)){
pixval+=valfilterset[3]
}else if((pixval > 176) && (pixval < 193)){
pixval+=valfilterset[4]
}else if((pixval > 160) && (pixval < 177)){
pixval+=valfilterset[5]
}else if((pixval > 144) && (pixval < 161)){
pixval+=valfilterset[6]
}else if((pixval > 128) && (pixval < 145)){
pixval+=valfilterset[7]
}else if((pixval > 112) && (pixval < 129)){
pixval+=valfilterset[8]
}else if((pixval > 96) && (pixval < 113)){
pixval+=valfilterset[9]
}else if((pixval > 80) && (pixval < 97)){
pixval+=valfilterset[10]
}else if((pixval > 64) && (pixval < 81)){
pixval+=valfilterset[11]
}else if((pixval > 48) && (pixval < 65)){
pixval+=valfilterset[12]
}else if((pixval > 32) && (pixval < 49)){
pixval+=valfilterset[13]
}else if((pixval > 16) && (pixval < 33)){
pixval+=valfilterset[14]
}else if((pixval > 1) && (pixval < 17)){
pixval+=valfilterset[15]
}else{}
//
if((pixval < 256)&&(pixval > 0)){
pxlarr[arrcolnumber]=pixval
}else{
if(pixval > 255){
pxlarr[arrcolnumber]=255
}else{
pxlarr[arrcolnumber]=0
}//enels
}//enels
wras.setPixel(a,alng,pxlarr)
}//enfr
alng++
}//enwhl
}else{ //DECREMENT====================================================================
//
while(alng<ht){
for(int a=0a<wda++){
int[] pxlarr=new int[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
pxlarr=wras.getPixel(a,alng,pxlarr)
if(arrcolnumber==0){ //red
pixval=pxlarr[0]
}else if(arrcolnumber==1){ //green

Page 23 / 32

}else{ //DECREMENT====================================================================
//
while(alng<ht){
for(int a=0a<wda++){
int[] pxlarr=new int[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
pxlarr=wras.getPixel(a,alng,pxlarr)
if(arrcolnumber==0){ //red
pixval=pxlarr[0]
}else if(arrcolnumber==1){ //green
pixval=pxlarr[1]
}else if(arrcolnumber==2){//blue{//blue
pixval=pxlarr[2]
}else{}
if((pixval > 240) && (pixval < 256)){
pixval=valfilterset[0]
}else if((pixval > 224) && (pixval < 241)){
pixval=valfilterset[1]
}else if((pixval > 208) && (pixval < 225)){
pixval=valfilterset[2]
}else if((pixval > 192) && (pixval < 209)){
pixval=valfilterset[3]
}else if((pixval > 176) && (pixval < 193)){
pixval=valfilterset[4]
}else if((pixval > 160) && (pixval < 177)){
pixval=valfilterset[5]
}else if((pixval > 144) && (pixval < 161)){
pixval=valfilterset[6]
}else if((pixval > 128) && (pixval < 145)){
pixval=valfilterset[7]
}else if((pixval > 112) && (pixval < 129)){
pixval=valfilterset[8]
}else if((pixval > 96) && (pixval < 113)){
pixval=valfilterset[9]
}else if((pixval > 80) && (pixval < 97)){
pixval=valfilterset[10]
}else if((pixval > 64) && (pixval < 81)){
pixval=valfilterset[11]
}else if((pixval > 48) && (pixval < 65)){
pixval=valfilterset[12]
}else if((pixval > 32) && (pixval < 49)){
pixval=valfilterset[13]
}else if((pixval > 16) && (pixval < 33)){
pixval=valfilterset[14]
}else if((pixval > 1) && (pixval < 17)){
pixval=valfilterset[15]
}else{}
if((pixval > 1) && (pixval < 256)){
pxlarr[arrcolnumber]=pixval
}else{
if(pixval < 0){
pxlarr[arrcolnumber]=0
}else{
pxlarr[arrcolnumber]=255
}//enels
}//enels
wras.setPixel(a,alng,pxlarr)
}//enfr
alng++
}//enwhl
}//enifels
}else{ //isadsubable
//System.out.println("conditioninputnotmet:INCREMENT(ovstep<256)&&(ovstep>0)")
}
}//enmeth
}//enclss

//=================================================================================================================

class RGBchangeCoeffLinearSingleHueSetter{
SidewinderPhotoColourBalancer swinder
boolean isadsubable
//
RGBchangeCoeffLinearSingleHueSetter(SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
swinder.work.makeParamWork(swinder.bumi.getHeight())
isadsubable=false
}//enconstr

//SidewinderPhotoColourBalancerswinderswinder.work.makeParamWork(swinder.bumi.getHeight())

//booleanisadsubable
//isadsubable=false
boolean isadsubCheck(int[] valfilterset){
for(int kp=0kp<valfilterset.lengthkp++){
if(valfilterset[kp]>0){
isadsubable=true
kp=valfilterset.length
}
}//enfr
return isadsubable
}//enmeth

void changePixelsInRaster(boolean updown,int arrcolnumber,int[] valfilterset){ //up=truedown=falseNOTREQUUIREDINTHIS>booleancoeffreq


int wd = swinder.bumi.getWidth()
int ht = swinder.bumi.getHeight()
int alng=0
int pixval=0
int apixval=0
isadsubCheck(valfilterset)
if(isadsubable==true){
if(updown==true){ //INCREMENT
while(alng<ht){
for(int a=0a<wda++){
//infoShort[][]red_Overstepshort[][]green_Overstepshort[][]blue_Overstep
if(arrcolnumber==0){ //red
pixval=new Short(swinder.red_Overstep[alng][a]).intValue()
}else if(arrcolnumber==1){ //green
pixval=new Short(swinder.green_Overstep[alng][a]).intValue()
}else if(arrcolnumber==2){//blue{//blue
pixval=new Short(swinder.blue_Overstep[alng][a]).intValue()
}else{}
//
if((pixval > 240) && (pixval < 256)){
pixval+=valfilterset[0]
}else if((pixval > 224) && (pixval < 241)){
pixval+=valfilterset[1]
}else if((pixval > 208) && (pixval < 225)){
pixval+=valfilterset[2]
}else if((pixval > 192) && (pixval < 209)){
pixval+=valfilterset[3]
}else if((pixval > 176) && (pixval < 193)){
pixval+=valfilterset[4]
}else if((pixval > 160) && (pixval < 177)){
pixval+=valfilterset[5]
}else if((pixval > 144) && (pixval < 161)){
pixval+=valfilterset[6]
}else if((pixval > 128) && (pixval < 145)){
pixval+=valfilterset[7]
}else if((pixval > 112) && (pixval < 129)){
pixval+=valfilterset[8]
}else if((pixval > 96) && (pixval < 113)){
pixval+=valfilterset[9]
}else if((pixval > 80) && (pixval < 97)){
pixval+=valfilterset[10]
}else if((pixval > 64) && (pixval < 81)){
pixval+=valfilterset[11]
}else if((pixval > 48) && (pixval < 65)){
pixval+=valfilterset[12]
}else if((pixval > 32) && (pixval < 49)){
pixval+=valfilterset[13]
}else if((pixval > 16) && (pixval < 33)){
pixval+=valfilterset[14]
}else if((pixval > 1) && (pixval < 17)){
pixval+=valfilterset[15]
}else{}
//
apixval=(int)pixval //nopointersplease!!!
//
//NEXTISMODIFIEDTOCOMPATIBILISEFORTHEshort[][]array
if(arrcolnumber==0){ //red
swinder.redsetPix(alng,a,apixval)
}else if(arrcolnumber==1){ //green
swinder.greensetPix(alng,a,apixval)
}else if(arrcolnumber==2){//blue{//blue
swinder.bluesetPix(alng,a,apixval)
}else{}
//
}//enfr
//
swinder.work.incrementOne()
swinder.work.reshower()
//
alng++
}//enwhl
}else{ //DECREMENT====================================================================
//
while(alng<ht){
for(int a=0a<wda++){
//infoShort[][]red_Overstepshort[][]green_Overstepshort[][]blue_Overstep
if(arrcolnumber==0){ //red
pixval=new Short(swinder.red_Overstep[alng][a]).intValue()
}else if(arrcolnumber==1){ //green
pixval=new Short(swinder.green_Overstep[alng][a]).intValue()
}else if(arrcolnumber==2){//blue{//blue
pixval=new Short(swinder.blue_Overstep[alng][a]).intValue()
}else{}
//
if((pixval > 240) && (pixval < 256)){
pixval=valfilterset[0]
}else if((pixval > 224) && (pixval < 241)){
pixval=valfilterset[1]
}else if((pixval > 208) && (pixval < 225)){
pixval=valfilterset[2]
}else if((pixval > 192) && (pixval < 209)){
pixval=valfilterset[3]
}else if((pixval > 176) && (pixval < 193)){
pixval=valfilterset[4]
}else if((pixval > 160) && (pixval < 177)){
pixval=valfilterset[5]
}else if((pixval > 144) && (pixval < 161)){
pixval=valfilterset[6]
}else if((pixval > 128) && (pixval < 145)){
pixval=valfilterset[7]
}else if((pixval > 112) && (pixval < 129)){
pixval=valfilterset[8]
}else if((pixval > 96) && (pixval < 113)){
pixval=valfilterset[9]
}else if((pixval > 80) && (pixval < 97)){
pixval=valfilterset[10]
}else if((pixval > 64) && (pixval < 81)){
pixval=valfilterset[11]
}else if((pixval > 48) && (pixval < 65)){
pixval=valfilterset[12]
}else if((pixval > 32) && (pixval < 49)){
pixval=valfilterset[13]
}else if((pixval > 16) && (pixval < 33)){
pixval=valfilterset[14]
}else if((pixval > 1) && (pixval < 17)){
pixval=valfilterset[15]
}else{}
//****sametestbutrequiredhereforthisclass
apixval=(int)pixval //nopointersplease!!!
//NEXTISMODIFIEDTOCOMPATIBILISEFORTHEshort[][]array
if(arrcolnumber==0){ //red
swinder.redsetPix(alng,a,apixval)
}else if(arrcolnumber==1){ //green
swinder.greensetPix(alng,a,apixval)
}else if(arrcolnumber==2){//blue{//blue
swinder.bluesetPix(alng,a,apixval)
}else{}
//
}//enfr
//
swinder.work.incrementOne()
swinder.work.reshower()
//
alng++
}//enwhl
}//enifels
}else{ //isadsubable
//System.out.println("conditioninputnotmet:INCREMENT(ovstep<256)&&(ovstep>0)")
}
swinder.work.resetIncreval()
//
}//enmeth

}//enclss
//======================================
class RGBchangeCoeffLinearGammaTest{
SidewinderPhotoColourBalancer swill
HueBoard swinder
WritableRaster wras
RGBContrastCoefficient contrastClass
final double[] gammCoeffs = {((double)1.1001D),((double)1.2001D),((double)1.3001D),((double)1.4001D),((double)1.5001D),((double)1.6001D),((double)1.7001D),((double)1.8001D),((double)1.9001D),((double)2.0001D),((double)2.1001D),((double)2.2001D),((double)2.3001D),((double)2.4001D)}
final double[] gammCoeffsDown = {((double)0.9090D),((double)0.8332D),((double)0.7691D),((double)0.7142D),((double)0.6666D),((double)0.6249D),((double)0.5882D),((double)0.5555D),((double)0.5262D),((double)0.4999D),((double)0.4761D),((double)0.4545D),((double)0.4347D),((double)0.4166D)}
//CONTRAST
//ARRAYSTORESTHE1/765THOFthemultiplier/dividerbandforthe"UIinputnotchflagindication"
double[] contrastCoeff255BandsUpDown
//MUSTFINDAWAYTOMAKEA14thBAND(TEST765!!!WARNDIVIDEBYZERO)
double d765 = ((double)1020.0000D)

int paraselminus = 0
double redcff = new Integer(0).doubleValue()

Page 24 / 32

final double[] gammCoeffs = {((double)1.1001D),((double)1.2001D),((double)1.3001D),((double)1.4001D),((double)1.5001D),((double)1.6001D),((double)1.7001D),((double)1.8001D),((double)1.9001D),((double)2.0001D),((double)2.1001D),((double)2.2001D),((double)2.3001D),((double)2.4001D)}


final double[] gammCoeffsDown = {((double)0.9090D),((double)0.8332D),((double)0.7691D),((double)0.7142D),((double)0.6666D),((double)0.6249D),((double)0.5882D),((double)0.5555D),((double)0.5262D),((double)0.4999D),((double)0.4761D),((double)0.4545D),((double)0.4347D),((double)0.4166D)}
//CONTRAST
//ARRAYSTORESTHE1/765THOFthemultiplier/dividerbandforthe"UIinputnotchflagindication"
double[] contrastCoeff255BandsUpDown
//MUSTFINDAWAYTOMAKEA14thBAND(TEST765!!!WARNDIVIDEBYZERO)
double d765 = ((double)1020.0000D)

int paraselminus = 0
double redcff = new Integer(0).doubleValue()
double greencff = new Integer(0).doubleValue()
double bluecff = new Integer(0).doubleValue()
int rdnow
int grnow
int blnow
int cf
//
//changePixelsInRaster(booleanupdown,booleancoeffreq,intcoeffGamm)
RGBchangeCoeffLinearGammaTest(HueBoard swinder,SidewinderPhotoColourBalancer swill){ //(SidewinderPhotoColourBalancerswinder)
this.swinder=swinder
this.swill=swill
this.wras = swinder.bimbB.getRaster() //initallocpointonly
this.contrastClass = new RGBContrastCoefficient() //RGBContrastCoefficientcontrastClass
}//enconstr

int redNw(int rdi){


rdnow=(int)rdi
return rdnow
}
int greenNw(int gri){
grnow=(int)gri
return grnow
}
int blueNw(int bli){
blnow=(int)bli
return blnow
}
int colCF(int cin){
cf=(int)cin
return cf
}
double redFl(double rf){
redcff=(double)rf
return redcff
}
double greenFl(double gr){
greencff=(double)gr
return greencff
}
double blueFl(double bl){
bluecff=(double)bl
return bluecff
}
int parasElm(int elmNum){ //calledafterclassconstructionlineinlistenerelmNum=elementnotedbythearraynumberfromtheJSlider
double coeffparas = (new Double("257.0000").doubleValue())*gammCoeffs[elmNum] //createsthesubtractionoftheparasiticraiseabovezero
paraselminus = new Double(coeffparas).intValue()
return paraselminus
}//enmeth

void buildColourCalibrate(boolean asu,int hgst,int coeffGammNUM,double reddouble,double greendouble,double bluedouble,boolean contrast){


//PREVENTCALIBRATIONCONFLICTOFBELOWZEROaddonaparisiticvaluetokeepdivisionabovezero
int redint=0
int greenint=0
int blueint=0
double newtop=new Double("0.0001").doubleValue()
if(asu==true){
reddouble+=257D
greendouble+=257D
bluedouble+=257D
}else{} //forgammadownaddnothing

//#########################REFITFORCONTRASTANDGAMMA####################################
double CONTcoefficientGAMMA = ((double)0.9090D) //INITIALISER
//############################CONTRAST#################################
if(contrast==true){
//contrast
CONTcoefficientGAMMA = CONTcoefficientGAMMA = contrastClass.pixelContrastCoeffSetter(gammCoeffs,gammCoeffsDown,contrastCoeff255BandsUpDown[coeffGammNUM],reddouble,greendouble,bluedouble,asu)
}else{
//gamma
if(asu==true){
CONTcoefficientGAMMA = gammCoeffs[coeffGammNUM]
}else{
CONTcoefficientGAMMA = gammCoeffsDown[coeffGammNUM]
}
}//enifelse

//TEMPORARYBOTHARRAYSUNTILFITS

//###############ENDNEWCODE
try{
if(hgst==0){
if(asu==true){
greenFl((greendouble/reddouble))
blueFl((bluedouble/reddouble))
newtop=reddouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue())
redNw(cf)
//
greenint=(new Double(((new Integer(cf).doubleValue())*greencff)).intValue())paraselminus
blueint=(new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())paraselminus
greenNw(greenint)
blueNw(blueint)
redint=cfparaselminus
redNw(redint)
}else{
newtop=reddouble*CONTcoefficientGAMMA
greenNw(new Double((greendouble*CONTcoefficientGAMMA)).intValue())
blueNw(new Double((bluedouble*CONTcoefficientGAMMA)).intValue())
redNw(new Double(newtop).intValue())
}
}else if(hgst==1){

if(asu==true){
redFl((reddouble/greendouble))
blueFl((bluedouble/greendouble))
newtop=greendouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue())
greenNw(cf)
//
redint=(new Double(((new Integer(cf).doubleValue())*redcff)).intValue())paraselminus
blueint=(new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())paraselminus
redNw(redint)
blueNw(blueint)
greenint=cfparaselminus
greenNw(greenint)
}else{
newtop=greendouble*CONTcoefficientGAMMA
greenNw(new Double(newtop).intValue())
blueNw(new Double((bluedouble*CONTcoefficientGAMMA)).intValue())
redNw(new Double((reddouble*CONTcoefficientGAMMA)).intValue())
}

}else{//hgst==2

if(asu==true){
redFl((reddouble/bluedouble))
greenFl((greendouble/bluedouble))
newtop=bluedouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue()) //+addecritive
blueNw(cf)
//
redint=(new Double(((new Integer(cf).doubleValue())*redcff)).intValue())paraselminus
greenint=(new Double(((new Integer(cf).doubleValue())*greencff)).intValue())paraselminus
redNw(redint)
greenNw(greenint)
blueint=cfparaselminus
blueNw(blueint)
}else{
newtop=bluedouble*CONTcoefficientGAMMA
redNw(new Double((reddouble*CONTcoefficientGAMMA)).intValue())
greenNw(new Double((greendouble*CONTcoefficientGAMMA)).intValue())
blueNw(new Double(newtop).intValue())
}

}//enifhgst
//PREVENTCALIBRATIONCONFLICTOFBELOWZEROremovalparisiticvalue
}catch(Exception exa){
swill.stackExPasthru((Throwable)exa)
}finally{}
}//enmeth
//#####################ENDBUILDCOLOURCALIBRATE#########################
WritableRaster setImageRaster(){
wras = swinder.bimbB.getRaster()
return wras
}

void changePixelsInRaster(boolean updown,boolean coeffreq,int coeffGamm,boolean contra){ //up=truedown=false


//disnableButtons(false)
//
int wd = wras.getWidth()
int ht = wras.getHeight()
int alng=0
int pixval=0
int pixvalG=0
int pixvalB=0
//
if(updown==true){
parasElm(coeffGamm)
}
//TWOCALLS
//#####################THISISALSOABOOLEANFORTHE"CONTRAST"
if((updown==true)&&(contra==true)){ //onlyneededforupsetsthenumbertoplacetheparasiticquantivisationelementontothevaluea
contrastCoeff255BandsUpDown=contrastClass.setSizeBandPieceUp(gammCoeffs,d765) //contrastcontructsthecoefficientarray
}else{
if(contra==true){
contrastCoeff255BandsUpDown=contrastClass.setSizeBandPieceDown(gammCoeffsDown,d765) //contrastcontructsthecoefficientarray
}
}
//
while(alng<ht){
for(int a=0a<wda++){
int[] pxlarr=new int[4]
pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
//
pxlarr=wras.getPixel(a,alng,pxlarr)
//addecritivemustbemodifiedhere
int hgst=1

if(coeffreq==true){
//======================================TOBECOMEAMETHODTOREMOVEEXCESSCODETOSET"inthgst"
if(hgst==1){
hgst=hgstSetter(pxlarr[0],pxlarr[1],pxlarr[2])
buildColourCalibrate(updown,hgst,coeffGamm,pxlarr[0],pxlarr[1],pxlarr[2],contra)
}//enifhgsttest
}//endifcooeffrequired
if(coeffreq==true){ //anditshouldbe
pixval=rdnow
//swill.redsetPix(alng,a,pixval)
pixvalG=grnow
//swill.greensetPix(alng,a,pixvalG)
pixvalB=blnow
//swill.bluesetPix(alng,a,pixvalB)
}
if((pixval < 256)&&(pixval > 1)){
pxlarr[0]=pixval
}else{
if(pixval > 255){
pxlarr[0]=255
}else{
pxlarr[0]=0
}//enels
}//enels
if((pixvalG < 256)&&(pixvalG > 1)){
pxlarr[1]=pixvalG
}else{
if(pixvalG > 255){
pxlarr[1]=255
}else{
pxlarr[1]=0
}//enels
}//enels
if((pixvalB < 256)&&(pixvalB > 1)){
pxlarr[2]=pixvalB
}else{
if(pixvalB > 255){
pxlarr[2]=255
}else{
pxlarr[2]=0
}//enels
}//enels
wras.setPixel(a,alng,pxlarr)
}//enfr

Page 25 / 32

pxlarr[2]=pixvalB
}else{
if(pixvalB > 255){
pxlarr[2]=255
}else{
pxlarr[2]=0
}//enels
}//enels
wras.setPixel(a,alng,pxlarr)
}//enfr
alng++
}//enwhl
}//enmeth

int hgstSetter(int redval,int greenval,int blueval){


int ahgst=1
String[] rgb={"R","G","B"}
int[] rgbVal=new int[3]
rgbVal[0]=redval
rgbVal[1]=greenval
rgbVal[2]=blueval
int swp=0
String swap
swap=""
//
while(((rgbVal[2]<rgbVal[1])||(rgbVal[2]<rgbVal[0]))&&((rgbVal[2]!=rgbVal[1])&&(rgbVal[1]!=rgbVal[0]))){

//notrequired&&(rgbVal[1]<rgbVal[0]))

if(rgbVal[0]>rgbVal[1]){
swp=rgbVal[0]
rgbVal[0]=rgbVal[1]
rgbVal[1]=swp
swap=rgb[0]
rgb[0]=rgb[1]
rgb[1]=swap
}//enif
if(rgbVal[1]>rgbVal[2]){
swp=rgbVal[1]
rgbVal[1]=rgbVal[2]
rgbVal[2]=swp
swap=rgb[1]
rgb[1]=rgb[2]
rgb[2]=swap
}//enif

}//enwhl
if(rgb[2].equals("R")){
ahgst=0
}else if(rgb[2].equals("G")){
ahgst=1
}else{ //"B"
ahgst=2
}
return ((int)ahgst)
}

}//enclss
//========================================================================

//======================================

//WARNINGdoubled765SHOULDBEREPLACEDBYALOCALEXPLICITLITERALNOTPASSED
class RGBContrastCoefficient{

RGBContrastCoefficient(){}

////##################################STARTCONTRAST#################################
double[] setSizeBandPieceUp(double[] gammCoeffs,double d765){
double[] contrastCoeff255BandsUpDown = new double[14]
for(int i=0i<14i++){
//IFi==14HERETODO
if(i<13){
contrastCoeff255BandsUpDown[i] = (double)(gammCoeffs[ i+1 ]gammCoeffs[0])/d765
//1/255=multiplertopixelSizeaddedtogetherasRGBintcolourpbiteset
}else{
contrastCoeff255BandsUpDown[i] = ((double)((double)2.5001D)gammCoeffs[0])/d765
//1/255=multiplertopixelSizeaddedtogetherasRGBintcolourpbiteset
}//enif
} //enfr
return (double[])contrastCoeff255BandsUpDown
}//enmeth

double[] setSizeBandPieceDown(double[] gammCoeffsDown,double d765){


double[] contrastCoeff255BandsUpDown = new double[14] //arrayisalreadydeclaredGLOBAL!!!!!
for(int i=0i<14i++){
//IFi==14HERETODO
if(i<13){
contrastCoeff255BandsUpDown[i] = (double)(gammCoeffsDown[0]gammCoeffsDown[ i+1 ])/d765
//1/255=multiplertopixelSizeaddedtogetherasRGBintcolourpbiteset
}else{
contrastCoeff255BandsUpDown[i] = (double)(gammCoeffsDown[0]((double)0.3872D))/d765
//1/255=multiplertopixelSizeaddedtogetherasRGBintcolourpbiteset
}//enif
} //enfr
return (double[])contrastCoeff255BandsUpDown
}//enmeth
////////////////////////////////////!WARNING!!!!ABOVESECTIONCALLEDONCEONLYRE:final////////////////////////////////////////

//CALLTHEPIXELTOBECHANGED,intbandNOTCHnumberGUIslider>contrastCoeff255ArrayUnit
double pixelIntensity(double contrastCoeff255ArrayUnit,double red,double green,double blue){
//doublegeneratePixRatio=contrastCoeff255BandsUpDown[bandNOTCHnumberGUIslider]*(red+green+blue)//"alikeanaverage"red+green+bluehasmaxpossibleof765
double generatePixRatio = contrastCoeff255ArrayUnit*(red+green+blue) //"alikeanaverage"red+green+bluehasmaxpossibleof765
return (double)generatePixRatio
}//enmeth

double pixelContrastCoeffSetter(double[] gammCoeffs,double[] gammCoeffsDown,double contrastCoeff255ArrayUnit,double ared,double agreen,double ablue,boolean updowncont){


double contrastPixCoeff = pixelIntensity(contrastCoeff255ArrayUnit,ared,agreen,ablue) //CALIBRATETHEPIXELINTENSITY
//
if(updowncont==true){
contrastPixCoeff += gammCoeffs[0]
}else{
double subtractor = (gammCoeffsDown[0] contrastPixCoeff)
contrastPixCoeff = ((double)subtractor)
}
//NOTEONLY!!!!wras.setPixel(a,alng,pxlarr)
//RETURNTOSETTINGNOWSENDTHROUGHTHEGAMMAPROCESSREPLACINGthe"constantcoefficient(GAMMA)"withthe"generatedcoefficient(CONTRAST)"
return (double)contrastPixCoeff
//thecoefftouseforthispixelinstance
}//enmeth
////##################################ENDCONTRAST#################################
//abstractRGBContrastCoefficientmakeClassRGBContrast()

//abstractdoublearrayUnitValue()
} //ENCLSS
//============================================================================================================
class RGBchangeCoeffLinearGammaSetter{
SidewinderPhotoColourBalancer swinder
RGBContrastCoefficient contrastClass
final double[] gammCoeffs = {((double)1.1001D),((double)1.2001D),((double)1.3001D),((double)1.4001D),((double)1.5001D),((double)1.6001D),((double)1.7001D),((double)1.8001D),((double)1.9001D),((double)2.0001D),((double)2.1001D),((double)2.2001D),((double)2.3001D),((double)2.4001D)}
final double[] gammCoeffsDown = {((double)0.9090D),((double)0.8332D),((double)0.7691D),((double)0.7142D),((double)0.6666D),((double)0.6249D),((double)0.5882D),((double)0.5555D),((double)0.5262D),((double)0.4999D),((double)0.4761D),((double)0.4545D),((double)0.4347D),((double)0.4166D)}

//CONTRAST
//ARRAYSTORESTHE1/765THOFthemultiplier/dividerbandforthe"UIinputnotchflagindication"
double[] contrastCoeff255BandsUpDown
//MUSTFINDAWAYTOMAKEA14thBAND(TEST765!!!WARNDIVIDEBYZERO)
double d765 = ((double)1020.0000D)
//
int paraselminus = 0
double redcff = new Integer(0).doubleValue()
double greencff = new Integer(0).doubleValue()
double bluecff = new Integer(0).doubleValue()
int rdnow
int grnow
int blnow
int cf
//
RGBchangeCoeffLinearGammaSetter(SidewinderPhotoColourBalancer swinder){
this.swinder=swinder
this.contrastClass = new RGBContrastCoefficient() //RGBContrastCoefficientcontrastClass
swinder.work.makeParamWork(swinder.bumi.getHeight())
}//enconstr

int redNw(int rdi){


rdnow=(int)rdi
return rdnow
}
int greenNw(int gri){
grnow=(int)gri
return grnow
}
int blueNw(int bli){
blnow=(int)bli
return blnow
}
int colCF(int cin){
cf=(int)cin
return cf
}
double redFl(double rf){
redcff=(double)rf
return redcff
}
double greenFl(double gr){
greencff=(double)gr
return greencff
}
double blueFl(double bl){
bluecff=(double)bl
return bluecff
}
int parasElm(int elmNum){ //calledafterclassconstructionlineinlistenerelmNum=elementnotedbythearraynumberfromtheJSlider
double coeffparas = (new Double("257.0000").doubleValue())*gammCoeffs[elmNum] //createsthesubtractionoftheparasiticraiseabovezero
paraselminus = new Float(coeffparas).intValue()
return paraselminus
}//enmeth

//coeffGammNUMCOMESFROMchangePixelsInRaster()fromTHEUITOSUPPLYCOEFFICIENTARRAYNDEX
//THISMETHODISASKEDREPEATEDLYFOREACHEVERYPIXELINTHEIMAGE
void buildColourCalibrate(boolean asu,int hgst,int coeffGammNUM,double reddouble,double greendouble,double bluedouble,boolean contrast){
//PREVENTCALIBRATIONCONFLICTOFBELOWZEROaddonaparisiticvaluetokeepdivisionabovezero
int redint=0
int greenint=0
int blueint=0
double newtop=new Double("0.0001").doubleValue()
if(asu==true){
reddouble+=257D
greendouble+=257D
bluedouble+=257D
}else{} //forgammadownaddnothing

//#########################REFITFORCONTRASTANDGAMMA####################################
double CONTcoefficientGAMMA = ((double)0.9090D) //INITIALISER
//############################CONTRAST#################################
if(contrast==true){
//contrast
CONTcoefficientGAMMA = contrastClass.pixelContrastCoeffSetter(gammCoeffs,gammCoeffsDown,contrastCoeff255BandsUpDown[coeffGammNUM],reddouble,greendouble,bluedouble,asu)
}else{
//gamma
if(asu==true){
CONTcoefficientGAMMA = gammCoeffs[coeffGammNUM]
}else{
CONTcoefficientGAMMA = gammCoeffsDown[coeffGammNUM]
}
}//enifelse

//TEMPORARYBOTHARRAYSUNTILFITS

//###############ENDNEWCODE

try{
if(hgst==0){
if(asu==true){
greenFl((greendouble/reddouble))
blueFl((bluedouble/reddouble))
newtop=reddouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue())
redNw(cf)
//
greenint=(new Double(((new Integer(cf).doubleValue())*greencff)).intValue())paraselminus
blueint=(new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())paraselminus
greenNw(greenint)
blueNw(blueint)
redint=cfparaselminus
redNw(redint)
}else{
newtop=reddouble*CONTcoefficientGAMMA

Page 26 / 32

newtop=reddouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue())
redNw(cf)
//
greenint=(new Double(((new Integer(cf).doubleValue())*greencff)).intValue())paraselminus
blueint=(new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())paraselminus
greenNw(greenint)
blueNw(blueint)
redint=cfparaselminus
redNw(redint)
}else{
newtop=reddouble*CONTcoefficientGAMMA
greenNw(new Double((greendouble*CONTcoefficientGAMMA)).intValue())
blueNw(new Double((bluedouble*CONTcoefficientGAMMA)).intValue())
redNw(new Double(newtop).intValue())
}
}else if(hgst==1){

if(asu==true){
redFl((reddouble/greendouble))
blueFl((bluedouble/greendouble))
newtop=greendouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue())
greenNw(cf)
//
redint=(new Double(((new Integer(cf).doubleValue())*redcff)).intValue())paraselminus
blueint=(new Double(((new Integer(cf).doubleValue())*bluecff)).intValue())paraselminus
redNw(redint)
blueNw(blueint)
greenint=cfparaselminus
greenNw(greenint)
}else{
newtop=greendouble*CONTcoefficientGAMMA
greenNw(new Double(newtop).intValue())
blueNw(new Double((bluedouble*CONTcoefficientGAMMA)).intValue())
redNw(new Double((reddouble*CONTcoefficientGAMMA)).intValue())
}

}else{//hgst==2

if(asu==true){
redFl((reddouble/bluedouble))
greenFl((greendouble/bluedouble))
newtop=bluedouble*CONTcoefficientGAMMA
colCF(new Double(newtop).intValue()) //+addecritive
blueNw(cf)
//
redint=(new Double(((new Integer(cf).doubleValue())*redcff)).intValue())paraselminus
greenint=(new Double(((new Integer(cf).doubleValue())*greencff)).intValue())paraselminus
redNw(redint)
greenNw(greenint)
blueint=cfparaselminus
blueNw(blueint)
}else{
newtop=bluedouble*CONTcoefficientGAMMA
redNw(new Double((reddouble*CONTcoefficientGAMMA)).intValue())
greenNw(new Double((greendouble*CONTcoefficientGAMMA)).intValue())
blueNw(new Double(newtop).intValue())
}

}//enifhgst
//PREVENTCALIBRATIONCONFLICTOFBELOWZEROremovalparisiticvalue
}catch(Exception exa){
swinder.stackExPasthru((Throwable)exa)
}finally{}
}//enmeth

void changePixelsInRaster(boolean updown,boolean coeffreq,int coeffGamm,boolean contra){ //up=truedown=false


//disnableButtons(false)
//
int wd = swinder.bumi.getWidth()
int ht = swinder.bumi.getHeight()
int alng=0
int pixval=0
int pixvalG=0
int pixvalB=0
//
if(updown==true){
parasElm(coeffGamm)
}//
//TWOCALLS
//#####################THISISALSOABOOLEANFORTHE"CONTRAST"
if((updown==true)&&(contra==true)){ //onlyneededforupsetsthenumbertoplacetheparasiticquantivisationelementontothevaluea
contrastCoeff255BandsUpDown=contrastClass.setSizeBandPieceUp(gammCoeffs,d765) //contrastcontructsthecoefficientarray
}else{
if(contra==true){
contrastCoeff255BandsUpDown=contrastClass.setSizeBandPieceDown(gammCoeffsDown,d765) //contrastcontructsthecoefficientarray
}
}//enels
//
while(alng<ht){
for(int a=0a<wda++){
//int[]pxlarr=newint[4]
//pxlarr[0]=0pxlarr[1]=0pxlarr[2]=0pxlarr[3]=0
//pxlarr=wras.getPixel(a,alng,pxlarr)
//addecritivemustbemodifiedhere
int hgst=1
if(coeffreq==true){
//======================================TOBECOMEAMETHODTOREMOVEEXCESSCODETOSET"inthgst"
if(hgst==1){
//HGSTFINDSHIGHESTOFTHETHREECOLOURS
hgst=hgstSetter((new Short(swinder.red_Overstep[alng][a]).intValue()),(new Short(swinder.green_Overstep[alng][a]).intValue()),(new Short(swinder.blue_Overstep[alng][a]).intValue()))
//
buildColourCalibrate(updown,hgst,coeffGamm,(new Short(swinder.red_Overstep[alng][a]).doubleValue()),(new Short(swinder.green_Overstep[alng][a]).doubleValue()),(new Short(swinder.blue_Overstep[alng][a]).doubleValue()),contra)
}//enifhgsttest
}//endifcooeffrequired
if(coeffreq==true){ //anditshouldbe
pixval=rdnow
swinder.redsetPix(alng,a,pixval)
pixvalG=grnow
swinder.greensetPix(alng,a,pixvalG)
pixvalB=blnow
swinder.bluesetPix(alng,a,pixvalB)
}
//
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
alng++
}//enwhl
swinder.work.resetIncreval()
//
}//enmeth

int hgstSetter(int redval,int greenval,int blueval){


int ahgst=1
String[] rgb={"R","G","B"}
int[] rgbVal=new int[3]
rgbVal[0]=redval
rgbVal[1]=greenval
rgbVal[2]=blueval
int swp=0
String swap
swap=""
//
while(((rgbVal[2]<rgbVal[1])||(rgbVal[2]<rgbVal[0]))&&((rgbVal[2]!=rgbVal[1])&&(rgbVal[1]!=rgbVal[0]))){

//notrequired&&(rgbVal[1]<rgbVal[0]))

if(rgbVal[0]>rgbVal[1]){
swp=rgbVal[0]
rgbVal[0]=rgbVal[1]
rgbVal[1]=swp
swap=rgb[0]
rgb[0]=rgb[1]
rgb[1]=swap
}//enif
if(rgbVal[1]>rgbVal[2]){
swp=rgbVal[1]
rgbVal[1]=rgbVal[2]
rgbVal[2]=swp
swap=rgb[1]
rgb[1]=rgb[2]
rgb[2]=swap
}//enif

}//enwhl
if(rgb[2].equals("R")){
ahgst=0
}else if(rgb[2].equals("G")){
ahgst=1
}else{ //"B"
ahgst=2
}
return ((int)ahgst)
}
}//enclss
//========================================================================
class FontParts extends FontMetrics{
Font ftnt
LineMetrics lnmtc
java.awt.geom.Rectangle2D rectfont
int ascMX
int descMX
int advanceMX //interlineheight
int stdheight
//
FontParts(Font ftnt){
super(ftnt)
this.ftnt=ftnt
advanceMX = this.getMaxAdvance()
ascMX = this.getMaxAscent()
descMX = this.getMaxDescent()
stdheight = this.getHeight()
}//enconstr
//IFSTRING!=NULL&&>0
java.awt.geom.Rectangle2D makerectMetrics(String line,Graphics fgf){
return (rectfont=this.getStringBounds(line,fgf))
}//enmeth
//IFSTRING!=NULL&&>0
LineMetrics makeLinemetric(String line,Graphics fgf){
return (lnmtc = this.getLineMetrics(line,fgf))
}//enmeth
}//enclss
//===================================================================================
class FontTempImage{
SidewinderPhotoColourBalancer sid
//BufferedImagefntbff//templateimage
String insertMetricString
FontParts fpart
Graphics fg //forthetemplateimage
Font pf[]//makeallfonts()
Object[] fontnames
Color bgimgcol,textimgcol
//
int flistindex
int nowfontStyle=0
int nowfontSize=8
Font nowfont
//
FontTempImage(SidewinderPhotoColourBalancer sid){
this.sid=sid
insertMetricString=""
makeAllFonts()
//checkforfontnameTIMES
//loadfontparts"FontParts"
int flongth = pf.length
for(int eye=0eye<flongtheye++){
if(((pf[eye].getFontName()).toLowerCase()).indexOf("times")!=1){
nowfont=new Font(pf[eye].getFontName(),0,8)
makeFontmetric(nowfont) //plain0bold1italic2
flistindex=eye
}else{
nowfont=new Font(pf[0].getFontName(),0,8)
makeFontmetric(nowfont) //plain0bold1italic2
flistindex=0
}
}//enfr
fontnames=new Object[flongth]
for(int aye=0aye<flongthaye++){
fontnames[aye]=pf[aye].getFontName()
}//enfr
}//enconstr
//calledfromalistenerDUPLICATE!!!!WARNING
FontParts setNewFontmetric(Font afont){
return (fpart=new FontParts(afont))
}//enmeth
//
FontParts makeFontmetric(Font ftnt){
return (fpart=new FontParts(ftnt))
}//enmeth

//SIZESTYLEANDFONTNAME
Font setNewNowFont(String name,int stylefont,int sizefont){
setNowstyle(stylefont)
setNowsize(sizefont)
nowfont=new Font(name,stylefont,sizefont)
setNewFontmetric((Font)nowfont)
return nowfont
}//enmeth
int setNowsize(int szf){
nowfontSize=szf

Page 27 / 32

//SIZESTYLEANDFONTNAME
Font setNewNowFont(String name,int stylefont,int sizefont){
setNowstyle(stylefont)
setNowsize(sizefont)
nowfont=new Font(name,stylefont,sizefont)
setNewFontmetric((Font)nowfont)
return nowfont
}//enmeth
int setNowsize(int szf){
nowfontSize=szf
return nowfontSize
}//enmeth
int setNowstyle(int styf){
nowfontStyle=styf
return nowfontStyle
}//enmeth
//bgimgcol,textimgcol
Color setBackGrndCol(int a,int b,int c){ //THEBACKGROUNDOFTHETESTIMAGEPLATE
bgimgcol=new Color(a,b,c)
return bgimgcol
}
Color setTextColorImgwrite(int r,int g,int b){ //THETEXTCOLOR
textimgcol=new Color(r,g,b)
return textimgcol
}
//SIZESTYLEANDFONTNAME
void setInsertString(String ins){
insertMetricString=ins
fpart.makeLinemetric(insertMetricString,sid.bumi.getGraphics())
fpart.makerectMetrics(insertMetricString,sid.bumi.getGraphics())
makeFontmetricBufferedImg(new Double(fpart.rectfont.getWidth()).intValue(),new Double(fpart.rectfont.getHeight()).intValue())
}//enmeth
//BufferedImagemakeFontmetricBufferedImg(intmainImgwidth,intmainImgheight){
void makeFontmetricBufferedImg(int mainImgwidth,int mainImgheight){
/*
int[]clrcheck=newint[3]
clrcheck[0]=textimgcol.getRed()
clrcheck[1]=textimgcol.getGreen()
clrcheck[2]=textimgcol.getBlue()
if((clrcheck[0]==0)&&(clrcheck[1]==0)&&(clrcheck[2]==0)){
setBackGrndCol(255,255,255)
}else{
setBackGrndCol(0,0,0)
}
//IFSTRING!=NULL&&>0fortherectangle2D
//fntbff=newBufferedImage(mainImgwidth,mainImgheight,sid.bumi.getType())//(5=a0255RGB)
//int[]bgcolint={bgimgcol.getRed(),bgimgcol.getGreen(),bgimgcol.getBlue()}
//WritableRasterrazz=fntbff.getRaster()
//razz.setPixels(0,0,mainImgwidth,mainImgheight,bgcolint)
//nowpaintstringontoimagebuffer
//GraphicsfGbff=fntbff.getGraphics()
//fGbff.setColor(textimgcol)
//fGbff.setFont(fpart.getFont())
//fGbff.drawString(insertMetricString,0,0)
*/
sid.paintImageText(textimgcol,fpart.getFont(),insertMetricString,fpart.stdheight) //LINE484INMAINCLASSSidewinder
//returnfntbff
}//enmeth
Font[] makeAllFonts(){
java.awt.GraphicsEnvironment gif = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
pf = gif.getAllFonts()
return pf
}//enmeth
}//enclss
//=====================================================================================
class FontChoiceBoxList extends JComboBox{
//FontTempImagefntImgtemp
//Object[]fonts
FontChoiceBoxList(FontTempImage fntImgtemp){
super(fntImgtemp.fontnames)
}//enconstr
}//enclss

//FontTempImage(SidewinderPhotoColourBalancersid)

//=====================================================================================
/*
classFontStyleBoxextendsJComboBox{
//Object[]choices={"plain","bold","italic","italicbold"}
FontStyleBox(Object[]choices){
super(choices)
}//enconstr
}//enclss
*/
//=====================================================================================
//listenercall993button
class FontTextBoard extends JFrame implements java.awt.event.ActionListener{
SidewinderPhotoColourBalancer sidd //requiredforlistener
FontTempImage fidge
FontChoiceBoxList focx
//FontStyleBoxfobs
JComboBox szbx
JComboBox[] coloRGB
JPanel boardpan,buttsundr
JButton tr,clr //,app
JTextField fldtx
JTextField xtoptext,ytoptx
JLabel gridpntlb,xpntlb,ypntlb
JPanel txtpntline
DefaultComboBoxModel[] lsRGB
JPanel[] rgbHolder
//,fldtxR,fldtxG,fldtxB
//JCheckBoxmvbx
JLabel szlabe
Font guifon
String linesep
final Object[] choices={"plain","bold","italic","italicbold"}
//
FontTextBoard(SidewinderPhotoColourBalancer sidd){
this.sidd=sidd
linesep = sidd.linesep
//
try{
this.setIconImage(((Toolkit)this.getToolkit()).getImage(sidd.app_PATH+sidd.flsep+"Sidewinder32.gif"))
}catch(java.lang.Exception excaf1){
sidd.stackExPasthru((Throwable)excaf1)
}finally{}
guifon=sidd.uifont
//newFont("times",0,9)
fidge = new FontTempImage(sidd)
focx=new FontChoiceBoxList(fidge)
focx.setEditable(false)
focx.setMaximumRowCount(10)
//WARNINGSIZECASTTOCOMPONENTTOENSURESIZESFORLINUXREQUIRED
focx.setSize(400,40)
focx.setActionCommand("NWFONTTXT")//"NWFONTTXT"
focx.addActionListener(this)
//fobs=newFontStyleBox(choices)
//fobs.setSize(90,40)
//fobs.setSelectedIndex(0)
this.setPreferredSize(new Dimension(760,280))
this.setMinimumSize(new Dimension(760,280))
this.setSize(760,280)
tr=new JButton(new ImageIcon(sidd.appiconsIMG[24])) //"try")
tr.setToolTipText("TestPaintonthelineoftext")
tr.setPreferredSize(new Dimension(65,65))
tr.setSize(65,65)
tr.setFont(guifon)
tr.setActionCommand("TXTRY")
tr.addActionListener(this)
clr=new JButton(new ImageIcon(sidd.appiconsIMG[23])) //cleartext
clr.setToolTipText("Clearalltexttest")
clr.setPreferredSize(new Dimension(65,65))
clr.setSize(65,65)
clr.setFont(guifon)
clr.setActionCommand("CLEARTXT")
clr.addActionListener(this)
//app=newJButton("apply")
//app.setFont(guifon)
fldtx=(JTextField)new InsertField()
fldtx.setSize(460,40)
lsRGB=new ListRGBnumbers[3]
coloRGB = new JComboBox[3]
int cntr=0
while(cntr<3){
lsRGB[cntr]=new ListRGBnumbers()
coloRGB[cntr]=new JComboBox(lsRGB[cntr])
coloRGB[cntr].setSize(90,40)
cntr++
}//enwhl
rgbHolder = new JPanel[4] //[0]istheholderpanelfortheother3
rgbHolder[0]=new JPanel()
rgbHolder[0].setPreferredSize(new Dimension(460,85))
rgbHolder[0].setSize(460,85)
//
rgbHolder[1]=new JPanel()
rgbHolder[1].setPreferredSize(new Dimension(100,65))
rgbHolder[1].setSize(100,65)//
rgbHolder[2]=new JPanel()
rgbHolder[2].setPreferredSize(new Dimension(100,65))
rgbHolder[2].setSize(100,65)
rgbHolder[3]=new JPanel()
rgbHolder[3].setPreferredSize(new Dimension(100,65))
rgbHolder[3].setSize(100,65)
coloRGB[0].setToolTipText("chooseREDlevel")
coloRGB[1].setToolTipText("chooseGREENlevel")
coloRGB[2].setToolTipText("chooseBLUElevel")
//
rgbHolder[1].add(coloRGB[0])
rgbHolder[2].add(coloRGB[1])
rgbHolder[3].add(coloRGB[2])
rgbHolder[0].add(rgbHolder[1])
rgbHolder[0].add(rgbHolder[2])
rgbHolder[0].add(rgbHolder[3])
//mvbx=newJCheckBox("move",false)
int nmw=0
Object[] szs=new Object[420]
while(nmw<420){
szs[nmw]=new Integer((nmw+8)).toString()
nmw++
}//enwhl
szbx=new JComboBox(szs)
szbx.setEditable(false)
szbx.setMaximumRowCount(20)
szbx.setSize(90,40)
szbx.setActionCommand("NWFONTTXT")//"NWFONTTXT"
szbx.addActionListener(this)
//
szlabe=new JLabel(new ImageIcon(sidd.appiconsIMG[25])) //"FontSize")
szlabe.setFont(guifon)
szlabe.setPreferredSize(new Dimension(65,65))
szlabe.setSize(65,65)
buttsundr = new JPanel()
buttsundr.setSize(470,40)
xtoptext=new JTextField("0",5)
ytoptx=new JTextField("0",5)
gridpntlb=new JLabel("Textxycornerpointtopleft:")
gridpntlb.setSize(140,40)
xpntlb=new JLabel("x:")
xpntlb.setSize(60,40)
ypntlb=new JLabel("y:")
ypntlb.setSize(60,40)
txtpntline=new JPanel()
txtpntline.setSize(460,40)
txtpntline.add(gridpntlb)
txtpntline.add(xpntlb)
txtpntline.add(xtoptext)
txtpntline.add(ypntlb)
txtpntline.add(ytoptx)
boardpan=new JPanel()
boardpan.setSize(470,200)
boardpan.add(focx)
//boardpan.add(fobs)
boardpan.add(fldtx)
boardpan.add(rgbHolder[0])
buttsundr.add(tr)
buttsundr.add(clr)
//buttsundr.add(app)
//buttsundr.add(mvbx)
buttsundr.add(szbx)
buttsundr.add(szlabe)
//
boardpan.add(buttsundr)
boardpan.add(txtpntline)
//
this.getContentPane().add(boardpan)
sidd.txflagOn()
setTitle("SidewinderPhotoColourBalancerTEXT")
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
doClsFlag()
callTxtextareaRepaint()
}
})
setAlwaysOnTop(true)
setIgnoreRepaint(false)
setVisible(true)
setLocation(200,200)
coloRGB[0].setSelectedIndex(255)
coloRGB[1].setSelectedIndex(255)
coloRGB[2].setSelectedIndex(255)
rgbHolder[1].setBackground(new Color(255,0,0))
rgbHolder[1].repaint()
rgbHolder[2].setBackground(new Color(0,255,0))
rgbHolder[2].repaint()
rgbHolder[3].setBackground(new Color(0,0,255))
rgbHolder[3].repaint()
rgbHolder[0].setBackground(new Color(255,255,255))
rgbHolder[0].repaint()
coloRGB[0].setActionCommand("SETCOLAB")
coloRGB[0].addActionListener(this)
coloRGB[1].setActionCommand("SETCOLAB")
coloRGB[1].addActionListener(this)
coloRGB[2].setActionCommand("SETCOLAB")
coloRGB[2].addActionListener(this)

Page 28 / 32

rgbHolder[2].setBackground(new Color(0,255,0))
rgbHolder[2].repaint()
rgbHolder[3].setBackground(new Color(0,0,255))
rgbHolder[3].repaint()
rgbHolder[0].setBackground(new Color(255,255,255))
rgbHolder[0].repaint()
coloRGB[0].setActionCommand("SETCOLAB")
coloRGB[0].addActionListener(this)
coloRGB[1].setActionCommand("SETCOLAB")
coloRGB[1].addActionListener(this)
coloRGB[2].setActionCommand("SETCOLAB")
coloRGB[2].addActionListener(this)
int fonsoZ=(new Integer(szbx.getSelectedItem().toString()).intValue())
fidge.setNewNowFont((focx.getSelectedItem().toString()),0,fonsoZ) //fonstYforlateruse
fidge.setNewFontmetric(new Font((focx.getSelectedItem().toString()),0,fonsoZ))
}//enconstr
void doClsFlag(){
sidd.txflagOff()
}//enmeth
void setPointFields(int xf,int yf){
//WIDTH,HEIGHT,LEFTTOPPOINT,MUSTBETRANSLATEDBYRATIO
//NEXTISTOTRANSLATETHETPN.PAINTED()RECTANGLECLASSCOORDINATESANDSIZEACCORDTOVIEWER
double sztoit=0D
int rszto=sidd.jox.getSelectedIndex()
//sidd.makeImgRsz(brsZidx)
if(rszto==1){//3/4
sztoit=new Double(((double)3D))/new Double(((double)4D))
}else if(rszto==2){//2/3
sztoit=new Double(((double)2D))/new Double(((double)3D))
}else if(rszto==3){//1/2
sztoit=(double)2D
}else if(rszto==4){//5/12
sztoit=new Double(((double)5D))/new Double(((double)12D))
}else if(rszto==5){//1/3
sztoit=(double)3D
}else if(rszto==6){//1/4
sztoit=(double)4D
}else if(rszto==7){//1/5
sztoit=(double)5D
}else if(rszto==8){//3/16
sztoit=new Double(((double)3D))/new Double(((double)16D))
}else if(rszto==9){//1/6
sztoit=(double)6D
}else if(rszto==10){//1/8
sztoit=(double)8D
}else if(rszto==11){//1/10
sztoit=(double)10D
}else if(rszto==12){//1/12
sztoit=(double)12D
}else if(rszto==13){//1/16
sztoit=(double)16D
}else{}
//
if((int)rszto!=0){
if((rszto==1)||(rszto==2)||(rszto==4)||(rszto==8)){
xf = (int)new Double((new Integer(xf).doubleValue()*sztoit)).intValue()
yf = (int)new Double((new Integer(yf).doubleValue()*sztoit)).intValue()
}else{
xf = (int)new Double((new Integer(xf).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
yf = (int)new Double((new Integer(yf).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
}
}
//
xtoptext.setText(new Integer(xf).toString())
ytoptx.setText(new Integer(yf).toString())
}//enmeth
public void actionPerformed(java.awt.event.ActionEvent eff){
String com = eff.getActionCommand() //if(((boolean)actComm.equals("OPENFILE"))){
if(((boolean)com.equals("TXTRY"))){
String textfromfield=fldtx.getText()
if((textfromfield.length()>0) && (textfromfield!=null)){
int fonsoZ=(new Integer(szbx.getSelectedItem().toString()).intValue())
//intfonstY=newInteger(fobs.getSelectedIndex()).intValue()
//
fidge.setNewNowFont((focx.getSelectedItem().toString()),0,fonsoZ) //fonstYforlateruse
fidge.setNewFontmetric(new Font((focx.getSelectedItem().toString()),0,fonsoZ))
fidge.setTextColorImgwrite(new Integer(coloRGB[0].getSelectedItem().toString()).intValue(),new Integer(coloRGB[1].getSelectedItem().toString()).intValue(),new Integer(coloRGB[2].getSelectedItem().toString()).intValue())
fidge.setInsertString(fldtx.getText())
//MODIFIEDFROMTHECROPPINGCLASSpoint2=newPoint(e.getX(),e.getY())
int brsZidx = sidd.rSzIdx(sidd.jox.getSelectedIndex())
sidd.rSzIdx(0) //inmkimreszitasksfirstwhatthe"bumi"imageusageismustbesuppliedaszerobeforeitwilluseittosizefrom???alwaysdoesanyhow???
sidd.makeImgRsz(brsZidx)
sidd.metaPne.append("===AddedText==="+linesep)
sidd.metaPne.append("="+textfromfield+linesep)
sidd.metaPne.append("="+"FontName:"+focx.getSelectedItem().toString()+"::FontSize:"+fonsoZ+""+linesep)
sidd.metaPne.append("="+"Xtextpos:"+xtoptext.getText()+"Ytextpos:"+ytoptx.getText()+linesep)
//
//LINE480HASTHEPAINTERINSIDESIDEWINDERCLASSUNDERTHECONSTRUCTOR
}else{
JOptionPane.showMessageDialog(new JFrame(),"Yourequiretoplacealineoftext(Onechar.Min.)")
}
}else if(((boolean)com.equals("NWFONTTXT"))){
int fonsoZ=(new Integer(szbx.getSelectedItem().toString()).intValue())
fidge.setNewNowFont((focx.getSelectedItem().toString()),0,fonsoZ) //fonstYforlateruse
fidge.setNewFontmetric(new Font((focx.getSelectedItem().toString()),0,fonsoZ))
mkMargin()
}else if(((boolean)com.equals("CLEARTXT"))){
sidd.rotationPopulator(sidd.bumi.getWidth(),sidd.bumi.getHeight())
//setandresizebackto1/1
//MODIFIEDFROMTHECROPPINGCLASSpoint2=newPoint(e.getX(),e.getY())
int brsZidx = sidd.rSzIdx(sidd.jox.getSelectedIndex())
sidd.rSzIdx(0) //inmkimreszitasksfirstwhatthe"bumi"imageusageismustbesuppliedaszerobeforeitwilluseittosizefrom???alwaysdoesanyhow???ithastoensureBOTHbumiandbumiRsZarecleared
sidd.makeImgRsz(brsZidx)
//
sidd.tpn.repaint()
sidd.metaPne.append("===TextCleared==="+linesep)
}else if(((boolean)com.equals("SETCOLAB"))){
printPaintboardColourVals()
}else{}//eniflistener
//"APPLY"WILLWRITEINTOTHEARRAY
//CLEARWILLREPOPULATE
sidd.doGarbageClear()
}//enlis
void mkMargin(){
String textfromfield=fldtx.getText()
if((textfromfield.length()>0) && (textfromfield!=null)){
//
fidge.fpart.makerectMetrics(fldtx.getText(),sidd.bumi.getGraphics())
int widR = new Double(fidge.fpart.rectfont.getWidth()).intValue()
int hitR = new Double(fidge.fpart.rectfont.getHeight()).intValue()
//WIDTH,HEIGHT,LEFTTOPPOINT,MUSTBETRANSLATEDBYRATIO
//NEXTISTOTRANSLATETHETPN.PAINTED()RECTANGLECLASSCOORDINATESANDSIZEACCORDTOVIEWER
double sztoit=0D
int rszto=sidd.jox.getSelectedIndex()
//sidd.makeImgRsz(brsZidx)
if(rszto==1){//3/4
sztoit=new Double(((double)3D))/new Double(((double)4D))
}else if(rszto==2){//2/3
sztoit=new Double(((double)2D))/new Double(((double)3D))
}else if(rszto==3){//1/2
sztoit=(double)2D
}else if(rszto==4){//5/12
sztoit=new Double(((double)5D))/new Double(((double)12D))
}else if(rszto==5){//1/3
sztoit=(double)3D
}else if(rszto==6){//1/4
sztoit=(double)4D
}else if(rszto==7){//1/5
sztoit=(double)5D
}else if(rszto==8){//3/16
sztoit=new Double(((double)3D))/new Double(((double)16D))
}else if(rszto==9){//1/6
sztoit=(double)6D
}else if(rszto==10){//1/8
sztoit=(double)8D
}else if(rszto==11){//1/10
sztoit=(double)10D
}else if(rszto==12){//1/12
sztoit=(double)12D
}else if(rszto==13){//1/16
sztoit=(double)16D
}else{}
//
if(rszto!=0){
if((rszto==1)||(rszto==2)||(rszto==4)||(rszto==8)){
widR = (int)new Double((new Integer(widR).doubleValue()*sztoit)).intValue()
hitR = (int)new Double((new Integer(hitR).doubleValue()*sztoit)).intValue()
}else{
widR = (int)new Double((new Integer(widR).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
hitR = (int)new Double((new Integer(hitR).doubleValue())/(new Double(sztoit).doubleValue())).intValue()
}
//JOptionPane.showMessageDialog(newJFrame(),"width:"+widR+"height:"+hitR)
//mustaddtranslatedpoint
}
sidd.callPaintMarginBox(widR,hitR) //,fidge.fpart.getFont())//inmainclass
}//enifIFTHEREISTEXT
}//enmeth
void printPaintboardColourVals(){
//
String clrRgb=coloRGB[0].getSelectedItem().toString() //MUSTBEHEREORTOOMUCHREPEATEDCODE
String clrrGb=coloRGB[1].getSelectedItem().toString() //MUSTBEHEREORTOOMUCHREPEATEDCODE
String clrrgB=coloRGB[2].getSelectedItem().toString() //MUSTBEHEREORTOOMUCHREPEATEDCODE
//
Color crbg=new Color(new Integer(clrRgb).intValue(),new Integer(clrrGb).intValue(),new Integer(clrrgB).intValue())
rgbHolder[0].setBackground(crbg)
rgbHolder[0].repaint()
buttsundr.setBackground(crbg)
buttsundr.repaint()
sidd.metaPne.append("===(256)TextColourReSetChosen==="+linesep)
sidd.metaPne.append("===REDVALUE==="+clrRgb+linesep)
sidd.metaPne.append("===GREENVALUE==="+clrrGb+linesep)
sidd.metaPne.append("===BLUEVALUE==="+clrrgB+linesep)
}//enmeth
//CALLSTHISWINDOW"CLOSING"TOCLEARANYLEFTOVERRECTANGLE
public void callTxtextareaRepaint(){
sidd.callTpnRepaint()
}//enmeth
//===========nestedclass
class InsertField extends JTextField implements java.awt.event.KeyListener{ //fldtx
InsertField(){
super(50)
addKeyListener(this)
}//enconstr
public void keyPressed(java.awt.event.KeyEvent ek){}
public void keyReleased(java.awt.event.KeyEvent ek){
//callTxtextareaRepaint()
//JOptionPane.showMessageDialog(newJFrame(),"LISTENER")
mkMargin()
}
public void keyTyped(java.awt.event.KeyEvent ek){}
}//enclss
//========nestedclass
}//enclss
//=====================================================================================
class ListRGBnumbers extends DefaultComboBoxModel{
ListRGBnumbers(){
for(int ig=0(ig<256)ig++){
this.addElement(new Integer(ig).toString())
}//enfr
}//enconstr
}//enclss
//=====================================================================================
//WARNINGTHISCLASSISNOTSETWITHATESTVIEWSYSTEM
class ConvertToBandW{
//TESTCONVERTTOBWintensityrefinements
SidewinderPhotoColourBalancer bwSwinder
int width
int height
float test
//constructorfollows
ConvertToBandW(SidewinderPhotoColourBalancer bwSwinder){
this.bwSwinder=bwSwinder
width=wdt()
height=hht()
test=(float)3F
bwSwinder.work.makeInterWork((int)height1)
}//ENCONSTR
int wdt(){
width=(int)bwSwinder.bumi.getWidth() //NOTE(int)NOPOINTING!!!!PRECAUTION
return width
} //enmeth
int hht(){
height=(int)bwSwinder.bumi.getHeight()
return height
} //enmeth
void makeBWimage(){
//
int swn1 = 0
int swn2 = 0
int swn3 = 0
//
int side=0
for(int ca=0ca<widthca++){
side=0 //WHILE
while(side<height){
//
swn1 = new Short(((short)bwSwinder.red_Overstep[side][ca])).intValue()
//NOTE(short)EVALUATIONPAREMTHESISANDNOPOINTING!!!!PRECAUTION
swn2 = new Short(((short)bwSwinder.blue_Overstep[side][ca])).intValue()
swn3 = new Short(((short)bwSwinder.green_Overstep[side][ca])).intValue()
float pack=new Integer(swn1+swn2+swn3).floatValue()
int pack2=0

Page 29 / 32

int swn3 = 0
//
int side=0
for(int ca=0ca<widthca++){
side=0 //WHILE
while(side<height){
//
swn1 = new Short(((short)bwSwinder.red_Overstep[side][ca])).intValue()
//NOTE(short)EVALUATIONPAREMTHESISANDNOPOINTING!!!!PRECAUTION
swn2 = new Short(((short)bwSwinder.blue_Overstep[side][ca])).intValue()
swn3 = new Short(((short)bwSwinder.green_Overstep[side][ca])).intValue()
float pack=new Integer(swn1+swn2+swn3).floatValue()
int pack2=0
//
if(pack<test){
//WARNNODIVIDEBY0
pack2=1
}else{
pack2=(int)new Float((pack/3F)).intValue()
}
if(pack2>255){
pack2=255
}
if(pack2<0){
pack2=0
}
////(HEIGHT,WIDTH,VALUE)
bwSwinder.redsetPix(side,ca,pack2)
bwSwinder.greensetPix(side,ca,pack2)
bwSwinder.bluesetPix(side,ca,pack2)
//
side++
}//enwhl
bwSwinder.work.incrementOne()
bwSwinder.work.reshower()
//
}//enfr
bwSwinder.work.resetIncreval()
//
}//enmeth
} //enclss
//======================================================================================
/*
WorkWindowProgressorwrkprogess
WorkBarwork
work=newWorkBar(intqty)
wrkprogess=newWorkWindowProgressor(work)
work.makeInterWork(intqtydone)
work.reshower()
wrkprogess.exitProgressWindow()
*/
//LINE348
class WorkBar extends JProgressBar{
int incrval
//WARNINGJAMMINGBECAUSEOFMEMORYREQUIRESTHREADING
WorkBar(){
setMaximumSize(new Dimension(380,35))
setMinimumSize(new Dimension(380,35))
setPreferredSize(new Dimension(380,35))
setSize(new Dimension(380,70))
setIgnoreRepaint(false)
makeParamWork()
}//enconstr
WorkBar(int qty){
incrval=0 //
setMaximumSize(new Dimension(380,35))
setMinimumSize(new Dimension(380,35))
setPreferredSize(new Dimension(380,35))
setSize(new Dimension(380,70))
setIgnoreRepaint(false)
makeParamWork(qty)
}//enconstr
void makeParamWork(){
setIndeterminate(true)
setStringPainted(true)
setString("Processing...")
repaint()
//setMinimum(0)
//setMaximum(1)
//setValue(0)
} //enmeth

void makeParamWork(int onetoone){


setString(null)
setIndeterminate(false)
setStringPainted(true)
setMinimum(0)
setMaximum(onetoone)
setValue(0)
repaint()
} //enmeth

void makeInterWork(int qtydone){


setValue(qtydone)
} //enmeth
void reshower(){
repaint()
} //enmeth
int incrementOne(){
incrval+=1
setValue(incrval)
repaint()
return incrval
} //enmeth
int resetIncreval(){
return incrval=0
} //enmeth

}//ENCLSS

class WorkWindowProgressor extends JFrame{


JPanel progpan
WorkBar wrkr
WorkWindowProgressor(WorkBar wrkr,final Image sw32ico){
this.wrkr=wrkr
progpan = new JPanel()
progpan.setLayout(new java.awt.FlowLayout(1,4,4))
progpan.setBackground(new Color(255,255,255))
progpan.setMaximumSize(new Dimension(390,80))
progpan.setMinimumSize(new Dimension(390,80))
progpan.setPreferredSize(new Dimension(390,80))
progpan.setBackground(new Color(150,150,150))
progpan.setSize(new Dimension(390,80))
progpan.add(this.wrkr)
progpan.setIgnoreRepaint(false)
//
setDefaultCloseOperation(0)
setLayout(new java.awt.FlowLayout(1,4,4))
setBackground(new Color(255,255,255))
SwingUtilities.invokeLater(new Runnable(){
public void run(){
setMaximumSize(new Dimension(400,90))
setMinimumSize(new Dimension(400,90))
setPreferredSize(new Dimension(400,90))
setSize(new java.awt.Dimension(400,90))
setResizable(false)
getContentPane().add(progpan)
setTitle("SidewinderPhotoColourBalancerworkprogress")
setIconImage(sw32ico)
setUndecorated(false)
setIgnoreRepaint(false)
setAlwaysOnTop(true)
pack()
setVisible(true)
setLocation(200,200)
}
})
//
}//enconstr
void makeParamWork(){
wrkr.makeParamWork()
}
void makeParamWork(int setot){
wrkr.makeParamWork(setot)
}
void makeInterWork(int qtydone){
wrkr.setValue(qtydone)
} //enmeth
void reshower(){
wrkr.repaint()
} //enmeth
void exitProgressWindow(){
super.dispose()
}//enmeth
} //ENCLSS
//=====================================================================================

class Rotators{
SidewinderPhotoColourBalancer swinder
int storeImgType //hastobesentfromsidewindermainclassfirste.g.clssref.storeImgType=bumi.getType()
//BufferedImagebmiimg
Rotators(SidewinderPhotoColourBalancer swinder,int storeImgType){
this.swinder=swinder
this.storeImgType = storeImgType
}//enconstr
//remakeoriginaldatacalibratorarraysafter"CounterClockwiserotationofimage"90degrees
//callbyx3
short[][] rotateCCw(int currWid,int currHit,short[][] origicolo){
int nwHit = currWid
int nwWid = currHit
swinder.work.makeParamWork(nwHit1)
short[][] nwCCw
nwCCw = new short[nwHit][]
for(int fge=0fge<nwHitfge++){
nwCCw[fge] = new short[nwWid]
}//enfr
//
int wlkRGTdwn = 0
currWid=1
while(wlkRGTdwn<nwHit){ //currWid=nwHit
for(int iuthey=0iuthey<nwWidiuthey++){
nwCCw[wlkRGTdwn][iuthey] = origicolo[iuthey][currWid]
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
currWid
wlkRGTdwn++
}//enwhl
swinder.work.resetIncreval()
return (short[][])nwCCw
}//enmeth
//=================remakeoriginaldatacalibratorarrayafter"Clockwiserotationofimage"90degrees
short[][] rotateCw(int currWid,int currHit,short[][] origicolo){
int nwHit = currWid
int nwWid = currHit
swinder.work.makeParamWork(nwHit1)
short[][] nwCw
nwCw = new short[nwHit][]
for(int fge=0fge<nwHitfge++){
nwCw[fge] = new short[nwWid]
}//enfr
int sta = currHit1
int nwy = 0
while(nwy<nwHit){
for(int cxdzq=0cxdzq<nwWidcxdzq++){
if(cxdzq==0){
sta = currHit1
}//enif
nwCw[nwy][cxdzq] = origicolo[sta][nwy]
sta
}//enfr
swinder.work.incrementOne()
swinder.work.reshower()
nwy++
}//enwhl
swinder.work.resetIncreval()
return (short[][])nwCw
}//enmeth
//readymakesabaseplateimagereadyforpopulatingfromrenewedarrayaboveafterrestorationinsidewindermainclass
//formemoryspacethismaybebetterreturneddirectlytobumi
public BufferedImage mkBasePlateIMG(int nw,int nht,int callImgType){ //newuseforcopybumi
return (new BufferedImage(nw,nht,callImgType))
}//enmeth
}//enclss

//============================================================================================================
/*packagesidewinderutil
importjava.awt.image.WritableRaster
//MultiDimArr.java
//"C:\ProgramFiles\Java\jdk1.6.0_22\bin\javac.exe"MultiDimArr.java
*/
class MultiDimArr{
void debugPrint(){
System.out.println("TRIGGEREDPRINTERINCLASSMultiDimArr.java")
}

Page 30 / 32

/*packagesidewinderutil
importjava.awt.image.WritableRaster
//MultiDimArr.java
//"C:\ProgramFiles\Java\jdk1.6.0_22\bin\javac.exe"MultiDimArr.java
*/
class MultiDimArr{
void debugPrint(){
System.out.println("TRIGGEREDPRINTERINCLASSMultiDimArr.java")
}
short[][] colOverstepstore(int rgb,int httimg,int lenbrdthimg,WritableRaster wras){
//System.out.println("httimgheight:"+httimg)
//System.out.println("lenbrdthimgwidth:"+lenbrdthimg)
short[][] Overstep
int[] pxlarr=new int[4]
pxlarr[0]=0
pxlarr[1]=0
pxlarr[2]=0
pxlarr[3]=0 //wras.getPixel(a,alng,pxlarr)
//
Overstep = new short[httimg][]
//
for(int hty=0(hty<httimg)hty++){
Overstep[hty] = new short[lenbrdthimg]
}//enwhl
int fzst=0
int vto=0
while(fzst<httimg){
vto=0
while(vto<lenbrdthimg){
//System.out.println("htyheight:"+fzst)
//System.out.println("cwidwidth:"+vto)
//pxlarr=wras.getPixel(hty,cwid,pxlarr)
pxlarr = wras.getPixel(vto,fzst,pxlarr) //!!!arrayis[H][W](y,x)getPixelisW,H(x,y)
Overstep[fzst][vto]=(new Integer(pxlarr[rgb]).shortValue())
//System.out.println("Overstep[][]:"+Overstep[fzst][vto])
vto++
}//enwhl
fzst++
}//enwhl
return ((short[][])Overstep)
}//enmeth
//publicabstractintgetDimensionOfArray()

//thepurposeofthismethodistoreconstructthecroppedimageoriginaldataatpointofcroppingfortheaccuracybackingcalibratorarray
short[][] reMakeCropArr(int xaccrStrt,int ydownStrt,int nwWidth,int nwHeight,short[][] oldArr){
short[][] nwArr
nwArr = new short[nwHeight][]
//
for(int bhty=0(bhty<nwHeight)bhty++){
nwArr[bhty] = new short[nwWidth]
}//enwhl
//startloading
int iterNwBand = 0
int ydwn = ydownStrt
//xaccrStrt=1
//System.out.println("atstartydwn:"+ydwn)
//System.out.println("atstartxaccrStrt:"+xaccrStrt)
while(iterNwBand<nwHeight){ //countsthebandlines
int xacr = xaccrStrt
for(int asc=0asc<nwWidthasc++){
nwArr[iterNwBand][asc] = oldArr[ydwn][xacr]
xacr++
}//enfr

ydwn++
iterNwBand++
}//enwhl
//System.out.println("iterNwBand:"+iterNwBand+"ydwn:"+ydwn)
return ((short[][])nwArr)
}//enmeth

}//enclss
//=================================================================
/*
importjava.io.File
importjavax.swing.*
importjavax.swing.filechooser.*
*/
class IMGextensions extends javax.swing.filechooser.FileFilter{

public boolean accept(File ck){


if(ck.isDirectory()){
return true
}else{
String nma=ck.getName()
int nmeb=nma.lastIndexOf(".")
String extrq = (nma.substring(nmeb+1)).toLowerCase()
if(extrq.equals("jpeg")||extrq.equals("jpg")||extrq.equals("bmp")||extrq.equals("png")||extrq.equals("JPEG")||extrq.equals("JPG")||extrq.equals("BMP")||extrq.equals("PNG")){
return true
}else{
return false
}
}
}//enaccp

public String getDescription(){


return "24bitjpeg,bmp,png"
}
}//enclss
//============================================================
/*packagesidewinderutil
importjava.awt.Point
importjavax.swing.*
//TOBEAnestedaccessibleclassifrequired
*/
class Cropcoords{
int ax,ay,bx,by,sideX,sideY
//,trx,trgy,bttmRx,bttmRy
Point ltp,rtp,bttmlf,bttmrt

Cropcoords(Point A, Point B){


//JOptionPane.showMessageDialog(newJFrame(),""+A.getX())
ax=new Double(A.getX()).intValue()
ay=new Double(A.getY()).intValue()
bx=new Double(B.getX()).intValue()
by=new Double(B.getY()).intValue()
//
if(ax<bx){
sideX=bxax
}else{
sideX=axbx//whether==size
}//enifels
//
if(ay<by){
sideY=byay
}else{
sideY=ayby//whether==size
}//enifels
//JOptionPane.showMessageDialog(newJFrame(),""+sideY)
topleftpoint()//REQUIREDforSidewinder
toprightpoint() //notrequiredhereFORimagemappinginSUcommanderXer
bottomleftpoint()//notrequiredhereFORimagemappinginSUcommanderXer
bottomrightpoint()//notrequiredhereFORimagemappinginSUcommanderXer
}//enconstr
Point topleftpoint(){
if ((ax<bx) && (ay<by)){
ltp=new Point(ax,ay)
}else if ((ax<bx) && (by<ay)){
ltp=new Point(ax,by)
}else if ((bx<ax) && (by<ay)){
ltp=new Point(bx,by)
}else if ((bx<ax) && (ay<by)){
ltp=new Point(bx,ay)
}else{
ltp=new Point(bx,by)
}
//JOptionPane.showMessageDialog(newJFrame(),"ax:"+ax+"bx:"+bx+"ay:"+ay+"by:"+by)
return ltp
//ltp=newPoint(ax,ay)
}//enmeth
Point toprightpoint(){
if ((ax<bx) && (ay<by)){
rtp=new Point(bx,ay)
}else if ((ax<bx) && (by<ay)){
rtp=new Point(bx,by)
}else if ((bx<ax) && (by<ay)){
rtp=new Point(ax,by)
}else if ((bx<ax) && (ay<by)){
rtp=new Point(ax,ay)
}else{}
return rtp
}//enmeth

Point bottomleftpoint(){
if ((ax<bx) && (ay<by)){
bttmlf=new Point(ax,by)
}else if ((ax<bx) && (by<ay)){
bttmlf=new Point(ax,ay)
}else if ((bx<ax) && (by<ay)){
bttmlf=new Point(bx,ay)
}else if ((bx<ax) && (ay<by)){
bttmlf=new Point(bx,by)
}else{}
return bttmlf
}//enmeth

Point bottomrightpoint(){
if ((ax<bx) && (ay<by)){
bttmrt=new Point(bx,by)
}else if ((ax<bx) && (by<ay)){
bttmrt=new Point(bx,ay)
}else if ((bx<ax) && (by<ay)){
bttmrt=new Point(ax,ay)
}else if ((bx<ax) && (ay<by)){
bttmrt=new Point(ax,by)
}else{}
return bttmrt
}//enmeth

}//enclss

//=======================================================================================================================
//=======================================================================
//packagesidewinderutil
//
class FlipInvert{
//
SidewinderPhotoColourBalancer swinder
short[][] bakar
short[][] trnsf
//
int reverse
int rowcolength
//trnsf=newshort[reverse][rowcolength]
//
FlipInvert(SidewinderPhotoColourBalancer swinder,short[][] bakar,int flipMirror){ //0=flip1=mirrorinvdert//SidewinderPhotoColourBalancerswinderswinder.work.makeParamWork(swinder.bumi.getHeight())
this.swinder=swinder
this.bakar=bakar
reverse=(int)bakar.length
rowcolength=(int)(bakar[0].length)
//
if(flipMirror==0){
flip180BakArr() //alikerotatesimplyupsidedown(rotate180)
swinder.work.makeParamWork(rowcolength1)
}else{
invertMirrorBakArr() //"mirrored"invertedimagearray(mirrorimage)
swinder.work.makeParamWork(reverse)
}//enifels
}//enconstr
//X3RED,GREENANDBLUEEACH
short[][] flip180BakArr(){
int revr=(int)bakar.length
//intrwcl=(int)(bakar[0][0].length)
int ArrAlng=0
int secarr=0
int rowcolen = (rowcolength1)
trnsf = new short[reverse][]

Page 31 / 32

}//enconstr
//X3RED,GREENANDBLUEEACH
short[][] flip180BakArr(){
int revr=(int)bakar.length
//intrwcl=(int)(bakar[0][0].length)
int ArrAlng=0
int secarr=0
int rowcolen = (rowcolength1)
trnsf = new short[reverse][]
revr=1
while(revr > 1){
//
trnsf[ArrAlng] = new short[rowcolength]
//
for(int rwcl=rowcolenrwcl>1rwcl=1){
trnsf[ArrAlng][secarr]=(short)bakar[revr][rwcl]
secarr++
}//enfr
secarr=0
ArrAlng+=1
revr=1
//
swinder.work.incrementOne()
swinder.work.reshower()
//
}//enwhl
swinder.work.resetIncreval()
return trnsf
}//enmeth

short[][] invertMirrorBakArr(){
//intrevr=(int)bakar.length
//intrwcl=(int)bakar[0][0].length
int ArrAlng=0
int secarr=0
int rowcolen = (rowcolength1)
trnsf = new short[reverse][]
while(ArrAlng<reverse){
//
trnsf[ArrAlng] = new short[rowcolength]
//
for(int rwcl=rowcolen(rwcl > 1)rwcl=1){
trnsf[ArrAlng][secarr] = (short)bakar[ArrAlng][rwcl]
secarr++
}//enfr
secarr=0
ArrAlng+=1
//revr=1
swinder.work.incrementOne()
swinder.work.reshower()
//
}//enwhl
swinder.work.resetIncreval()
return trnsf
}//enmeth

short[][] getFlippedOrMirroredArray(){
return (short[][])trnsf
}//enmeth

}//enclss

Page 32 / 32

Das könnte Ihnen auch gefallen