Promote filters to stable - no experimental flag

pull/704/head
Mattia Iavarone 6 years ago
parent d8d95ad029
commit db1c60a948
  1. 12
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  2. 3
      cameraview/src/main/res/values/attrs.xml
  3. 6
      docs/_posts/2019-08-06-filters.md

@ -667,7 +667,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
break;
case FILTER_CONTROL_1:
if (!mExperimental) break;
if (getFilter() instanceof OneParameterFilter) {
OneParameterFilter filter = (OneParameterFilter) getFilter();
oldValue = filter.getParameter1();
@ -679,7 +678,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
break;
case FILTER_CONTROL_2:
if (!mExperimental) break;
if (getFilter() instanceof TwoParameterFilter) {
TwoParameterFilter filter = (TwoParameterFilter) getFilter();
oldValue = filter.getParameter2();
@ -2333,11 +2331,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
} else {
boolean isNoFilter = filter instanceof NoFilter;
boolean isFilterPreview = mCameraPreview instanceof FilterCameraPreview;
// If not experimental, we only allow NoFilter (called on creation).
if (!isNoFilter && !mExperimental) {
throw new RuntimeException("Filters are an experimental features and" +
" need the experimental flag set.");
}
// If not a filter preview, we only allow NoFilter (called on creation).
if (!isNoFilter && !isFilterPreview) {
throw new RuntimeException("Filters are only supported by the GL_SURFACE preview." +
@ -2362,10 +2355,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
*/
@NonNull
public Filter getFilter() {
if (!mExperimental) {
throw new RuntimeException("Filters are an experimental features and need " +
"the experimental flag set.");
} else if (mCameraPreview == null) {
if (mCameraPreview == null) {
return mPendingFilter;
} else if (mCameraPreview instanceof FilterCameraPreview) {
return ((FilterCameraPreview) mCameraPreview).getCurrentFilter();

@ -25,6 +25,9 @@
<attr name="cameraSnapshotMaxWidth" format="integer|reference" />
<attr name="cameraSnapshotMaxHeight" format="integer|reference" />
<!--attr name="cameraFrameProcessingMaxWidth" format="integer|reference" />
<attr name="cameraFrameProcessingMaxHeight" format="integer|reference" /-->
<attr name="cameraVideoBitRate" format="integer|reference" />
<attr name="cameraAudioBitRate" format="integer|reference" />
<attr name="cameraPreviewFrameRate" format="integer|reference" />

@ -13,10 +13,8 @@ Starting from version `2.1.0`, CameraView experimentally supports real-time filt
the camera frames before they are shown and recorded. Just like [overlays](watermarks-and-overlays.html),
these filters are applied to the preview and to any [picture or video snapshots](capturing-media.html).
Conditions:
- you must set the experimental flag: `app:cameraExperimental="true"`
- you must use `Preview.GL_SURFACE` as a preview
Starting from `2.5.0`, this feature is considered to be stable and you do not need the experimental
flag to use it. The only condition is to use the `Preview.GL_SURFACE` preview.
### Simple usage

Loading…
Cancel
Save