blob: 0a907d5404fe975abc799a0a7586e82ab8cbd976 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package com.android.rs.refocus;
/**
* A struct containing all the data needed to apply a depth-of-field effect.
*
* @author chernand@google.com (Carlos Hernandez)
*/
public class DepthOfFieldOptions {
public final RGBZ rgbz;
public float focalDepth;
public float blurInfinity;
// The depth of field specifies the depth range in focus (i.e., zero blur) as
// a ratio of the focal depth. Its range is [0, 1). The depth of field range
// in depth units is computed as
// [(1 - depthOfField) * focalDepth,(1 + depthOfField) * focalDepth].
public float depthOfField;
/**
* Creates a {@code DepthOfFieldOptions} from an {@code RGBZ}.
*
* @param rgbz the {@code RGBZ} to render
*/
public DepthOfFieldOptions(RGBZ rgbz) {
this.focalDepth = (float)rgbz.getFocusDepth();
this.depthOfField = (float)rgbz.getDepthOfField();
this.blurInfinity = (float)rgbz.getBlurInfinity() * Math.max(rgbz.getHeight(), rgbz.getWidth());
this.rgbz = rgbz;
}
public void setFocusPoint(float x, float y) {
this.focalDepth = rgbz.getDepth((int)(x * rgbz.getWidth()), (int)(y * rgbz.getHeight()));
//this.blurInfinity = lensController.blurInfinityFromAverageBlur(this.focalDepth, this.depthOfField, averageBlur);
//System.out.println("new focal depth: " + this.focalDepth);
}
public void setBokeh(float bokeh) {
this.blurInfinity = bokeh * 200;
}
}
|