當前位置: 首頁>>代碼示例>>C#>>正文


C# Surface.CreateStretchedSurface方法代碼示例

本文整理匯總了C#中SdlDotNet.Graphics.Surface.CreateStretchedSurface方法的典型用法代碼示例。如果您正苦於以下問題:C# Surface.CreateStretchedSurface方法的具體用法?C# Surface.CreateStretchedSurface怎麽用?C# Surface.CreateStretchedSurface使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SdlDotNet.Graphics.Surface的用法示例。


在下文中一共展示了Surface.CreateStretchedSurface方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DarknessOverlay

        public DarknessOverlay(int newRange)
        {
            disposed = false;
            range = newRange;
            buffer = new Surface(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT);
            Surface holepart = new Surface(14 * Constants.TILE_WIDTH, 14 * Constants.TILE_HEIGHT);
            for (int x = 0; x < 14; x++) {
                for (int y = 0; y < 14; y++) {
                    holepart.Blit(GraphicsManager.Tiles[10][210 + x + 14 * y], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
                }
            }

            Surface hole = new Surface(28 * Constants.TILE_WIDTH, 28 * Constants.TILE_HEIGHT);
            hole.Blit(holepart, new Point(0,0));
            hole.Blit(holepart.CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, -2));
            hole.Blit(holepart.CreateFlippedVerticalSurface(), new Point(0, hole.Height / 2));
            hole.Blit(holepart.CreateFlippedVerticalSurface().CreateFlippedHorizontalSurface(), new Point(hole.Width / 2, hole.Height / 2 - 2));
            hole = hole.CreateStretchedSurface(new Size((range) * Constants.TILE_WIDTH, (range) * Constants.TILE_HEIGHT));

            buffer.Blit(GraphicsManager.Tiles[10][45].CreateStretchedSurface(new Size(40 * Constants.TILE_WIDTH, 30 * Constants.TILE_HEIGHT)), new Point(0,0));
            buffer.Blit(hole, new Point(buffer.Width / 2 - hole.Width / 2, buffer.Height / 2 - hole.Height / 2));

            //buffer = hole;
            buffer.Transparent = true;

            buffer.AlphaBlending = true;
            buffer.Alpha = 180;
        }
開發者ID:blastboy,項目名稱:Client,代碼行數:28,代碼來源:DarknessOverlay.cs

示例2: SurfaceStretchHeight

		public void SurfaceStretchHeight()
		{
			Rectangle sourceRectangle = new Rectangle(0,0,100, 33);
			Rectangle destinationRectangle = new Rectangle(0, 0, 200, 132);
			Surface sourceSurf = new Surface(sourceRectangle);
			Surface surface = sourceSurf.CreateStretchedSurface(sourceRectangle, destinationRectangle);
			Assert.AreEqual(destinationRectangle.Height, surface.Height);
		}
開發者ID:erin100280,項目名稱:Zelda.NET,代碼行數:8,代碼來源:SdlTestVideo.cs

示例3: Go

        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            if (File.Exists(Path.Combine(dataDirectory, "snowbackground.png")))
            {
                filePath = "";
            }
            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Snow Demo";
            screen = Video.SetVideoMode(640, 480, 16);
            background = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "snowbackground.png")));
            background.Transparent = true;
            background.TransparentColor = Color.Magenta;

            tree = new Surface(Path.Combine(filePath, Path.Combine(dataDirectory, "Tree.bmp")));
            tree.TransparentColor = Color.Magenta;
            tree.Transparent = true;
            treeStretch = new Surface(tree);
            treeStretch = treeStretch.CreateStretchedSurface(new Size(100, 100));
            treeStretch.TransparentColor = Color.Magenta;
            treeStretch.Transparent = true;
            Initialize(250);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);
            Events.Run();
        }
開發者ID:erin100280,項目名稱:Zelda.NET,代碼行數:32,代碼來源:SnowDemo.cs


注:本文中的SdlDotNet.Graphics.Surface.CreateStretchedSurface方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。