Esempio n. 1
0
        /// <summary>Function to draw the texture.</summary>
        /// <param name="renderer">The renderer used to draw the texture.</param>
        /// <param name="image">The image being rendered.</param>
        /// <param name="batchState">The currently active batch render state.</param>
        protected override void OnDrawTexture(Gorgon2D renderer, IImageContent image, Gorgon2DBatchState batchState)
        {
            // We can use this for 3D textures because the texture is in slot 1, and slot 0, where the 2D texture is usually located is vacant and not used by the pixel shader.
            renderer.DrawFilledRectangle(TextureBounds,
                                         new GorgonColor(GorgonColor.White, Alpha),
                                         null,
                                         new DX.RectangleF(0, 0, 1, 1),
                                         0,
                                         textureSampler: GorgonSamplerState.PointFiltering);

            renderer.End();

            // Draw a frame around the volume rendering area.
            DX.RectangleF volRegion = _volRenderer.VolumeRegion;
            renderer.Begin();

            DX.Size2F textArea = renderer.DefaultFont.MeasureLine(Resources.GORIMG_TEXT_3DVIEW, false);
            renderer.DrawFilledRectangle(volRegion, new GorgonColor(GorgonColor.Black, 0.5f));
            renderer.DrawFilledRectangle(new DX.RectangleF(volRegion.Left - 1, volRegion.Bottom, volRegion.Width + 2, textArea.Height + 6), GorgonColor.White);
            renderer.DrawRectangle(new DX.RectangleF(volRegion.X - 1, volRegion.Y - 1, volRegion.Width + 2, volRegion.Height + 2), GorgonColor.White);
            renderer.DrawString("3D View", new DX.Vector2((volRegion.Right + volRegion.Left) / 2.0f - (textArea.Width / 2.0f), volRegion.Bottom + 3), color: GorgonColor.Black);

            renderer.End();

            _volRenderer.Render();

            return;
        }
Esempio n. 2
0
 /// <summary>Function to draw the texture.</summary>
 /// <param name="renderer">The renderer used to draw the texture.</param>
 /// <param name="image">The image being rendered.</param>
 /// <param name="batchState">The currently active batch render state.</param>
 protected override void OnDrawTexture(Gorgon2D renderer, IImageContent image, Gorgon2DBatchState batchState) =>
 // We can use this for 3D textures because the texture is in slot 1, and slot 0, where the 2D texture is usually located is vacant and not used by the pixel shader.
 renderer.DrawFilledRectangle(TextureBounds,
                              new GorgonColor(GorgonColor.White, Alpha),
                              _textureView,
                              new DX.RectangleF(0, 0, 1, 1),
                              image.CurrentArrayIndex,
                              textureSampler: GorgonSamplerState.PointFiltering);
 public static TransymOcrResult CreateSuccesResult(TimeSpan processTime, IImageContent imageContent, RawTransymOcrResult rawAzureOcrResult)
 {
     if (imageContent == null)
     {
         throw new ArgumentNullException(nameof(imageContent));
     }
     if (rawAzureOcrResult == null)
     {
         throw new ArgumentNullException(nameof(rawAzureOcrResult));
     }
     return(new TransymOcrResult(processTime, imageContent, null, rawAzureOcrResult));
 }
        /// <summary>Function called when a mouse button is released.</summary>
        /// <param name="position">The position of the mouse cursor.</param>
        /// <param name="buttons">The button(s) released.</param>
        /// <param name="image">The current image.</param>
        protected override void OnMouseUp(DX.Vector2 position, MouseButtons buttons, IImageContent image)
        {
            if (buttons != MouseButtons.Left)
            {
                return;
            }

            int cubeGroup = (image.CurrentArrayIndex / 6) * 6;

            for (int i = 0; i < _cubeImageBounds.Length; ++i)
            {
                if (_cubeImageBounds[i].Contains(position))
                {
                    image.CurrentArrayIndex = cubeGroup + i;
                    return;
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Function to retrieve the size, in pixels, if the current mip level.
 /// </summary>
 /// <param name="image">The image to retrieve mip information from.</param>
 /// <returns>The width and height of the mip level.</returns>
 public override DX.Size2 GetMipSize(IImageContent image) => image == null
         ? DX.Size2.Zero
         : new DX.Size2(_textureView.GetMipWidth(image.CurrentMipLevel), _textureView.GetMipHeight(image.CurrentMipLevel));
        /// <summary>Function to draw the texture.</summary>
        /// <param name="renderer">The renderer used to draw the texture.</param>
        /// <param name="image">The image being rendered.</param>
        /// <param name="batchState">The currently active batch render state.</param>
        protected override void OnDrawTexture(Gorgon2D renderer, IImageContent image, Gorgon2DBatchState batchState)
        {
            renderer.End();

            float imageWidth  = TextureBounds.Width / 4;
            float imageHeight = TextureBounds.Height / 3;

            float centerCanvasX = TextureBounds.Width / 2.0f + TextureBounds.Left;
            float centerCanvasY = TextureBounds.Height / 2.0f + TextureBounds.Top;

            float imageX = centerCanvasX - imageWidth;
            float imageY = centerCanvasY - (imageHeight / 2.0f);

            var bounds = new DX.RectangleF(imageX,
                                           imageY,
                                           imageWidth,
                                           imageHeight);

            int cubeGroup = image.CurrentArrayIndex / 6;

            _cubeImageBounds[0] = new DX.RectangleF(bounds.Left + bounds.Width, bounds.Top, bounds.Width, bounds.Height);
            _cubeImageBounds[1] = new DX.RectangleF(bounds.Left - bounds.Width, bounds.Top, bounds.Width, bounds.Height);
            _cubeImageBounds[2] = new DX.RectangleF(bounds.Left, bounds.Top - bounds.Height, bounds.Width, bounds.Height);
            _cubeImageBounds[3] = new DX.RectangleF(bounds.Left, bounds.Top + bounds.Height, bounds.Width, bounds.Height);
            _cubeImageBounds[4] = bounds;
            _cubeImageBounds[5] = new DX.RectangleF(bounds.Left + (bounds.Width * 2), bounds.Top, bounds.Width, bounds.Height);

            int selectedImage = image.CurrentArrayIndex % 6;

            renderer.Begin(batchState);

            for (int i = 0; i < 6; ++i)
            {
                renderer.DrawFilledRectangle(_cubeImageBounds[i],
                                             new GorgonColor(GorgonColor.White, Alpha),
                                             _textureView,
                                             new DX.RectangleF(0, 0, 1, 1),
                                             (cubeGroup * 6) + i,
                                             textureSampler: GorgonSamplerState.PointFiltering);
            }

            renderer.End();

            renderer.Begin();

            for (int i = 0; i < _cubeImageBounds.Length; ++i)
            {
                renderer.DrawRectangle(_cubeImageBounds[i], new GorgonColor(GorgonColor.Black, 0.88f), 1);
            }

            _selectionRect.Draw(_cubeImageBounds[selectedImage]);

            var offset = new DX.Vector2(0, _axisFont.MeasureLine("+X", true).Height);

            renderer.DrawString("+X", _cubeImageBounds[0].BottomLeft - offset, _axisFont, GorgonColor.White);
            renderer.DrawString("-X", _cubeImageBounds[1].BottomLeft - offset, _axisFont, GorgonColor.White);
            renderer.DrawString("+Y", _cubeImageBounds[2].BottomLeft - offset, _axisFont, GorgonColor.White);
            renderer.DrawString("-Y", _cubeImageBounds[3].BottomLeft - offset, _axisFont, GorgonColor.White);
            renderer.DrawString("+Z", _cubeImageBounds[4].BottomLeft - offset, _axisFont, GorgonColor.White);
            renderer.DrawString("-Z", _cubeImageBounds[5].BottomLeft - offset, _axisFont, GorgonColor.White);

            renderer.End();
        }
 protected TransymOcrResult(TimeSpan processTime, IImageContent imageContent, Exception error,
                            RawTransymOcrResult rawAzureOcrResult) : base(processTime, imageContent, error)
 {
     RawResult = rawAzureOcrResult;
 }
Esempio n. 8
0
 protected OcrResult(TimeSpan processTime, IImageContent imageContent, Exception error)
 {
     ProcessTime = processTime;
     Content     = imageContent;
     Error       = error;
 }