This is a migrated thread and some comments may be shown as answers.

Image Editor Effect property can not be saved

1 Answer 32 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
HDC
Top achievements
Rank 1
HDC asked on 02 Dec 2011, 08:38 PM

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?


1 Answer, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 08 Dec 2011, 09:44 AM
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 >>

Tags
ImageEditor
Asked by
HDC
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Share this question
or