Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Examples for newly implemented blending Modes #6

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions reference/image/pimage/blend_burn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
Color Burn increases the contrast between target and blend colors,resulting in more highly saturated mid-tones and reduced highlights.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'burn')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
22 changes: 22 additions & 0 deletions reference/image/pimage/blend_difference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
The Difference blending mode uses the difference of the target and blend pixels as the resulting blend.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'difference')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
23 changes: 23 additions & 0 deletions reference/image/pimage/blend_dodge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Color Dodge gives you a brigher effect by decreasing the contarast between the
target and the blend colors resulting in saturated mid tones and blown highlights.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'dodge')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
24 changes: 24 additions & 0 deletions reference/image/pimage/blend_exclusion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Exclusion is very similar to Difference.
Blending with white inverts the base color values, while blending with black produces no change.
However, Blending with 50% gray produces 50% gray.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'exclusion')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
23 changes: 23 additions & 0 deletions reference/image/pimage/blend_hard_light.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
This mode combines the multiply and screen blending modes using the
brightness values of the blend layerto make its calculation.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'hard_light')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
23 changes: 23 additions & 0 deletions reference/image/pimage/blend_overlay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Overlay is combination of multiply and screen with the target layer always shining though.
Its calculation is based on the target layer instead of blend layer.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'overlay')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()
23 changes: 23 additions & 0 deletions reference/image/pimage/blend_soft_light.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Soft Light is very much like Overlay.
It applies either a darkening or lightening effect depending on the luminance values, but in a much more subtle way.
"""
from p5 import *

img1 = load_image('../src/luminale-512.jpg')
img2 = load_image('../src/grand-theatre-512.jpg')
img3 = load_image('../src/luminale-512.jpg')

img3.blend(img2, 'soft_light')

def setup():
size(img1.width, int(img1.height * 1.5))
no_loop()

def draw():
image(img1, (0, 0), (img1.width // 2, img1.height // 2))
image(img2, (img1.width // 2, 0), (img1.width // 2, img1.height // 2))
image(img3, (0, img1.height // 2))

if __name__ == '__main__':
run()