File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
external_library/java/image_processing Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # Example for an artificial glitch effect.
2+ # Move the mouse from left to right to see different intensity
3+ # or press the left mouse button to see the original image.
4+ #
5+ # Author: Nick 'Milchreis' Müller
6+ # Translated to JRubyArt by Martin Prout
7+
8+ load_library :ImageProcessing
9+ java_import 'milchreis.imageprocessing.Glitch'
10+
11+ attr_reader :my_image
12+
13+ def setup
14+ sketch_title 'Glitch'
15+ # Load image
16+ @my_image = load_image ( data_path ( 'example.jpg' ) )
17+ end
18+
19+ def draw
20+ return image ( my_image , 0 , 0 ) if mouse_pressed?
21+ intensity = map1d ( mouseX , 0 ..width , 0 ..4 )
22+ image ( Glitch . apply ( my_image , intensity ) , 0 , 0 )
23+ # You can also use:
24+ # Glitch.apply(image)
25+ # Glitch.apply(image, intensity, scanlineHeight)
26+ end
27+
28+ def settings
29+ size ( 550 , 550 )
30+ end
You can’t perform that action at this time.
0 commit comments