Approved
Last Updated: 16 Jan 2017 10:34 by ADMIN
ADMIN
Mihail
Created on: 10 Nov 2016 14:36
Category: ImageEditor
Type: Bug Report
0
Drawing on image could result in loss of quality
Drawing with the draw tool over the image with big size (e.g. 3000 x 2500) result in loss of quality.

Workaround: In the DrawCommand use the following method to create a BitmapSource which should be used for creating a RadBitmapImage.

public RadBitmap Execute(RadBitmap source, object context)
{
   ...
   ...
   ...
   BitmapSource bitmapSource = GetBitmapSource(source.Width, source.Height, canvas);
   return new RadBitmap(bitmapSource);
}
private BitmapSource GetBitmapSource(int width, int height, Canvas surface)
{
    Size size = new Size(width, height);

    surface.Measure(size);
    surface.Arrange(new Rect(size));

    // Create a render bitmap and push the surface to it
    RenderTargetBitmap renderBitmap =
        new RenderTargetBitmap(
        (int) size.Width,
        (int) size.Height,
        96d,
        96d,
        PixelFormats.Pbgra32);
    renderBitmap.Render(surface);

    return renderBitmap;
}
0 comments