• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Size2类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Size2的典型用法代码示例。如果您正苦于以下问题:C# Size2类的具体用法?C# Size2怎么用?C# Size2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Size2类属于命名空间,在下文中一共展示了Size2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProgressBar

        public ProgressBar(GUIControl parent)
            : base("", parent)
        {
            size=	new Size2(120, 32);
            pHorizontal=	true;
            pProgress=	0f;
            pAutoLabel=	true;
            pProgressColors=	new GUIColorPacket
            (
                new Color(0, 200, 0),
                new Color(230, 230, 230),
                new Color(0, 200, 150),
                new Color(0, 150, 150)
            );
            pProgressLeftColors=	new GUIColorPacket
            (
                new Color(200, 0, 0),
                new Color(100, 100, 100),
                new Color(200, 100, 50),
                new Color(200, 0, 0)
            );

            pAutoAdjustSize=	false;
            pBGColors.normal=	new Color(25, 25, 25);
            pBGColors.disabled=	new Color(0, 0, 0);

            addEvent("onProgressChanged");
            addEvent("onProgressColorsChanged");
            addEvent("onProgressLeftColorsChanged");
        }
开发者ID:pgonzbecer,项目名称:GDToolkit,代码行数:30,代码来源:ProgressBar.cs


示例2: Rectangle2

 public Rectangle2(Point2 point, Size2 sizeF)
 {
     X = point.X;
     Y = point.Y;
     Width = sizeF.Width;
     Height = sizeF.Height;
 }
开发者ID:JurgenCox,项目名称:compbio-base,代码行数:7,代码来源:Rectangle2.cs


示例3: MemoryMappedTexture32bpp

 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryMappedTexture32bpp"/> class.
 /// </summary>
 /// <param name="size">The total size of the texture.</param>
 public MemoryMappedTexture32bpp(Size2 size)
 {
     m_pointer = Marshal.AllocHGlobal(size.Width * size.Height * 4);
     m_pointerNative = (int*)m_pointer.ToPointer();
     m_size = size;
     m_countInts = m_size.Width * m_size.Height;
 }
开发者ID:jtpgames,项目名称:Kinect-Recorder,代码行数:11,代码来源:MemoryMappedTexture32bpp.cs


