示例#1
0
        public void Draw(FastPixel.FastPixel fp, IIntentStates states, double zoomLevel)
        {
            if (_isDiscreteColored)
            {
                int       col      = 1;
                int       zoomedX  = (int)(Bounds.X * zoomLevel);
                Rectangle drawRect = new Rectangle(zoomedX, (int)(Bounds.Y * zoomLevel), Bounds.Width, Bounds.Height);
                // Get states for each color
                List <Color> colors = _discreteHandler.GetAlphaAffectedColor(states);
                foreach (Color c in colors)
                {
                    if (c != Color.Transparent && c.A > byte.MinValue)
                    {
                        fp.DrawCircle(drawRect, c);

                        if (col % 2 == 0)
                        {
                            drawRect.Y += PixelSize;
                            drawRect.X  = zoomedX;
                        }
                        else
                        {
                            drawRect.X = zoomedX + PixelSize;
                        }

                        col++;
                    }
                }
            }
            else
            {
                var state = states.FirstOrDefault();
                if (state != null)
                {
                    Color intentColor = _fullColorHandler.GetFullColor(state);
                    if (intentColor.A > 0)
                    {
                        Rectangle drawRect = zoomLevel != 1?new Rectangle((int)(Bounds.X * zoomLevel), (int)(Bounds.Y * zoomLevel), Bounds.Width, Bounds.Height):Bounds;
                        fp.DrawCircle(drawRect, intentColor);
                    }
                }
            }
        }
示例#2
0
        public void Draw(FastPixel.FastPixel fp, IIntentStates states)
        {
            if (_isDiscreteColored)
            {
                int       col      = 1;
                Rectangle drawRect = new Rectangle(drawArea.X, drawArea.Y, drawArea.Width, drawArea.Height);
                // Get states for each color
                List <Color> colors = _discreteHandler.GetAlphaAffectedColor(states);
                foreach (Color c in colors)
                {
                    if (c != Color.Transparent && c.A > byte.MinValue)
                    {
                        fp.DrawCircle(drawRect, c);

                        if (col % 2 == 0)
                        {
                            drawRect.Y += PixelSize;
                            drawRect.X  = drawArea.X;
                        }
                        else
                        {
                            drawRect.X = drawArea.X + PixelSize;
                        }

                        col++;
                    }
                }
            }
            else
            {
                var state = states.FirstOrDefault();
                if (state != null)
                {
                    Color intentColor = _fullColorHandler.GetFullColor(state);
                    if (intentColor.A > 0)
                    {
                        fp.DrawCircle(drawArea, intentColor);
                    }
                }
            }
        }
示例#3
0
        public void Draw(FastPixel.FastPixel fp, IIntentStates states)
        {
            if(_isDiscreteColored)
            {
                int col = 1;
                Rectangle drawRect = new Rectangle(drawArea.X, drawArea.Y, drawArea.Width, drawArea.Height);
                // Get states for each color
                List<Color> colors = _discreteHandler.GetAlphaAffectedColor(states);
                foreach (Color c in colors)
                {
                    if (c != Color.Transparent && c.A > byte.MinValue)
                    {
                        fp.DrawCircle(drawRect, c);

                        if (col % 2 == 0)
                        {
                            drawRect.Y += PixelSize;
                            drawRect.X = drawArea.X;
                        } else
                        {
                            drawRect.X = drawArea.X + PixelSize;
                        }

                        col++;
                    }
                }
            }
            else
            {
                var state = states.FirstOrDefault();
                if (state != null)
                {
                    Color intentColor = _fullColorHandler.GetFullColor(state);
                    if (intentColor.A > 0)
                    {
                        fp.DrawCircle(drawArea, intentColor);
                    }

                }

            }
        }