Skip to content

Commit 5a6f1be

Browse files
authored
reference: Add Color (#203)
* reference: Add background Signed-off-by: Ce Gao <[email protected]> * reference: Add clear Signed-off-by: Ce Gao <[email protected]> * reference: Add colorMode Signed-off-by: Ce Gao <[email protected]> * reference: Add fill Signed-off-by: Ce Gao <[email protected]> * reference: Add noFill Signed-off-by: Ce Gao <[email protected]> * refenrece: Add noStroke Signed-off-by: Ce Gao <[email protected]> * reference: Add alpha Signed-off-by: Ce Gao <[email protected]> * reference: Add blue Signed-off-by: Ce Gao <[email protected]> * reference: Add brightness Signed-off-by: Ce Gao <[email protected]> * reference: Add color Signed-off-by: Ce Gao <[email protected]> * reference: Add hue and green Signed-off-by: Ce Gao <[email protected]> * reference: Add lerpColor Signed-off-by: Ce Gao <[email protected]> * reference: Add red Signed-off-by: Ce Gao <[email protected]> * reference: Add saturation Signed-off-by: Ce Gao <[email protected]> * reference: Add stroke Signed-off-by: Ce Gao <[email protected]> * src: Add test case Signed-off-by: Ce Gao <[email protected]>
1 parent 262c305 commit 5a6f1be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+777
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
reference: https://processing.org/reference/images/alpha_.png
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
noStroke()
2+
c = color(0, 126, 255, 102)
3+
fill(c)
4+
rect(15, 15, 35, 70)
5+
value = alpha(c) # Sets 'value' to 102
6+
fill(value)
7+
rect(50, 15, 35, 70)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
reference: https://processing.org/reference/images/background_0.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
background(51)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
reference: https://processing.org/reference/images/background_1.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
background(255, 204, 0)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
img = loadImage("laDefense.jpg")
2+
background(img)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
reference: https://processing.org/reference/images/blue_.png
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
c = color(175, 100, 220) # Define color 'c'
2+
fill(c) # Use color variable 'c' as fill color
3+
rect(15, 20, 35, 60) # Draw left rectangle
4+
5+
blueValue = blue(c) # Get blue in 'c'
6+
println(blueValue) # Prints '220.0'
7+
fill(0, 0, blueValue) # Use 'blueValue' in new fill
8+
rect(50, 20, 35, 60) # Draw right rectangle
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
reference: https://processing.org/reference/images/brightness_.png

0 commit comments

Comments
 (0)