Пример #1
0
        public Color GetPixel(double X, double Y)
        {
            //return Color.Beige;
            if (_bm == null)
            {
                return(Color.Transparent);
            }
            int x, y;

            _tfw.World2Image(X, Y, out x, out y);
            if (x < 0 || y < 0 || x >= _iWidth || y >= _iHeight)
            {
                return(Color.Transparent);
            }

            if (_bmData != null)
            {
                unsafe
                {
                    int *p = (int *)(void *)_bmData.Scan0;
                    p += y * _iWidth + x;
                    return(Color.FromArgb(*p));
                }
            }
            else
            {
                return(_bm.GetPixel(x, y));
            }
        }
Пример #2
0
        public GraphicsEngine.ArgbColor GetPixel(IRasterPaintContext context, double X, double Y)
        {
            //return Color.Beige;
            if (context?.Bitmap == null)
            {
                return(GraphicsEngine.ArgbColor.Transparent);
            }

            int x, y;

            _tfw.World2Image(X, Y, out x, out y);
            if (x < 0 || y < 0 || x >= _iWidth || y >= _iHeight)
            {
                return(GraphicsEngine.ArgbColor.Transparent);
            }

            return(context.Bitmap.GetPixel(x, y));
        }