-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c9f2c9
commit c606789
Showing
6 changed files
with
887 additions
and
1,049 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
function interpolate(pBegin, pEnd, pStep, pMax) { | ||
if (pBegin < pEnd) { | ||
return ((pEnd - pBegin) * (pStep / pMax)) + pBegin; | ||
} else { | ||
return ((pBegin - pEnd) * (1 - (pStep / pMax))) + pEnd; | ||
} | ||
if (pBegin < pEnd) { | ||
return ((pEnd - pBegin) * (pStep / pMax)) + pBegin; | ||
} else { | ||
return ((pBegin - pEnd) * (1 - (pStep / pMax))) + pEnd; | ||
} | ||
|
||
} | ||
|
||
function generateColor(theColorBegin, theColorEnd, theNumSteps){ | ||
var colorArray = new Array(); | ||
theColorBegin = parseInt(theColorBegin, 16); | ||
theColorEnd = parseInt(theColorEnd, 16); | ||
function generateColor(theColorBegin, theColorEnd, theNumSteps) { | ||
var colorArray = new Array(); | ||
theColorBegin = parseInt(theColorBegin, 16); | ||
theColorEnd = parseInt(theColorEnd, 16); | ||
|
||
theR0 = (theColorBegin & 0xff0000) >> 16; | ||
theG0 = (theColorBegin & 0x00ff00) >> 8; | ||
theB0 = (theColorBegin & 0x0000ff) >> 0; | ||
theR1 = (theColorEnd & 0xff0000) >> 16; | ||
theG1 = (theColorEnd & 0x00ff00) >> 8; | ||
theB1 = (theColorEnd & 0x0000ff) >> 0; | ||
theR0 = (theColorBegin & 0xff0000) >> 16; | ||
theG0 = (theColorBegin & 0x00ff00) >> 8; | ||
theB0 = (theColorBegin & 0x0000ff) >> 0; | ||
theR1 = (theColorEnd & 0xff0000) >> 16; | ||
theG1 = (theColorEnd & 0x00ff00) >> 8; | ||
theB1 = (theColorEnd & 0x0000ff) >> 0; | ||
|
||
for (i = 0; i <= theNumSteps; i++) { | ||
theR = interpolate(theR0, theR1, i, theNumSteps); | ||
theG = interpolate(theG0, theG1, i, theNumSteps); | ||
theB = interpolate(theB0, theB1, i, theNumSteps); | ||
theVal = ((( theR << 8 ) | theG ) << 8 ) | theB; | ||
colorArray[i] = theVal.toString(16); | ||
console.log(theVal.toString(16)); | ||
for (i = 0; i <= theNumSteps; i++) { | ||
theR = interpolate(theR0, theR1, i, theNumSteps); | ||
theG = interpolate(theG0, theG1, i, theNumSteps); | ||
theB = interpolate(theB0, theB1, i, theNumSteps); | ||
theVal = (((theR << 8) | theG) << 8) | theB; | ||
colorArray[i] = theVal.toString(16); | ||
console.log(theVal.toString(16)); | ||
} | ||
return colorArray; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,59 @@ | ||
function addIndivBreakField(){ | ||
var initialFrom = minValues[activeLayer]; | ||
var initialTo = maxValues[activeLayer]; | ||
|
||
if(breakCount > 0){ | ||
initialFrom = document.getElementById("breakTo"+(breakCount)).value; | ||
initialTo = parseInt(document.getElementById("breakTo"+(breakCount)).value); | ||
|
||
var d = document.getElementById("td"+breakCount); | ||
var olddiv = document.getElementById("addBtn"+breakCount); | ||
d.removeChild(olddiv); | ||
|
||
var rembtn = document.createElement("input"); | ||
rembtn.setAttribute("type", "image"); | ||
rembtn.setAttribute("id", "rembtn"+(breakCount)); | ||
rembtn.setAttribute("onclick", "remIndivBreakField("+breakCount+")"); | ||
rembtn.setAttribute("src", "images/close20.png"); | ||
d.appendChild(rembtn); | ||
} | ||
|
||
breakCount++; | ||
var breaksList = document.getElementById("Breaks"); | ||
|
||
var breakEntry = document.createElement("tr"); | ||
breakEntry.setAttribute("id", "tr" + breakCount); | ||
|
||
var breakFieldFrom = document.createElement("td"); | ||
breakFieldFrom.innerHTML = '<input type="text" class="range" id="breakFrom' + breakCount + '" value="' + initialFrom + '"></input>'; | ||
breakEntry.appendChild(breakFieldFrom); | ||
|
||
var breakFieldTo = document.createElement("td"); | ||
breakFieldTo.innerHTML = '<input type="text" class="range" id="breakTo' + breakCount + '" value="' + initialTo + '"></input>'; | ||
breakEntry.appendChild(breakFieldTo); | ||
|
||
var breakColor = document.createElement("td"); | ||
breakColor.innerHTML = '<input class="color" id="cp'+breakCount+'" onchange="colorChange('+breakCount+')" style="width:50px;">'; | ||
breakEntry.appendChild(breakColor); | ||
|
||
|
||
var addBreak = document.createElement("td"); | ||
addBreak.setAttribute("id", "td"+breakCount); | ||
addBreak.innerHTML = '<input type="image" src="images/plus20.png" id="addBtn'+breakCount+'" onclick="addIndivBreakField()" >'; | ||
breakEntry.appendChild(addBreak); | ||
|
||
|
||
breaksList.appendChild(breakEntry); | ||
|
||
|
||
jscolor.init(); | ||
|
||
|
||
} | ||
function addIndivBreakField() { | ||
var initialFrom = minValues[activeLayer]; | ||
var initialTo = maxValues[activeLayer]; | ||
|
||
function remIndivBreakField(count){ | ||
var d = document.getElementById("Breaks"); | ||
var olddiv = document.getElementById("tr"+count); | ||
d.removeChild(olddiv); | ||
|
||
} | ||
if (breakCount > 0) { | ||
initialFrom = document.getElementById("breakTo" + (breakCount)).value; | ||
initialTo = parseInt(document.getElementById("breakTo" + (breakCount)).value); | ||
|
||
var d = document.getElementById("td" + breakCount); | ||
var olddiv = document.getElementById("addBtn" + breakCount); | ||
d.removeChild(olddiv); | ||
|
||
var rembtn = document.createElement("input"); | ||
rembtn.setAttribute("type", "image"); | ||
rembtn.setAttribute("id", "rembtn" + (breakCount)); | ||
rembtn.setAttribute("onclick", "remIndivBreakField(" + breakCount + ")"); | ||
rembtn.setAttribute("src", "images/close20.png"); | ||
d.appendChild(rembtn); | ||
} | ||
|
||
breakCount++; | ||
var breaksList = document.getElementById("Breaks"); | ||
|
||
var breakEntry = document.createElement("tr"); | ||
breakEntry.setAttribute("id", "tr" + breakCount); | ||
|
||
var breakFieldFrom = document.createElement("td"); | ||
breakFieldFrom.innerHTML = '<input type="text" class="range" id="breakFrom' + breakCount + '" value="' + initialFrom + '"></input>'; | ||
breakEntry.appendChild(breakFieldFrom); | ||
|
||
var breakFieldTo = document.createElement("td"); | ||
breakFieldTo.innerHTML = '<input type="text" class="range" id="breakTo' + breakCount + '" value="' + initialTo + '"></input>'; | ||
breakEntry.appendChild(breakFieldTo); | ||
|
||
var breakColor = document.createElement("td"); | ||
breakColor.innerHTML = '<input class="color" id="cp' + breakCount + '" onchange="colorChange(' + breakCount + ')" style="width:50px;">'; | ||
breakEntry.appendChild(breakColor); | ||
|
||
|
||
var addBreak = document.createElement("td"); | ||
addBreak.setAttribute("id", "td" + breakCount); | ||
addBreak.innerHTML = '<input type="image" src="images/plus20.png" id="addBtn' + breakCount + '" onclick="addIndivBreakField()" >'; | ||
breakEntry.appendChild(addBreak); | ||
|
||
|
||
breaksList.appendChild(breakEntry); | ||
|
||
|
||
jscolor.init(); | ||
|
||
|
||
} | ||
|
||
function remIndivBreakField(count) { | ||
var d = document.getElementById("Breaks"); | ||
var olddiv = document.getElementById("tr" + count); | ||
d.removeChild(olddiv); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.