View Issue Details

IDProjectCategoryView StatusLast Update
0001411NoesisGUIC# SDKpublic2019-11-13 11:06
Reporterdarthmaule2Assigned Tojsantos 
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
Product Version2.2.0b5 
Target VersionFixed in Version 
Summary0001411: Implement WPF's CroppedBitmap and TransformedBitmap classes
DescriptionThe WPF classes provide an easy way to view a zoomed portion of a BitmapSource object. We use this to magnify a portion of a recalled image during a measurement operation to precisely move a measurement cursor a fraction of a pixel.

Example of our usage of these classes:
private BitmapSource CreateZoomedImage(BitmapSource sourceImage, double zoomFactor, Point zoomCenter)
        {
            int sourceWidth = (int)(sourceImage.PixelWidth / zoomFactor);
            int sourceHeight = (int)(sourceImage.PixelHeight / zoomFactor);
            int sourceLeft = (int)zoomCenter.X - sourceWidth / 2;
            int sourceTop = (int)zoomCenter.Y - sourceHeight / 2;

            CroppedBitmap bitmap1 = new CroppedBitmap();
            bitmap1.BeginInit();
            bitmap1.Source = sourceImage;
            bitmap1.SourceRect = new Int32Rect(sourceLeft, sourceTop, sourceWidth, sourceHeight);
            bitmap1.EndInit();

            // zoomed image must have same dimensions as source image
            double scaleX = (double)sourceImage.PixelWidth / sourceWidth;
            double scaleY = (double)sourceImage.PixelHeight / sourceHeight;

            TransformedBitmap bitmap2 = new TransformedBitmap();
            bitmap2.BeginInit();
            bitmap2.Source = bitmap1;
            bitmap2.Transform = new ScaleTransform(scaleX, scaleY);
            bitmap2.EndInit();

            return bitmap2;
        }
TagsNo tags attached.
PlatformAny

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-02-23 11:38 darthmaule2 New Issue
2019-02-25 16:01 jsantos Assigned To => jsantos
2019-02-25 16:01 jsantos Status new => assigned