×

Discussion Board

Results 1 to 7 of 7

Threaded View

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    30

    Blend filter is slower than demo example

    Hi,
    I'm studing the RealtimeBlend Demo and the blend operation in this example is very fast.
    The texture move and pan over the camera frame is very fast.

    I'm trying to make a similar thing but instead of the camera source I have a static image but the blend operation is slow and the drag and pan is jerky.

    This is the blend function

    Code:
    WriteableBitmap wb = new WriteableBitmap(bi.PixelWidth, bi.PixelHeight);
    
    backgroundSource = new StreamImageSource(imgModel.BackgroundImage);
    foregroundImageSource = new StreamImageSource(imgModel.ForegroundImage);
    foregroundMaskSource = new BitmapImageSource(imgModel.MaskBitmap.AsBitmap());
    filterEffect = new FilterEffect(backgroundSource);
    blendFilter = new BlendFilter(foregroundImageSource);
    renderer = new WriteableBitmapRenderer(filterEffect, wb, OutputOption.PreserveAspectRatio);
    
    BlendImages();
    
    private async void BlendImages()
            {
                if (!_rendering)
                {
                    _rendering = true;
                   
                    imgModel.BackgroundImage.Position = 0;
                    imgModel.ForegroundImage.Position = 0;
    
                    blendFilter.Level = 1;
                    blendFilter.MaskSource = foregroundMaskSource;
                    blendFilter.BlendFunction = BlendFunction.Normal;
                    blendFilter.TargetArea = new Windows.Foundation.Rect(
                        _position.X - (_scale / 2),
                        _position.Y - (_scale / 2),
                        _scale,
                        _scale);
                    blendFilter.TargetAreaRotation = _angle;
                    blendFilter.TargetOutputOption = OutputOption.PreserveAspectRatio;
    
                    filterEffect.Filters = new IFilter[] { blendFilter };
    
                    var buffer = await renderer.RenderAsync();
                    FuseImageResult.Source= buffer;
    
                    _rendering = false;
                }
            }
    BlendImages is called after calculating _position and _scale on manipulation event

    What am I doing wrong?

    Thanks
    Damiano
    Last edited by DamMen; 2014-04-11 at 22:41.

Similar Threads

  1. Problem Call & SMS Filter / Anruf & SMS-Filter OS for Developer Bug?
    By Grisu_1968 in forum Windows Phone General
    Replies: 2
    Last Post: 2014-02-02, 20:16
  2. Replies: 1
    Last Post: 2014-01-29, 20:57
  3. I use http to download,but the speed become slower and slower.
    By flashtao613 in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-12-31, 08:34
  4. I use http to download,but the speed become slower and slower.
    By xmnlk in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2008-10-14, 15:58
  5. Replies: 2
    Last Post: 2008-09-30, 11:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×