Java Code Examples for org.telegram.messenger.MediaController#SavedFilterState

The following examples show how to use org.telegram.messenger.MediaController#SavedFilterState . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhotoFilterView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public MediaController.SavedFilterState getSavedFilterState() {
    MediaController.SavedFilterState state = new MediaController.SavedFilterState();
    state.enhanceValue = enhanceValue;
    state.exposureValue = exposureValue;
    state.contrastValue = contrastValue;
    state.warmthValue = warmthValue;
    state.saturationValue = saturationValue;
    state.fadeValue = fadeValue;
    state.tintShadowsColor = tintShadowsColor;
    state.tintHighlightsColor = tintHighlightsColor;
    state.highlightsValue = highlightsValue;
    state.shadowsValue = shadowsValue;
    state.vignetteValue = vignetteValue;
    state.grainValue = grainValue;
    state.blurType = blurType;
    state.sharpenValue = sharpenValue;
    state.curvesToolValue = curvesToolValue;
    state.blurExcludeSize = blurExcludeSize;
    state.blurExcludePoint = blurExcludePoint;
    state.blurExcludeBlurSize = blurExcludeBlurSize;
    state.blurAngle = blurAngle;
    return state;
}
 
Example 2
Source File: PhotoFilterView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public MediaController.SavedFilterState getSavedFilterState() {
    MediaController.SavedFilterState state = new MediaController.SavedFilterState();
    state.enhanceValue = enhanceValue;
    state.exposureValue = exposureValue;
    state.contrastValue = contrastValue;
    state.warmthValue = warmthValue;
    state.saturationValue = saturationValue;
    state.fadeValue = fadeValue;
    state.tintShadowsColor = tintShadowsColor;
    state.tintHighlightsColor = tintHighlightsColor;
    state.highlightsValue = highlightsValue;
    state.shadowsValue = shadowsValue;
    state.vignetteValue = vignetteValue;
    state.grainValue = grainValue;
    state.blurType = blurType;
    state.sharpenValue = sharpenValue;
    state.curvesToolValue = curvesToolValue;
    state.blurExcludeSize = blurExcludeSize;
    state.blurExcludePoint = blurExcludePoint;
    state.blurExcludeBlurSize = blurExcludeBlurSize;
    state.blurAngle = blurAngle;
    return state;
}
 
Example 3
Source File: PhotoFilterView.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public MediaController.SavedFilterState getSavedFilterState() {
    MediaController.SavedFilterState state = new MediaController.SavedFilterState();
    state.enhanceValue = enhanceValue;
    state.exposureValue = exposureValue;
    state.contrastValue = contrastValue;
    state.warmthValue = warmthValue;
    state.saturationValue = saturationValue;
    state.fadeValue = fadeValue;
    state.tintShadowsColor = tintShadowsColor;
    state.tintHighlightsColor = tintHighlightsColor;
    state.highlightsValue = highlightsValue;
    state.shadowsValue = shadowsValue;
    state.vignetteValue = vignetteValue;
    state.grainValue = grainValue;
    state.blurType = blurType;
    state.sharpenValue = sharpenValue;
    state.curvesToolValue = curvesToolValue;
    state.blurExcludeSize = blurExcludeSize;
    state.blurExcludePoint = blurExcludePoint;
    state.blurExcludeBlurSize = blurExcludeBlurSize;
    state.blurAngle = blurAngle;
    return lastState = state;
}
 
Example 4
Source File: PhotoFilterView.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public MediaController.SavedFilterState getSavedFilterState() {
    MediaController.SavedFilterState state = new MediaController.SavedFilterState();
    state.enhanceValue = enhanceValue;
    state.exposureValue = exposureValue;
    state.contrastValue = contrastValue;
    state.warmthValue = warmthValue;
    state.saturationValue = saturationValue;
    state.fadeValue = fadeValue;
    state.tintShadowsColor = tintShadowsColor;
    state.tintHighlightsColor = tintHighlightsColor;
    state.highlightsValue = highlightsValue;
    state.shadowsValue = shadowsValue;
    state.vignetteValue = vignetteValue;
    state.grainValue = grainValue;
    state.blurType = blurType;
    state.sharpenValue = sharpenValue;
    state.curvesToolValue = curvesToolValue;
    state.blurExcludeSize = blurExcludeSize;
    state.blurExcludePoint = blurExcludePoint;
    state.blurExcludeBlurSize = blurExcludeBlurSize;
    state.blurAngle = blurAngle;
    return lastState = state;
}
 
Example 5
Source File: MediaCodecVideoConvertor.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public boolean convertVideo(String videoPath, File cacheFile,
                            int rotationValue, boolean isSecret,
                            int resultWidth, int resultHeight,
                            int framerate, int bitrate,
                            long startTime, long endTime,
                            boolean needCompress, long duration,
                            MediaController.SavedFilterState savedFilterState,
                            String paintPath,
                            ArrayList<VideoEditedInfo.MediaEntity> mediaEntities,
                            boolean isPhoto,
                            MediaController.VideoConvertorListener callback) {
    this.callback = callback;
    return convertVideoInternal(videoPath, cacheFile, rotationValue, isSecret,
            resultWidth, resultHeight, framerate, bitrate, startTime, endTime, duration, needCompress, false, savedFilterState, paintPath, mediaEntities, isPhoto);
}
 