示例4: init

        protected override void init(Stream stream, bool flip, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                using (var imageData = NSData.FromStream(stream))
                using (var image = UIImage.LoadFromData(imageData))
                {
                    int width = (int)image.Size.Width;
                    int height = (int)image.Size.Height;
                    Mipmaps = new Mipmap[1];
                    Size = new Size2(width, height);

                    var data = new byte[width * height * 4];
                    using (CGContext imageContext = new CGBitmapContext(data, width, height, 8, width*4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
                    {
                        imageContext.DrawImage(new RectangleF(0, 0, width, height), image.CGImage);

                        Mipmaps[0] = new Mipmap(data, width, height, 1, 4);
                        if (flip) Mipmaps[0].FlipVertical();
                    }
                }
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                if (loadedCallback != null) loadedCallback(this, false);
                return;
            }

            Loaded = true;
            if (loadedCallback != null) loadedCallback(this, true);
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:33,代码来源:ImageIOS.cs


示例5: SDXBitmapFromSysBitmap

        private SharpDX.Direct2D1.Bitmap SDXBitmapFromSysBitmap(WindowRenderTarget device, System.Drawing.Bitmap bitmap)
        {
            var sourceArea = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height);
            var bitmapProperties = new BitmapProperties(new PixelFormat(SharpDX.DXGI.Format.R8G8B8A8_UNorm, AlphaMode.Premultiplied));
            var size = new Size2(bitmap.Width, bitmap.Height);

            // Transform pixels from BGRA to RGBA
            int stride = bitmap.Width * sizeof(int);
            using (var tempStream = new DataStream(bitmap.Height * stride, true, true))
            {
                // Lock System.Drawing.Bitmap
                var bitmapData = bitmap.LockBits(sourceArea, System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);

                // Convert all pixels 
                for (int y = 0; y < bitmap.Height; y++)
                {
                    int offset = bitmapData.Stride * y;
                    for (int x = 0; x < bitmap.Width; x++)
                    {
                        // Not optimized 
                        byte B = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte G = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte R = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte A = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        int rgba = R | (G << 8) | (B << 16) | (A << 24);
                        tempStream.Write(rgba);
                    }

                }
                bitmap.UnlockBits(bitmapData);
                tempStream.Position = 0;

                return new SharpDX.Direct2D1.Bitmap(device, size, tempStream, stride, bitmapProperties);
            }
        }
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:35,代码来源:ESP.cs


示例6: Initialize

        /// <summary>Initializes the specified view.</summary>
        /// <param name="view">The view.</param>
        /// <exception cref="System.ArgumentException">Expecting argument to be a ShaderResourceView or RenderTargetView;view</exception>
        protected override void Initialize(DeviceChild view)
        {
            // The initialize method will override the view.Tag, so we are setting it back
            base.Initialize(view);

            IsRenderView = view is RenderTargetView;

            var shaderResourceView = view as ShaderResourceView;
            int mipLevel = 0;
            if (shaderResourceView != null)
            {
                var description = shaderResourceView.Description;
                mipLevel = description.Texture1D.MostDetailedMip;
            }
            else
            {
                var renderTargetView = view as RenderTargetView;
                if (renderTargetView == null)
                {
                    throw new ArgumentException("Expecting argument to be a ShaderResourceView or RenderTargetView", "view");
                }
                mipLevel = renderTargetView.Description.Texture1D.MipSlice;
            }
            Size = new Size2(Math.Max(1, Texture.Width >> mipLevel), Math.Max(1, Texture.Height >> mipLevel));

            TexelSize = new Size2F
            {
                Width = 1.0f / Size.Width,
                Height = 1.0f / Size.Height
            };
        }
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:34,代码来源:TextureView.cs


示例7: New

        public static IViewPort New(VideoTypes videoType, IDisposableResource parent, Point2 location, Size2 size)
        {
            IViewPort api = null;

            #if WIN32
            if (videoType == VideoTypes.D3D9) api = new D3D9.ViewPort(parent, location, size);
            #endif

            #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11) api = new D3D11.ViewPort(parent, location, size);
            #endif

            #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL) api = new OpenGL.ViewPort(parent, location, size);
            #endif

            #if XNA
            if (videoType == VideoTypes.XNA) api = new XNA.ViewPort(parent, location, size);
            #endif

            #if VITA
            if (videoType == VideoTypes.Vita) api = new Vita.ViewPort(parent, location, size);
            #endif

            if (api == null) Debug.ThrowError("ViewPortAPI", "Unsuported InputType: " + videoType);
            return api;
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:27,代码来源:ViewPort.cs


示例8: DX11Renderer

        public DX11Renderer(IntPtr windowHandle, Size2 size, Device dev = null)
        {
            RenderSize = size;
            _windowHandle = windowHandle;
            if(dev != null)
            {
                _dxDevice = dev;
            }
            else
            {
                var swapchainDesc = new SwapChainDescription()
                {
                    BufferCount = 2,
                    ModeDescription =
                        new ModeDescription(size.Width, size.Height,
                                            new Rational(60, 1), Format.R8G8B8A8_UNorm),
                    IsWindowed = true,
                    OutputHandle = windowHandle,
                    SampleDescription = new SampleDescription(1, 0),
                    SwapEffect = SwapEffect.Discard,
                    Usage = Usage.RenderTargetOutput
                };

                // Create Device and SwapChain
                Device.CreateWithSwapChain(DriverType.Hardware,
                   DeviceCreationFlags.None, swapchainDesc, out _dxDevice, out _swapChain);

                // Ignore all windows events
                //    var factory = _swapChain.GetParent<Factory>();
                //    factory.MakeWindowAssociation(windowHandle, WindowAssociationFlags.None);

                Reset(size.Width, size.Height);
            }
        }
开发者ID:KFlaga,项目名称:Cam3D,代码行数:34,代码来源:DX11Renderer.cs


示例9: WorldToScreen

 public static Vector2[] WorldToScreen(Matrix4x4 viewMatrix, Size2 screenSize, params Vector3[] points)
 {
     Vector2[] worlds = new Vector2[points.Length];
     for (int i = 0; i < worlds.Length; i++)
         worlds[i] = WorldToScreen(viewMatrix, screenSize, points[i]);
     return worlds;
 }
开发者ID:nkarpey,项目名称:Zat-s-External-CSGO-Multihack,代码行数:7,代码来源:Geometry.cs


示例10: DirectXTexture

        /// <summary>
        /// Initializes a new DirectXTexture class.
        /// </summary>
        /// <param name="bmp">The Bitmap.</param>
        internal DirectXTexture(System.Drawing.Bitmap bmp)
        {
            RawBitmap = (System.Drawing.Bitmap) bmp.Clone();
            _width = bmp.Width;
            _height = bmp.Height;
            var sourceArea = new Rectangle(0, 0, bmp.Width, bmp.Height);
            var bitmapProperties = new BitmapProperties(
                new PixelFormat(Format.R8G8B8A8_UNorm, AlphaMode.Premultiplied), 96, 96);
            var size = new Size2(bmp.Width, bmp.Height);

            int stride = bmp.Width*sizeof (int);
            using (var tempStream = new DataStream(bmp.Height*stride, true, true))
            {
                BitmapData bitmapData = bmp.LockBits(sourceArea, ImageLockMode.ReadOnly,
                    System.Drawing.Imaging.PixelFormat.Format32bppPArgb);

                for (int y = 0; y < bmp.Height; y++)
                {
                    int offset = bitmapData.Stride*y;
                    for (int x = 0; x < bmp.Width; x++)
                    {
                        byte b = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte g = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte r = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        byte a = Marshal.ReadByte(bitmapData.Scan0, offset++);
                        int rgba = r | (g << 8) | (b << 16) | (a << 24);
                        tempStream.Write(rgba);
                    }
                }
                bmp.UnlockBits(bitmapData);
                tempStream.Position = 0;
                _bmp = new Bitmap(DirectXHelper.RenderTarget, size, tempStream, stride, bitmapProperties);
            }
        }
开发者ID:ThuCommix,项目名称:Sharpex2D,代码行数:38,代码来源:DirectXTexture.cs


示例11: Size2_IsConstructedProperly

        public void Size2_IsConstructedProperly()
        {
            var result = new Size2(123, 456);

            TheResultingValue(result)
                .ShouldBe(123, 456);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:7,代码来源:Size2Tests.cs


示例12: init

        protected override void init(Stream stream, bool flip, Loader.LoadedCallbackMethod loadedCallback)
        {
            try
            {
                using (var image = NSImage.FromStream(stream))
                {
                    var rep = image.Representations()[0];
                    int width = rep.PixelsWide;
                    int height = rep.PixelsHigh;
                    Mipmaps = new Mipmap[1];
                    Size = new Size2(width, height);

                    var data = new byte[width * height * 4];
                    var emptyRect = RectangleF.Empty;
                    using (CGContext imageContext = new CGBitmapContext(data, width, height, 8, width*4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
                    using (var cgImage = image.AsCGImage(ref emptyRect, null, null))
                    {
                        imageContext.DrawImage(new RectangleF(0, 0, width, height), cgImage);

                        Mipmaps[0] = new Mipmap(data, width, height, 1, 4);
                        if (flip) Mipmaps[0].FlipVertical();
                    }
                }
            }
            catch (Exception e)
            {
                FailedToLoad = true;
                Loader.AddLoadableException(e);
                if (loadedCallback != null) loadedCallback(this, false);
                return;
            }

            Loaded = true;
            if (loadedCallback != null) loadedCallback(this, true);
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:35,代码来源:ImageOSX.cs


示例13: Size2_Area_IsCalculatedCorrectly

        public void Size2_Area_IsCalculatedCorrectly()
        {
            var size1 = new Size2(123, 456);
            TheResultingValue(size1.Area).ShouldBe(123 * 456);

            var size2 = new Size2(222, 55555);
            TheResultingValue(size2.Area).ShouldBe(222 * 55555);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:8,代码来源:Size2Tests.cs


示例14: Size2_EqualsObject

        public void Size2_EqualsObject()
        {
            var size1 = new Size2(123, 456);
            var size2 = new Size2(123, 456);

            TheResultingValue(size1.Equals((Object)size2)).ShouldBe(true);
            TheResultingValue(size1.Equals("This is a test")).ShouldBe(false);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:8,代码来源:Size2Tests.cs


示例15: GetTextureClip

 public SharpDX.RectangleF GetTextureClip(Size2 outputSize)
 {
   lock (_imageSync)
   {
     Size imageSize = ImageSize;
     SharpDX.RectangleF textureClip = _animator.GetZoomRect(new Size2(imageSize.Width, imageSize.Height), outputSize, DateTime.Now);
     return new SharpDX.RectangleF(textureClip.X * _textureMaxUv.Width, textureClip.Y * _textureMaxUv.Height, textureClip.Width * _textureMaxUv.Width, textureClip.Height * _textureMaxUv.Height);
   }
 }
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:9,代码来源:ImagePlayer.cs


示例16: DepthStencil

        public DepthStencil(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats)
            : base(parent)
        {
            try
            {
                var video = parent.FindParentOrSelfWithException<Video>();
                Size = new Size2(width, height);
                SizeF = Size.ToVector2();

                int depthBit = 16, stencilBit = 0;
                switch (depthStencilFormats)
                {
                    case DepthStencilFormats.Defualt:
                        depthBit = 24;
                        stencilBit = 0;
                        break;

                    case DepthStencilFormats.Depth24Stencil8:
                        depthBit = 24;
                        stencilBit = 8;
                        break;

                    case DepthStencilFormats.Depth16:
                        depthBit = 16;
                        stencilBit = 0;
                        break;

                    case DepthStencilFormats.Depth24:
                        depthBit = 24;
                        stencilBit = 0;
                        break;

                    case DepthStencilFormats.Depth32:
                        depthBit = 32;
                        stencilBit = 0;
                        break;

                    default:
                        Debug.ThrowError("Video", "Unsuported DepthStencilFormat type");
                        break;
                }

                com = new DepthStencilCom();
                var error = com.Init(video.com, width, height, depthBit, stencilBit);

                switch (error)
                {
                    case DepthStencilErrors.Textrue: Debug.ThrowError("DepthStencil", "Failed to create Texture2D"); break;
                    case DepthStencilErrors.DepthStencilView: Debug.ThrowError("DepthStencil", "Failed to create DepthStencilView"); break;
                }
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:57,代码来源:DepthStencil.cs


示例17: Init

        public void Init(ApplicationDesc desc)
        {
            OS.CurrentApplication = this;
            CurrentApplication = this;
            theEvent = new ApplicationEvent();

            if (desc.FrameSize.Width == 0 || desc.FrameSize.Height == 0) FrameSize = new Size2(512, 512);
            else FrameSize = desc.FrameSize;
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:9,代码来源:NaClApplication.cs


示例18: Size2_EqualsSize2

        public void Size2_EqualsSize2()
        {
            var size1 = new Size2(123, 456);
            var size2 = new Size2(123, 456);
            var size3 = new Size2(123, 555);
            var size4 = new Size2(222, 456);

            TheResultingValue(size1.Equals(size2)).ShouldBe(true);
            TheResultingValue(size1.Equals(size3)).ShouldBe(false);
            TheResultingValue(size1.Equals(size4)).ShouldBe(false);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:11,代码来源:Size2Tests.cs


示例19: Size2_OpInequality

        public void Size2_OpInequality()
        {
            var size1 = new Size2(123, 456);
            var size2 = new Size2(123, 456);
            var size3 = new Size2(123, 555);
            var size4 = new Size2(222, 456);

            TheResultingValue(size1 != size2).ShouldBe(false);
            TheResultingValue(size1 != size3).ShouldBe(true);
            TheResultingValue(size1 != size4).ShouldBe(true);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:11,代码来源:Size2Tests.cs


示例20: Font

 internal Font()
 {
     glyphs=	new Dictionary<char, FontGlyphCollection>();
     maxSize=	Size2.NO_SIZE;
     bitmap=	null;
     wordSpacing=	10f;
     size=	14f;
     pOriginalSize=	14f;
     pName=	"";
     texture=	Texture.NULL;
 }
开发者ID:pgonzbecer,项目名称:GDToolkit,代码行数:11,代码来源:Font.cs



注:本文中的Size2类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Size2D类代码示例发布时间:2022-05-24
下一篇:
C# Size类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap