Exemplo n.º 1
0
 internal static _Size Size() {
     if (_SizeFunc == null) {
         _SizeFunc =
             (_Size)Marshal.GetDelegateForFunctionPointer(
                 Torque3D.DllLoadUtils.GetProcAddress(
                     Torque3D.Torque3DLibHandle,
                     "fnGuiPopUpMenuCtrl_size"), typeof(_Size));
     }
     
     return _SizeFunc;
 }
Exemplo n.º 2
0
            internal static _Size Size()
            {
                if (_SizeFunc == null)
                {
                    _SizeFunc =
                        (_Size)Marshal.GetDelegateForFunctionPointer(
                            NativeLibrary.GetExport(
                                Torque3D.Torque3DLibHandle,
                                "fnGuiPopUpMenuCtrl_size"), typeof(_Size));
                }

                return(_SizeFunc);
            }
            private ImageSource makeLegendImageSource(ImageSource imgsrc, Brush brush, _Size size)
            {
                if (imgsrc is BitmapImage)
                {
                    BitmapImage bmp = imgsrc as BitmapImage;
                    Canvas      cv  = new Canvas()
                    {
                        Width      = size.Width,
                        Height     = size.Height,
                        Background = brush,
                    };

                    var img = new Image()
                    {
                        Source = imgsrc
                    };

                    Canvas.SetLeft(img, (size.Width - bmp.PixelWidth) / 2);
                    Canvas.SetTop(img, (size.Height - bmp.PixelHeight) / 2);
                    cv.Children.Add(img);
                    cv.Arrange(new Rect(new Size(size.Width, size.Height)));

                    var rtb = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Pbgra32);
                    rtb.Render(cv);

                    return(rtb);
                }
                else
                {
                    return(imgsrc);
                }
            }
Exemplo n.º 4
0
        /// <summary>
        /// This is used to automatically generate the collection of endpoints of an arrow callout.
        /// </summary>
        /// <param name="centerX">The center x of the content rectangle.</param>
        /// <param name="centerY">The center y of the content rectangle.</param>
        /// <param name="content">The content of this callout. Will automatically adjust the content rectangle according to this.</param>
        /// <returns>The endpoints of an arrow callout.</returns>
        private List <PointF> GetPointsForArrowCallout(float centerX, float centerY, string content)
        {
            _Size size = _engine.MeasureString(content);

            return(GetPointsForArrowCallout(centerX, centerY, (float)size.Width + 10, (float)size.Height + 10));
        }
Exemplo n.º 5
0
        /// <summary>
        /// This is used to automatically generate the collection of endpoints of an arrow callout.
        /// </summary>
        /// <param name="centerX">The center x of the content rectangle.</param>
        /// <param name="centerY">The center y of the content rectangle.</param>
        /// <param name="content">The content of this callout. Will automatically adjust the content rectangle according to this.</param>
        /// <returns>The endpoints of an arrow callout.</returns>
        PointCollection GetPointsForArrowCallout(double centerX, double centerY, string content)
        {
            _Size size = _engine.MeasureString(content);

            return(GetPointsForArrowCallout(centerX, centerY, (float)size.Width + 10, (float)size.Height + 10));
        }