Exemple #1
0
        public static Bitmap DrawMap(string id, HuskBrain brain, GammaPalette palette)
        {
            Map          map    = GetMap(id, brain);
            var          result = new Drawable(map.Source.Width, map.Source.Height);
            Grid <Color> mask   = CreateMapMask(map.Progression, Color.Transparent, GammaPalette.Default[Gamma.Min]);

            result.Palette = palette;
            result.AddLayer(new BitmapLayer(ImageHelper.CreateArgbBitmap(mask.Values)));

            return(result.BuildAndDispose());
        }
Exemple #2
0
        public void Draw(Drawable card, ref Cursor cursor, ref ComponentReference previous)
        {
            // Get the layer offsets
            int offsetX = CardInfo.GetOffsetX(Info, cursor, previous);
            int offsetY = CardInfo.GetOffsetY(Info, cursor, previous);

            // Get the image source
            var sheet  = new Sheet(ReferencePath, CropWidth, CropHeight);
            var sprite = sheet.GetSprite(ReferenceIndex);
            var icon   = ImageHelper.SetColorMap(sprite, GammaPalette.Default, Fill.Palette);

            // Build the new layer
            var layer = new BitmapLayer(icon)
            {
                Offset = new Coordinate(offsetX, offsetY)
            };

            layer.Properties.Padding = Info.Padding;

            // Try to offset the cursor
            if (Info.CursorOffset.HasFlag(CursorOffset.X))
            {
                cursor.X += layer.Source.Width + layer.Properties.Padding.Width;
            }

            if (Info.CursorOffset.HasFlag(CursorOffset.Y))
            {
                cursor.Y += layer.Source.Height + layer.Properties.Padding.Height;
            }

            // Finally, update the component reference
            previous.Update(layer.Source.Width, layer.Source.Height, layer.Properties.Padding);

            // Add the layer to the card
            card.AddLayer(layer);
        }