当前位置: 首页>>代码示例>>C#>>正文


C# Surface.Fill方法代码示例

本文整理汇总了C#中SdlDotNet.Graphics.Surface.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# Surface.Fill方法的具体用法?C# Surface.Fill怎么用?C# Surface.Fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SdlDotNet.Graphics.Surface的用法示例。


在下文中一共展示了Surface.Fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

 public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
 {
     if (chip != 0)
     {
         s.Fill(r, _foreColor);
     }
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:7,代码来源:BinaryChipData.cs

示例2: UpdateSurfaces

        public void UpdateSurfaces()
        {
            mButtonUpBounds = new Rectangle(0, 0, this.Width, 25);
            mScrollBackgroundBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, this.Height - (mButtonUpBounds.Height * 2));
            mButtonDownBounds = new Rectangle(0, mButtonUpBounds.Height + mScrollBackgroundBounds.Height, this.Width, mButtonUpBounds.Height);
            mScrollBarBounds = new Rectangle(0, mButtonUpBounds.Height, this.Width, (this.mMaximum / this.mValue) * 25);

            mBackground = new SdlDotNet.Graphics.Surface(this.Size);

            mButtonSurface = new SdlDotNet.Graphics.Surface(mButtonUpBounds.Size);
            mScrollbarBackgroundSurface = new SdlDotNet.Graphics.Surface(mScrollBackgroundBounds.Size);
            mScrollbarSurface = new SdlDotNet.Graphics.Surface(mScrollBarBounds.Size);
            mScrollbarSurface.Fill(Color.Transparent);
            //mScrollbarSurface.Transparent = true;

            mButtonSurface.Fill(mForecolor);
            Gfx.Primitives.Box border = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollBackgroundBounds.Width - 2, mScrollBackgroundBounds.Height - 1));
            mScrollbarBackgroundSurface.Draw(border, Color.Blue);

            Gfx.Primitives.Box border2 = new SdlDotNet.Graphics.Primitives.Box(new Point(0, 0), new Size(mScrollbarSurface.Width - 2, mScrollbarSurface.Height - 2));
            mScrollbarSurface.Draw(border, Color.Red);

            mBackground.Blit(mButtonSurface);
            mBackground.Blit(mScrollbarBackgroundSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mScrollbarSurface, new Point(0, mButtonSurface.Height));
            mBackground.Blit(mButtonSurface, new Point(0, mButtonSurface.Height + mScrollbarBackgroundSurface.Height));
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:27,代码来源:Scrollbar.cs

