1111import java .util .Map ;
1212
1313/**
14- * Created by cansik on 01.04.17 .
14+ * PostFX builder pattern .
1515 */
1616public class PostFXBuilder {
1717 private PostFXSupervisor supervisor ;
@@ -49,20 +49,43 @@ private <T extends BasePass> T getPass(Class<T> type) {
4949 return pass ;
5050 }
5151
52+ /**
53+ * Compose and finalize rendering onto sketch texture.
54+ */
5255 public void compose () {
5356 supervisor .compose ();
5457 }
5558
59+ /**
60+ * Compose and finalize rendering.
61+ *
62+ * @param graphics Texture to render onto.
63+ */
5664 public void compose (PGraphics graphics ) {
5765 supervisor .compose (graphics );
5866 }
5967
68+ /**
69+ * Run a blur pass on the texture.
70+ *
71+ * @param blurSize Size of the blur.
72+ * @param sigma Sigma of the blur.
73+ * @return Builder object.
74+ */
6075 public PostFXBuilder blur (int blurSize , float sigma ) {
6176 blur (blurSize , sigma , false );
6277 blur (blurSize , sigma , true );
6378 return this ;
6479 }
6580
81+ /**
82+ * Run a blur pass on the texture.
83+ *
84+ * @param blurSize Size of the blur.
85+ * @param sigma Sigma of the blur.
86+ * @param horizontal Indicates if the pass runs horizontal or vertical.
87+ * @return Builder object.
88+ */
6689 public PostFXBuilder blur (int blurSize , float sigma , boolean horizontal ) {
6790 BlurPass pass = getPass (BlurPass .class );
6891
@@ -74,6 +97,12 @@ public PostFXBuilder blur(int blurSize, float sigma, boolean horizontal) {
7497 return this ;
7598 }
7699
100+ /**
101+ * Run a bright pass pass on the texture.
102+ *
103+ * @param threshold Threshold of the brightness.
104+ * @return Builder object.
105+ */
77106 public PostFXBuilder brightPass (float threshold ) {
78107 BrightPass pass = getPass (BrightPass .class );
79108
@@ -83,12 +112,22 @@ public PostFXBuilder brightPass(float threshold) {
83112 return this ;
84113 }
85114
115+ /**
116+ * Run a sobel edge detection pass on the texture.
117+ *
118+ * @return Builder object.
119+ */
86120 public PostFXBuilder sobel () {
87121 SobelPass pass = getPass (SobelPass .class );
88122 supervisor .pass (pass );
89123 return this ;
90124 }
91125
126+ /**
127+ * Run a toon pass on the texture.
128+ *
129+ * @return Builder object.
130+ */
92131 public PostFXBuilder toon () {
93132 ToonPass pass = getPass (ToonPass .class );
94133 supervisor .pass (pass );
0 commit comments