public void HighlightItems(WriteableBitmap bitmap, Rectangle2I rc, Rgba32Color color, IEnumerable <ITreemapItem> items)
        {
            if (rc.Width <= 0 || rc.Height <= 0)
            {
                return;
            }

            renderArea = rc;

            InitPixels(rc, Rgba32Color.Transparent);

            fixed(Rgba32Color *pBitmapBits = pixels)
            {
                foreach (FileItemBase item in items)
                {
                    HighlightRectangle(pBitmapBits, item.Rectangle, color);
                }

                IntPtr bitmapBitsPtr = (IntPtr)pBitmapBits;

                ui.Invoke(() => {
                    bitmap.WritePixels((Int32Rect)rc, bitmapBitsPtr, rc.Width * rc.Height * 4, bitmap.BackBufferStride);
                });
            }
        }
Example #2
0
 public Sprite(Image image, Rectangle2I sourceRect, Point2I drawOffset)
 {
     this.image      = image;
     this.sourceRect = sourceRect;
     this.drawOffset = drawOffset;
     this.nextPart   = null;
 }
Example #3
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        public Sprite()
        {
            this.image      = null;
            this.sourceRect = Rectangle2I.Zero;
            this.drawOffset = Point2I.Zero;
            this.nextPart   = null;
        }
        private void FillRectangle(Rgba32Color *bitmap, Rectangle2I rc, Rgba32Color color)
        {
            int bottom = rc.Bottom;
            int right  = rc.Right;

            if (rc.Width >= rc.Height)
            {
                for (int iy = rc.Top; iy < bottom; iy++)
                {
                    for (int ix = rc.Left; ix < right; ix++)
                    {
                        bitmap[ix + iy * renderArea.Width] = color;
                    }
                }
            }
            else
            {
                for (int ix = rc.Left; ix < right; ix++)
                {
                    for (int iy = rc.Top; iy < bottom; iy++)
                    {
                        bitmap[ix + iy * renderArea.Width] = color;
                    }
                }
            }
        }
Example #5
0
        // Set the selection box
        public void SetSelectionBox(Point2I start, Point2I size)
        {
            selectionBox = new Rectangle2I(start, size);
            Point2I roomLoc = GMath.Clamp(start / Level.RoomSize, Point2I.Zero, Level.Dimensions);

            selectedRoom = Level.GetRoomAt(roomLoc);
        }
