Image Editor Effect property can not be saved

2 posts, 0 answers
  1. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 02 Dec 2011 Link to this post

    I have set the .Effect property to a custom effect.

    In the Image Editor UI, this displays fine, but when i save the image, the effect is not saved. I have coded multiple other changes such as rotate, contrast, etc... and those changes are saved properly, so this can not be due to the code that saves the image. It appears like the effect is not really applied to the image in the editor.

    I have following code that should apply the effect to the image:

    Grid grid = new Grid();
     
    SepiaEffect sEffect = new SepiaEffect { TintColor = Color.FromArgb(255, 229, 178, 76) };
     
    Image img = new Image { Source = CurrentImageEditor.Image.Bitmap, Effect=sEffect};
    grid.Children.Add(img);
     
    CurrentImageEditor.Image = new RadBitmap(CurrentImageEditor.Image.Width, CurrentImageEditor.Image.Height, grid);

    But this only works when i first apply a tool to the editor, otherwise it blanks out the image.

    How can i make the effect "permanent" on the image editor?


  2. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 08 Dec 2011 Link to this post

    Hi Peter,

    Your solution may work in some cases, but it is not optimal. The correct way to implement a custom effect would be to adhere to the command pattern the ImageEditor follows. You have to implement the IImageCommand interface, instantiate your class and pass it to the ExecuteCommand method of RadImageEditor. This way the image will be updated correctly and the right information would be put on the undo stack.
    You can also have a look at the "Shaders" section of this blog post.
    Let us know if you need additional information.

    All the best,
    Ivailo Karamanolev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top