Skip to content

Commit 531f426

Browse files
committed
added javadoc to builder package
1 parent 23e01b7 commit 531f426

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

src/main/java/ch/bildspur/postfx/builder/PostFX.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,41 @@
55
import processing.core.PGraphics;
66

77
/**
8-
* Created by cansik on 01.04.17.
8+
* Basic PostFX api with builder pattern.
99
*/
1010
public class PostFX {
1111
PApplet sketch;
1212
PostFXSupervisor supervisor;
1313
PostFXBuilder builder;
1414

15+
/**
16+
* Create a new PostFX context.
17+
*
18+
* @param sketch Processing context.
19+
*/
1520
public PostFX(PApplet sketch) {
1621
this.sketch = sketch;
1722
supervisor = new PostFXSupervisor(sketch);
1823
builder = new PostFXBuilder(this, supervisor);
1924
}
2025

26+
/**
27+
* @param sketch Processing context.
28+
* @param width Width of the pass buffer.
29+
* @param height Height of the pass buffer.
30+
*/
2131
public PostFX(PApplet sketch, int width, int height) {
2232
this.sketch = sketch;
2333
supervisor = new PostFXSupervisor(sketch, width, height);
2434
builder = new PostFXBuilder(this, supervisor);
2535
}
2636

37+
/**
38+
* Start rendering a texture.
39+
*
40+
* @param graphics Texture used to render.
41+
* @return PostFXBuilder pattern object.
42+
*/
2743
public PostFXBuilder render(PGraphics graphics) {
2844
supervisor.render(graphics);
2945
return builder;

src/main/java/ch/bildspur/postfx/builder/PostFXBuilder.java

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import java.util.Map;
1212

1313
/**
14-
* Created by cansik on 01.04.17.
14+
* PostFX builder pattern.
1515
*/
1616
public 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

Comments
 (0)