Example 6
Source File: OutputSurface.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void setup(MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, ArrayList<VideoEditedInfo.MediaEntity> mediaEntities, int w, int h, float fps, boolean photo) {
    mTextureRender = new TextureRenderer(rotateRender, savedFilterState, imagePath, paintPath, mediaEntities, w, h, fps, photo);
    mTextureRender.surfaceCreated();
    mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());
    mSurfaceTexture.setOnFrameAvailableListener(this);
    mSurface = new Surface(mSurfaceTexture);
}
 
Example 7
Source File: MediaCodecVideoConvertor.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public boolean convertVideo(String videoPath, File cacheFile,
                            int rotationValue, boolean isSecret,
                            int resultWidth, int resultHeight,
                            int framerate, int bitrate,
                            long startTime, long endTime,
                            boolean needCompress, long duration,
                            MediaController.SavedFilterState savedFilterState,
                            String paintPath,
                            ArrayList<VideoEditedInfo.MediaEntity> mediaEntities,
                            boolean isPhoto,
                            MediaController.VideoConvertorListener callback) {
    this.callback = callback;
    return convertVideoInternal(videoPath, cacheFile, rotationValue, isSecret,
            resultWidth, resultHeight, framerate, bitrate, startTime, endTime, duration, needCompress, false, savedFilterState, paintPath, mediaEntities, isPhoto);
}
 
Example 8
Source File: OutputSurface.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void setup(MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, ArrayList<VideoEditedInfo.MediaEntity> mediaEntities, int w, int h, float fps, boolean photo) {
    mTextureRender = new TextureRenderer(rotateRender, savedFilterState, imagePath, paintPath, mediaEntities, w, h, fps, photo);
    mTextureRender.surfaceCreated();
    mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());
    mSurfaceTexture.setOnFrameAvailableListener(this);
    mSurface = new Surface(mSurfaceTexture);
}
 
Example 9
Source File: TextureRenderer.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public TextureRenderer(int rotation, MediaController.SavedFilterState savedFilterState, String image, String paint, ArrayList<VideoEditedInfo.MediaEntity> entities, int w, int h, float fps, boolean photo) {
    rotationAngle = rotation;
    isPhoto = photo;
    float[] verticesData = {
            -1.0f, -1.0f,
            1.0f, -1.0f,
            -1.0f, 1.0f,
            1.0f, 1.0f,
    };
    float[] texData = {
            0.f, 0.f,
            1.f, 0.f,
            0.f, 1.f,
            1.f, 1.f,
    };

    verticesBuffer = ByteBuffer.allocateDirect(verticesData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    verticesBuffer.put(verticesData).position(0);

    textureBuffer = ByteBuffer.allocateDirect(texData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    textureBuffer.put(texData).position(0);

    verticesBuffer = ByteBuffer.allocateDirect(verticesData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    verticesBuffer.put(verticesData).position(0);

    bitmapVerticesBuffer = ByteBuffer.allocateDirect(bitmapData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    bitmapVerticesBuffer.put(bitmapData).position(0);

    Matrix.setIdentityM(mSTMatrix, 0);

    if (savedFilterState != null) {
        filterShaders = new FilterShaders(true);
        filterShaders.setDelegate(FilterShaders.getFilterShadersDelegate(savedFilterState));
    }
    videoWidth = w;
    videoHeight = h;
    imagePath = image;
    paintPath = paint;
    mediaEntities = entities;
    videoFps = fps == 0 ? 30 : fps;
}
 
Example 10
Source File: OutputSurface.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public OutputSurface(MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, ArrayList<VideoEditedInfo.MediaEntity> mediaEntities, int w, int h, float fps, boolean photo) {
    setup(savedFilterState, imagePath, paintPath, mediaEntities, w, h, fps, photo);
}
 
Example 11
Source File: TextureRenderer.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public TextureRenderer(int rotation, MediaController.SavedFilterState savedFilterState, String image, String paint, ArrayList<VideoEditedInfo.MediaEntity> entities, int w, int h, float fps, boolean photo) {
    rotationAngle = rotation;
    isPhoto = photo;
    float[] verticesData = {
            -1.0f, -1.0f,
            1.0f, -1.0f,
            -1.0f, 1.0f,
            1.0f, 1.0f,
    };
    float[] texData = {
            0.f, 0.f,
            1.f, 0.f,
            0.f, 1.f,
            1.f, 1.f,
    };

    verticesBuffer = ByteBuffer.allocateDirect(verticesData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    verticesBuffer.put(verticesData).position(0);

    textureBuffer = ByteBuffer.allocateDirect(texData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    textureBuffer.put(texData).position(0);

    verticesBuffer = ByteBuffer.allocateDirect(verticesData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    verticesBuffer.put(verticesData).position(0);

    bitmapVerticesBuffer = ByteBuffer.allocateDirect(bitmapData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    bitmapVerticesBuffer.put(bitmapData).position(0);

    Matrix.setIdentityM(mSTMatrix, 0);

    if (savedFilterState != null) {
        filterShaders = new FilterShaders(true);
        filterShaders.setDelegate(FilterShaders.getFilterShadersDelegate(savedFilterState));
    }
    videoWidth = w;
    videoHeight = h;
    imagePath = image;
    paintPath = paint;
    mediaEntities = entities;
    videoFps = fps == 0 ? 30 : fps;
}
 
Example 12
Source File: OutputSurface.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public OutputSurface(MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, ArrayList<VideoEditedInfo.MediaEntity> mediaEntities, int w, int h, float fps, boolean photo) {
    setup(savedFilterState, imagePath, paintPath, mediaEntities, w, h, fps, photo);
}