示例3: Render

        public static Surface Render(PlayerUnit Unit)
        {
            Surface Buffer = new Surface(PUNIT_WIDTH_PX, PUNIT_WIDTH_PX);
            Color Bg = Color.WhiteSmoke;

            switch (Unit.Class)
            {
                case UnitClasses.Archer: Bg = Color.Orange;
                    break;
                case UnitClasses.Mage: Bg = Color.Blue;
                    break;
                case UnitClasses.Paladin: Bg = Color.DeepPink;
                    break;
                case UnitClasses.Soldier: Bg = Color.Brown;
                    break;
                case UnitClasses.Thieft: Bg = Color.Yellow;
                    break;

            }

            Rectangle UnitRect = new Rectangle(new Point(0,0), new Size(Buffer.Width, Buffer.Height));
            Box Border = new Box(new Point(0, 0), new Size(Buffer.Width - 1, Buffer.Height - 1));
            Buffer.Fill(UnitRect, Bg);
            Buffer.Draw(Border, Color.WhiteSmoke, true);
            Buffer.AlphaBlending = true;
            Buffer.Alpha = 230;
            return Buffer;
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:28,代码来源:PlayerUnitRenderer.cs

示例4: Draw

 public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
 {
     if (chip != 0)
     {
         if (chip >= 0 && chip < _colors.Length)
             s.Fill(r, _colors[chip]);
     }
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:8,代码来源:ColorChipData.cs

示例5: Render

        public virtual void Render(Surface s, Point p)
        {
            s.Blit(_graphic, new Point(p.X - (int)(_width / 2.0), p.Y - (int)(_height / 2.0)));

            foreach (Point offset in _collisionPoints)
            {
                s.Fill(new Rectangle(p.X - offset.X, p.Y - offset.Y, 1, 1), Color.Red);
            }
        }
开发者ID:davinx,项目名称:PitchPitch,代码行数:9,代码来源:GameObj.cs

示例6: Init

 public override void Init()
 {
     Surface temp = new Surface("Data/intro.bmp");
     bg = temp.CreateResizedSurface(Video.Screen.Size);
     fader = new Surface(bg.Width, bg.Height,
                         bg.BitsPerPixel, bg.RedMask,
                         bg.GreenMask, bg.BlueMask,
                         bg.AlphaMask);
     fader.Alpha = 255;
     fader.Fill(System.Drawing.Color.Black);
     fader.AlphaBlending = true;
 }
开发者ID:kfdm,项目名称:murasaki,代码行数:12,代码来源:CIntroState.cs

示例7: InfoForm

        public InfoForm()
        {
            InitializeComponent();

            surface = new Surface(surfaceControl.Width, surfaceControl.Height);
            surface.Fill(this.BackColor);
            surfaceControl.Blit(surface);

            this.surfaceControl.MouseMove += new MouseEventHandler(surfaceControl_MouseMove);
            this.surfaceControl.MouseClick += new MouseEventHandler(surfaceControl_MouseMove);
            this.surfaceControl.MouseEnter += new EventHandler(surfaceControl_MouseEnter);
            this.surfaceControl.MouseLeave += new EventHandler(surfaceControl_MouseLeave);
        }
开发者ID:walle,项目名称:myleveleditor,代码行数:13,代码来源:InfoForm.cs

示例8: EditorGrid

 public EditorGrid()
 {
     sfcGrid = new Surface (new Size (Constants.Constants.MAP_WIDTH + Constants.Constants.MAP_WIDTH *
         Tile.WIDTH, Constants.Constants.MAP_HEIGHT + Constants.Constants.MAP_HEIGHT * Tile.HEIGHT));
     sfcGrid.Fill (Color.Transparent);
     Graphic vertical = new Graphic (Color.Black, 1, Tile.HEIGHT * Constants.Constants.MAP_HEIGHT
         + Constants.Constants.MAP_HEIGHT * 2);
     Graphic horizont = new Graphic (Color.Black, Tile.WIDTH * Constants.Constants.MAP_WIDTH +
         Constants.Constants.MAP_WIDTH * 2, 1);
     for (int x=0; x < Constants.Constants.MAP_WIDTH; x++) {
         vertical.Draw (sfcGrid, x * 2 + x * Tile.WIDTH, 0, 255, true);
     }
     for (int y=0; y < Constants.Constants.MAP_HEIGHT; y++) {
         horizont.Draw (sfcGrid, 0, y * 2 + y * Tile.HEIGHT, 255, true);
     }
 }
开发者ID:m0a0t0,项目名称:Extremely-Simple-C--Platformer,代码行数:16,代码来源:LevelEditorState.cs

示例9: Draw

        public override void Draw(Surface s, uint chip, Rectangle r, ChipResizeMethod m)
        {
            if (chip < 0 || chip >= _chipSurfaces.Count) return;
            if (chip == 0) return;

            switch (m)
            {
                case ChipResizeMethod.Stretch:
                    Color c = _avgColors[chip];
                    s.Fill(r, c);
                    break;
                case ChipResizeMethod.Tile:
                    Surface ss = _chipSurfaces[(int)chip];
                    s.Blit(ss, r);
                    break;
            }
        }
开发者ID:davinx,项目名称:PitchPitch,代码行数:17,代码来源:ImageMapChipData.cs

示例10: Render

        public override Surface Render()
        {
            Surface buffer = new Surface(Width, Height);
            buffer.Fill(Background);

            Line Top = new Line(new Point(0, 0), new Point(Width - 1, 0));
            Line Bottom = new Line(new Point(0, Height - 1), new Point(Width - 1, Height - 1));
            Line Left = new Line(new Point(0, 0), new Point(0, Height - 1));
            Line Right = new Line(new Point(Width - 1, 0), new Point(Width - 1, Height - 1));

            Top.Draw(buffer, Color.LightGray);
            Left.Draw(buffer, Color.LightGray);

            Bottom.Draw(buffer, Color.DarkGray);
            Right.Draw(buffer, Color.DarkGray);

            return buffer;
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:18,代码来源:GuiItem.cs

示例11: MapChangeInfoOverlay

        public MapChangeInfoOverlay(string mapName, int minDisplayTime)
        {
            disposed = false;

            this.mapName = mapName;
            textFont = FontManager.LoadFont("PMU", 36);
            buffer = new Surface(20 * Constants.TILE_WIDTH, 15 * Constants.TILE_HEIGHT);
            buffer.Fill(Color.Black);
            Surface textSurf = TextRenderer.RenderTextBasic(textFont, mapName, null, Color.WhiteSmoke, false, 0, 0, 0, 0);
            buffer.Blit(textSurf, new Point(DrawingSupport.GetCenterX(buffer.Width, textSurf.Width), 100));
            this.minDisplayTime = minDisplayTime;
            tickCount = new TickCount(SdlDotNet.Core.Timer.TicksElapsed);
            //TextRenderer.RenderText(buffer, textFont, mapName, Color.WhiteSmoke, true, 0, 0, 100, 50);
            //for (int x = 0; x < 20; x++) {
            //    for (int y = 0; y < 15; y++) {

            //        buffer.Blit(GraphicsManager.Tiles[10][59 + (x % 2) + 2 * (y % 2)], new Point(x * Constants.TILE_WIDTH, y * Constants.TILE_HEIGHT));
            //    }
            //}
            //buffer.AlphaBlending = true;
            //buffer.Alpha = 50;
        }
开发者ID:ChaotixBluix,项目名称:PMU-Client,代码行数:22,代码来源:MapChangeInfoOverlay.cs

示例12: GetSurface

 public static Surface GetSurface(byte[] imgBytes, Size boxSize)
 {
     Surface boxSurf = new Surface(boxSize);
     boxSurf.Fill(Color.White);  //Fill background to white color
     //Get and resize image
     if (imgBytes != null)
     {
         Surface imgSurf = new Surface(imgBytes);
         double scale = Ratio.CalculateScale(imgSurf.Size,
                                             new Size(boxSize.Width, boxSize.Height),
                                             Ratio.RatioType.FitImage); //Calculate ratio
         Surface scaledSurf = imgSurf.CreateScaledSurface(scale, true);
         imgSurf.Dispose();
         Point pt = new Point((boxSize.Width - scaledSurf.Width) / 2,      //Left point
                              (boxSize.Height - scaledSurf.Height) / 2);   //Top point
         boxSurf.Blit(scaledSurf, pt);
         scaledSurf.Dispose();  //Clear imgSurf memory
     }
     //Draw border
     for(int i = 0; i < BORDER; i++)
         boxSurf.Draw(new Box(new Point(i, i), new Point(boxSize.Width - i - 1, boxSize.Height - i - 1)), Color.Gray);
     return boxSurf;
 }
开发者ID:amirsalah,项目名称:moonview,代码行数:23,代码来源:ImageBox.cs

示例13: renderMiniMapBackground

 protected override void renderMiniMapBackground(Surface s, Rectangle r)
 {
     s.Fill(r, _foreColor);
 }
开发者ID:davinx,项目名称:PitchPitch,代码行数:4,代码来源:RandomEndlessMap.cs

示例14: Dibujar

 public void Dibujar(Laberinto laberinto,bool pausa)
 {
     Video.Screen.Fill(Color.Black);
     for (int x = 0; x < laberinto.getAncho(); x+=Laberinto.TBloque)
         for (int y = 0; y < laberinto.getAlto(); y+=Laberinto.TBloque)
         {
             if(laberinto.bloqueEn(x,y) is Pared)
                 Dibujar((Pared)laberinto.bloqueEn(x, y),laberinto.Pared);
         }
     if(!laberinto.enTransicion())
         screen.Blit(new TextSprite("Nivel "+laberinto.NumeroNivel.ToString(), fuente, Color.White, new Point(ancho / 2 - 50, alto - (laberinto.getAlto()+5) * unidad)));
     foreach (IEnemigo enemigo in laberinto.Enemigos)
     {
         if (enemigo is PersonajeTerrestre)
             Dibujar((PersonajeTerrestre)enemigo);
     }
     foreach (Jugador jugador in laberinto.Jugadores)
     {
         if(jugador.Vidas>=0)
             Dibujar(jugador);
     }
     foreach (ObjetoDisparado ob in laberinto.ObjetosDisparados)
     {
         Dibujar(ob);
     }
     foreach (Burbuja b in laberinto.Burbujas)
     {
         Dibujar(b);
     }
     foreach (Fruta fruta in laberinto.Frutas)
     {
         if (fruta is Cereza)
             Dibujar((Cereza)fruta);
         else
             Dibujar(fruta);
     }
     if (pausa)
     {
         Rectangle rect = new Rectangle(0, 0, screen.Width, screen.Height);
         Surface srf = new Surface(rect);
         srf.Fill(Color.Black);
         srf.Alpha = 128;
         srf.AlphaBlending = true;
         screen.Blit(srf);
         Dibujar(menu);
     }
     particles.Update();
     particles.Render(Video.Screen);
     Video.Update();
 }
开发者ID:lpujol,项目名称:bub-bob-sharp,代码行数:50,代码来源:Vista.cs

示例15: CloseButtonRenderHighlight

        public Surface CloseButtonRenderHighlight()
        {
            Surface Buffer = new Surface(18, 18);

            Buffer.Fill(Color.Snow);

            Line Top = new Line(new Point(0, 0), new Point(18 - 1, 0));
            Line Bottom = new Line(new Point(0, 18 - 1), new Point(18 - 1, 18 - 1));
            Line Left = new Line(new Point(0, 0), new Point(0, 18 - 1));
            Line Right = new Line(new Point(18 - 1, 0), new Point(18 - 1, 18 - 1));

            Buffer.Draw(Top, Color.Black);
            Buffer.Draw(Bottom, Color.Black);
            Buffer.Draw(Left, Color.Black);
            Buffer.Draw(Right, Color.Black);

            Surface Caption = DefaultStyle.GetFont().Render("X", Color.Black);

            int x = (Buffer.Width - Caption.Width) / 2;
            int y = (Buffer.Height - Caption.Height) / 2;

            Buffer.Blit(Caption, new Point(x + 1, y + 1));

            return Buffer;
        }
开发者ID:jordsti,项目名称:towerdefenserpg,代码行数:25,代码来源:GuiItem.cs


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