Example #6
0
        // Return an enumerable list of tiles contained within the given tile grid area.
        public IEnumerable <Tile> GetTilesInArea(Rectangle2I area, TileLayerOrder layerOrder = TileLayerOrder.LowestToHighest)
        {
            Rectangle2I clippedArea = Rectangle2I.Intersect(area,
                                                            new Rectangle2I(Point2I.Zero, gridDimensions));

            foreach (int i in GetLayers(layerOrder))
            {
                for (int y = clippedArea.Top; y < clippedArea.Bottom; y++)
                {
                    for (int x = clippedArea.Left; x < clippedArea.Right; x++)
                    {
                        Tile tile = tiles[x, y, i];
                        if (tile != null)
                        {
                            Point2I loc = tile.TileGridArea.Point;
                            if (!clippedArea.Contains(loc))
                            {
                                loc = Point2I.Clamp(loc, clippedArea);
                            }
                            if (x == loc.X && y == loc.Y)
                            {
                                yield return(tile);
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        public override void Update()
        {
            base.Update();

            // Find the start time for the current swing angle.
            int swingAngleStartTime = 0;

            for (int i = 0; i < swingAngleIndex; i++)
            {
                swingAngleStartTime += swingAngleDurations[i];
            }

            // Check for changing swing angles.
            bool changedAngles = false;
            int  t             = 0;
            int  time          = (int)playerTool.AnimationPlayer.PlaybackTime;

            for (int i = 0; i < swingAngleDurations.Length; i++)
            {
                if (time == t && swingAngleIndex != i)
                {
                    swingAngleIndex = i;
                    swingAngle      = Angles.Add(swingAngle, 1, swingAngleDirection);
                    changedAngles   = true;
                    break;
                }
                t += swingAngleDurations[i];
            }

            // Check for a swing tile peak (tile peaks happen just as the angle is changed).
            if (changedAngles)
            {
                Vector2F hitPoint        = player.Center + (Angles.ToVector(swingAngle, false) * 13);
                Point2I  hitTileLocation = player.RoomControl.GetTileLocation(hitPoint);
                OnSwingTilePeak(swingAngle, hitPoint);
            }

            Rectangle2I toolBox = swingCollisionBoxes[swingDirection, Math.Min(swingCollisionBoxes.Length - 1, swingAngleIndex)];

            toolBox.Point          += (Point2I)player.CenterOffset;
            playerTool.CollisionBox = toolBox;

            // Invoke any occuring timed actions.
            if (timedActions.ContainsKey(time))
            {
                timedActions[time].Invoke();
            }

            // Reset the swing when the button is pressed again.
            if (isReswingable && weapon.IsEquipped && weapon.IsButtonPressed())
            {
                Swing(player.UseDirection);
            }

            // End the swing.
            if (playerTool.AnimationPlayer.IsDone && player.Graphics.IsAnimationDone)
            {
                OnSwingEnd();
            }
        }
Example #8
0
        }                                           // This is to make sure tiles are only updated once per frame.


        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        // Use Tile.CreateTile() instead of this constructor.
        protected Tile()
        {
            tileGridArea     = Rectangle2I.Zero;
            isAlive          = false;
            isInitialized    = false;
            location         = Point2I.Zero;
            layer            = 0;
            offset           = Point2I.Zero;
            size             = Point2I.One;
            spriteAsObject   = new SpriteAnimation();
            isSolid          = false;
            isMoving         = false;
            pushDelay        = 20;
            properties       = new Properties(this);
            tileData         = null;
            moveDirection    = Point2I.Zero;
            dropList         = null;
            hasMoved         = false;
            path             = null;
            pathTimer        = 0;
            pathMoveIndex    = 0;
            fallsInHoles     = true;
            soundMove        = GameData.SOUND_BLOCK_PUSH;
            conveyorVelocity = Vector2F.Zero;
            surfaceTile      = null;
            collisionStyle   = CollisionStyle.Rectangular;
            graphics         = new TileGraphicsComponent(this);
        }
Example #9
0
        protected bool IsMoveObstructed(Point2I newLocation, out int newLayer)
        {
            newLayer = -1;

            Rectangle2I newGridArea = tileGridArea;

            newGridArea.Point += newLocation - location;

            // Check if the move will keep the tile in the room bounds.
            if (!roomControl.TileManager.GridArea.Contains(newGridArea))
            {
                return(true);
            }

            // Check if there is a free grid area to move to.
            int highestLayer = 0;

            foreach (Tile tile in roomControl.TileManager.GetTilesInArea(newGridArea))
            {
                if (tile != this)
                {
                    if (!tile.IsCoverableByBlock)
                    {
                        return(true);
                    }
                    else if (tile.Layer > highestLayer)
                    {
                        highestLayer = tile.Layer;
                    }
                }
            }
            newLayer = highestLayer + 1;
            return(newLayer < 0 || newLayer >= roomControl.TileManager.LayerCount);
        }
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public PlayerSpinSwordState()
        {
            limitTilesToDirection = false;
            isReswingable         = false;

            lunge = false;
            swingAnglePullBack   = 0;
            swingAngleDurations  = new int[] { 3, 2, 3, 2, 3, 2, 3, 2, 5 };
            weaponSwingAnimation = GameData.ANIM_SWORD_SPIN;
            playerSwingAnimation = GameData.ANIM_PLAYER_SPIN;

            // Will always spin clockwise.
            swingWindingOrders = new WindingOrder[] {
                WindingOrder.Clockwise,
                WindingOrder.Clockwise,
                WindingOrder.Clockwise,
                WindingOrder.Clockwise
            };

            swingCollisionBoxesNoLunge = new Rectangle2I[4, 9];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    int angle = GMath.Wrap((i * 2) - j, Angles.AngleCount);
                    swingCollisionBoxesNoLunge[i, j] = SWING_TOOL_BOXES_SPIN[angle];
                }
            }
        }
Example #11
0
        //-----------------------------------------------------------------------------
        // Internal methods
        //-----------------------------------------------------------------------------

        private void Explode()
        {
            BombExplosion bombExplosion = new BombExplosion();

            RoomControl.SpawnEntity(bombExplosion, Center, zPosition);
            AudioSystem.PlaySound(GameData.SOUND_BOMB_EXPLODE);

            // Explode nearby top tiles.
            if (zPosition < 4)
            {
                Rectangle2F tileExplodeArea = Rectangle2F.Zero.Inflated(12, 12);
                tileExplodeArea.Point += Center;

                Rectangle2I area = RoomControl.GetTileAreaFromRect(tileExplodeArea);

                for (int x = area.Left; x < area.Right; x++)
                {
                    for (int y = area.Top; y < area.Bottom; y++)
                    {
                        Tile        tile     = RoomControl.GetTopTile(x, y);
                        Rectangle2F tileRect = new Rectangle2F(x * 16, y * 16, 16, 16);
                        if (tile != null && tileRect.Intersects(tileExplodeArea))
                        {
                            tile.OnBombExplode();
                        }
                    }
                }
            }

            DestroyAndTransform(bombExplosion);
        }
Example #12
0
 // Remove all tiles within the given area.
 public void RemoveArea(Rectangle2I area)
 {
     BaseTileDataInstance[] tiles = GetTilesInArea(area).ToArray();
     foreach (BaseTileDataInstance tile in tiles)
     {
         tile.Room.Remove(tile);
     }
 }
Example #13
0
 public void SetSelectionGridArea(Rectangle2I area, Level level)
 {
     PlaceSelectionGrid();
     selectionGridArea  = area;
     selectionGridLevel = level;
     SetSelectionBox(selectionGridArea.Point * GameSettings.TILE_SIZE,
                     selectionGridArea.Size * GameSettings.TILE_SIZE);
 }
Example #14
0
        //-----------------------------------------------------------------------------
        // Internal Iteration
        //-----------------------------------------------------------------------------

        private IEnumerable <BaseTileDataInstance> GetTilesInArea(Rectangle2I area)
        {
            // Make sure the area is within the level bounds.
            area = Rectangle2I.Intersect(area,
                                         new Rectangle2I(Point2I.Zero, roomSize * dimensions));

            // Iterate the tile grid.
            for (int x = 0; x < area.Width; x++)
            {
                for (int y = 0; y < area.Height; y++)
                {
                    LevelTileCoord coord = (LevelTileCoord)(area.Point + new Point2I(x, y));
                    Room           room  = GetRoom(coord);
                    if (room != null)
                    {
                        Point2I tileLocation = GetTileLocation(coord);
                        for (int i = 0; i < roomLayerCount; i++)
                        {
                            TileDataInstance tile = room.GetTile(tileLocation, i);
                            if (tile != null && tile.Location == tileLocation)
                            {
                                yield return(tile);
                            }
                        }
                    }
                }
            }

            // Determine the collection of rooms that will contain the event tiles.
            Point2I     roomAreaMin = GetRoomLocation((LevelTileCoord)area.Min);
            Point2I     roomAreaMax = GetRoomLocation((LevelTileCoord)area.Max);
            Rectangle2I roomArea    = new Rectangle2I(roomAreaMin, roomAreaMax - roomAreaMin + Point2I.One);

            roomArea = Rectangle2I.Intersect(roomArea, new Rectangle2I(Point2I.Zero, dimensions));
            Rectangle2I pixelArea = new Rectangle2I(
                area.Point * GameSettings.TILE_SIZE,
                area.Size * GameSettings.TILE_SIZE);

            // Iterate event tiles.
            for (int x = roomArea.Left; x < roomArea.Right; x++)
            {
                for (int y = roomArea.Top; y < roomArea.Bottom; y++)
                {
                    Room room = rooms[x, y];
                    for (int i = 0; i < room.EventData.Count; i++)
                    {
                        EventTileDataInstance eventTile  = room.EventData[i];
                        Rectangle2I           tileBounds = eventTile.GetBounds();
                        tileBounds.Point += room.Location * roomSize * GameSettings.TILE_SIZE;
                        if (pixelArea.Contains(tileBounds.Point))
                        {
                            yield return(eventTile);
                        }
                    }
                }
            }
        }
Example #15
0
 public void SetSelectionGrid(TileGrid tileGrid, Point2I location, Level level)
 {
     PlaceSelectionGrid();
     selectionGridArea  = new Rectangle2I(location, tileGrid.Size);
     selectionGridLevel = level;
     selectionGrid      = tileGrid;
     SetSelectionBox(selectionGridArea.Point * GameSettings.TILE_SIZE,
                     selectionGridArea.Size * GameSettings.TILE_SIZE);
 }
Example #16
0
        public override void OnMouseDragMove(MouseEventArgs e)
        {
            Point2I mousePos     = new Point2I(e.X, e.Y);
            Point2I pointInLevel = LevelDisplayControl.SampleLevelPixelPosition(mousePos);

            // Update selection box.
            if (e.Button == MouseButtons.Left && isCreatingSelectionBox)
            {
                Point2I     tileCoord = LevelDisplayControl.SampleLevelTileCoordinates(mousePos);
                Level       level     = EditorControl.Level;
                Rectangle2I selectionBox;

                if (System.Windows.Forms.Control.ModifierKeys.HasFlag(KEYMOD_ROOM_MODE))
                {
                    Point2I roomCoord1   = level.GetRoomLocation((LevelTileCoord)dragBeginTileCoord);
                    Point2I roomCoord2   = level.GetRoomLocation((LevelTileCoord)tileCoord);
                    Point2I roomCoordMin = GMath.Min(roomCoord1, roomCoord2);
                    Point2I roomCoordMax = GMath.Max(roomCoord1, roomCoord2);

                    Rectangle2I levelDimensions = new Rectangle2I(Point2I.Zero, level.Dimensions);
                    selectionBox        = new Rectangle2I(roomCoordMin, roomCoordMax - roomCoordMin + Point2I.One);
                    selectionBox        = Rectangle2I.Intersect(selectionBox, levelDimensions);
                    selectionBox.Point *= level.RoomSize;
                    selectionBox.Size  *= level.RoomSize;
                }
                else
                {
                    Point2I minCoord = GMath.Min(dragBeginTileCoord, tileCoord);
                    Point2I maxCoord = GMath.Max(dragBeginTileCoord, tileCoord);

                    Rectangle2I levelBounds = new Rectangle2I(Point2I.Zero, level.RoomSize * level.Dimensions);
                    selectionBox = new Rectangle2I(minCoord, maxCoord - minCoord + Point2I.One);
                    //selectionBox = Rectangle2I.Intersect(selectionBox, levelBounds);
                }

                LevelDisplayControl.SetSelectionGridArea(selectionBox, level);
            }
            else if (e.Button == MouseButtons.Left && isMovingSelectionBox)
            {
                Point2I moveAmount;

                if (System.Windows.Forms.Control.ModifierKeys.HasFlag(KEYMOD_ROOM_MODE))
                {
                    moveAmount  = pointInLevel - dragBeginPoint;
                    moveAmount  = (Point2I)GMath.Round((Vector2F)moveAmount / (editorControl.Level.RoomSize * GameSettings.TILE_SIZE));
                    moveAmount *= editorControl.Level.RoomSize;
                }
                else
                {
                    moveAmount = pointInLevel - dragBeginPoint;
                    moveAmount = (Point2I)GMath.Round((Vector2F)moveAmount / GameSettings.TILE_SIZE);
                }

                Point2I selectionBoxPoint = selectionBoxBeginPoint + moveAmount;
                LevelDisplayControl.MoveSelectionGridArea(selectionBoxPoint);
            }
        }
Example #17
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        public EventTile()
        {
            roomControl  = null;
            eventData    = null;
            position     = Vector2F.Zero;
            size         = Point2I.One;
            properties   = new Properties();
            collisionBox = new Rectangle2I(0, 0, 16, 16);
        }
Example #18
0
        public override void SelectAll()
        {
            isCreatingSelectionBox = false;
            isMovingSelectionBox   = false;

            Level       level = EditorControl.Level;
            Rectangle2I area  = new Rectangle2I(Point2I.Zero, level.Dimensions * level.RoomSize);

            LevelDisplayControl.SetSelectionGridArea(area, level);
        }
Example #19
0
        //-----------------------------------------------------------------------------
        // Mutators
        //-----------------------------------------------------------------------------

        public void Set(Sprite copy)
        {
            this.image      = copy.image;
            this.sourceRect = copy.sourceRect;
            this.drawOffset = copy.drawOffset;
            this.nextPart   = null;
            if (copy.nextPart != null)
            {
                this.nextPart.Set(copy.nextPart);                 // This is recursive.
            }
        }
Example #20
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public UnitTool()
        {
            unit                       = null;
            drawAboveUnit              = false;
            animationPlayer            = new AnimationPlayer();
            collisionBox               = new Rectangle2I(-1, -1, 2, 2);
            toolType                   = UnitToolType.Visual;
            isEquipped                 = false;
            isPhysicsEnabled           = true;
            imageVariantID             = GameData.VARIANT_NONE;
            syncAnimationWithDirection = true;
        }
Example #21
0
        // Return an enumerable list of tiles touching the given rectangular bounds.
        public IEnumerable <Tile> GetTilesTouching(Rectangle2F bounds, TileLayerOrder layerOrder = TileLayerOrder.LowestToHighest)
        {
            Rectangle2I area = GetTileAreaFromRect(bounds);

            foreach (Tile tile in GetTilesInArea(area, layerOrder))
            {
                if (tile.Bounds.Intersects(bounds))
                {
                    yield return(tile);
                }
            }
        }
Example #22
0
        //-----------------------------------------------------------------------------
        // Drawing
        //-----------------------------------------------------------------------------

        // Draws the HUD.
        public void Draw(Graphics2D g, bool light)
        {
            int lightDark = (light ? GameData.VARIANT_LIGHT : GameData.VARIANT_DARK);

            Rectangle2I r = new Rectangle2I(0, 0, GameSettings.SCREEN_WIDTH, 16);

            g.DrawSprite(GameData.SPR_HUD_BACKGROUND, lightDark, r);

            DrawItems(g, lightDark);
            DrawRupees(g, lightDark);
            DrawHearts(g, lightDark);
        }
Example #23
0
        // inflateAmount inflates the output rectangle.
        public Rectangle2I GetTileAreaFromRect(Rectangle2F rect, int inflateAmount = 0)
        {
            Rectangle2I area;

            area.Point = (Point2I)GMath.Floor(rect.TopLeft / tileGridCellSize);
            area.Size  = (Point2I)GMath.Ceiling(rect.BottomRight / tileGridCellSize) - area.Point;
            if (inflateAmount != 0)
            {
                area.Inflate(inflateAmount, inflateAmount);
            }
            return(Rectangle2I.Intersect(area, new Rectangle2I(Point2I.Zero, gridDimensions)));
        }
Example #24
0
        private void Swing(int direction)
        {
            swingDirection      = direction;
            swingAngleDirection = swingWindingOrders[swingDirection];
            swingAngleStart     = Directions.ToAngle(swingDirection);
            swingAngleStart     = Angles.Subtract(swingAngleStart, swingAnglePullBack, swingAngleDirection);
            swingAngle          = swingAngleStart;
            swingAngleIndex     = 0;

            player.Direction = direction;
            playerTool       = GetSwingTool();
            player.EquipTool(playerTool);
            playerTool.AnimationPlayer.SubStripIndex = direction;

            if (player.IsInMinecart)
            {
                playerTool.PlayAnimation(weaponSwingAnimation);
                player.Graphics.PlayAnimation(playerSwingAnimationInMinecart);
                swingCollisionBoxes = swingCollisionBoxesNoLunge;
            }
            else if (lunge)
            {
                playerTool.PlayAnimation(weaponSwingAnimationLunge);
                player.Graphics.PlayAnimation(playerSwingAnimationLunge);
                swingCollisionBoxes = swingCollisionBoxesLunge;
            }
            else
            {
                playerTool.PlayAnimation(weaponSwingAnimation);
                player.Graphics.PlayAnimation(playerSwingAnimation);
                swingCollisionBoxes = swingCollisionBoxesNoLunge;
            }

            OnSwingBegin();

            // Perform an initial swing tile peak.
            Vector2F hitPoint        = player.Center + (Angles.ToVector(swingAngle, false) * 13);
            Point2I  hitTileLocation = player.RoomControl.GetTileLocation(hitPoint);

            OnSwingTilePeak(swingAngle, hitTileLocation);

            // Invoke any actions set to occur at time 0.
            if (timedActions.ContainsKey(0))
            {
                timedActions[0].Invoke();
            }

            Rectangle2I toolBox = swingCollisionBoxes[swingDirection, Math.Min(swingCollisionBoxes.Length - 1, swingAngleIndex)];

            toolBox.Point          += (Point2I)player.CenterOffset;
            playerTool.CollisionBox = toolBox;
        }
Example #25
0
 public Sprite(SpriteSheet sheet, Point2I index, Point2I drawOffset)
 {
     this.image      = sheet.Image;
     this.sourceRect = new Rectangle2I(
         sheet.Offset.X + (index.X * (sheet.CellSize.X + sheet.Spacing.X)),
         sheet.Offset.Y + (index.Y * (sheet.CellSize.Y + sheet.Spacing.Y)),
         sheet.CellSize.X,
         sheet.CellSize.Y
         );
     this.drawOffset = new Point2I(drawOffset.X, drawOffset.Y);
     this.image      = sheet.Image;
     this.nextPart   = null;
 }
Example #26
0
        // Return a list of entities colliding with this entity.
        public IEnumerable <T> GetEntitiesMeeting <T>(Rectangle2I myCollisionBox, CollisionBoxType otherCollisionBoxType, int maxZDistance = 10) where T : Entity
        {
            CollisionTestSettings settings = new CollisionTestSettings(typeof(T), myCollisionBox, otherCollisionBoxType, maxZDistance);

            for (int i = 0; i < entity.RoomControl.Entities.Count; i++)
            {
                T other = entity.RoomControl.Entities[i] as T;
                if (other != null && CollisionTest.PerformCollisionTest(entity, other, settings).IsColliding)
                {
                    yield return(other);
                }
            }
        }
Example #27
0
        // Return an enumerable list of solid tiles colliding with the given collision box.
        public IEnumerable <Tile> GetSolidTilesColliding(Rectangle2F collisionBox, TileLayerOrder layerOrder = TileLayerOrder.LowestToHighest)
        {
            Rectangle2I area = GetTileAreaFromRect(collisionBox);

            foreach (Tile tile in GetTilesInArea(area, layerOrder))
            {
                if (tile.IsSolid && tile.CollisionModel != null &&
                    CollisionModel.Intersecting(tile.CollisionModel, tile.Position, collisionBox))
                {
                    yield return(tile);
                }
            }
        }
Example #28
0
        //-----------------------------------------------------------------------------
        // Tile Mutators
        //-----------------------------------------------------------------------------

        // Place a tile in highest empty layer at the given location.
        // Returns true if there was an empty space to place the tile.
        public bool PlaceTileOnHighestLayer(Tile tile, Point2I location)
        {
            Rectangle2F tileBounds = new Rectangle2F(
                location * GameSettings.TILE_SIZE,
                tile.Size * GameSettings.TILE_SIZE);
            Rectangle2I area = GetTileAreaFromRect(tileBounds);

            // Determine which layers are free.
            bool[] freeLayers = new bool[layerCount];
            for (int i = 0; i < layerCount; i++)
            {
                freeLayers[i] = true;
                for (int x = area.Left; x < area.Right && freeLayers[i]; x++)
                {
                    for (int y = area.Top; y < area.Bottom && freeLayers[i]; y++)
                    {
                        Tile t = tiles[x, y, i];
                        if (t != null)
                        {
                            freeLayers[i] = false;
                        }
                    }
                }
            }

            // Choose the highest free layer.
            int layer = -1;

            for (int i = layerCount - 1; i >= 0; i--)
            {
                if (freeLayers[i])
                {
                    layer = i;
                    break;
                }
            }
            if (layer < 0)
            {
                return(false);
            }

            // Place the tile in that layer.
            PlaceTile(tile, location, layer);
            return(true);
        }
 private void HighlightRectangle(Rgba32Color *bitmap, Rectangle2I rc, Rgba32Color color)
 {
     if (rc.Width >= 7 && rc.Height >= 7)
     {
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Top, rc.Right, rc.Top + 3), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Bottom - 3, rc.Right, rc.Bottom), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Left, rc.Top + 3, rc.Left + 3, rc.Bottom - 3), color);
         FillRectangle(bitmap, Rectangle2I.FromLTRB(rc.Right - 3, rc.Top + 3, rc.Right, rc.Bottom - 3), color);
     }
     else if (rc.Width == 1 && rc.Height == 1)
     {
         bitmap[rc.Left + rc.Top * renderArea.Width] = color;
     }
     else if (rc.Width > 0 && rc.Height > 0)
     {
         FillRectangle(bitmap, rc, color);
     }
 }
        public void HighlightExtensions(IWriteableBitmap bitmap, Rectangle2I rc, FileItemBase root, Rgba32Color color, string extension)
        {
            if (rc.Width <= 0 || rc.Height <= 0)
            {
                return;
            }

            renderArea = rc;

            InitPixels(rc, Rgba32Color.Transparent);

            fixed(Rgba32Color *pBitmapBits = pixels)
            {
                RecurseHighlightExtensions(pBitmapBits, root, color, extension);

                bitmap.SetPixels(pBitmapBits);
            }
        }