Example #1
0
        public unsafe void Access(IImage.AccessHandler accessHandler)
        {
            var palette = this.impl_.Palette.Entries;

            BitmapUtil.InvokeAsLocked(this.impl_, bmpData => {
                var ptr = (byte *)bmpData.Scan0;

                void GetHandler(int x,
                                int y,
                                out byte r,
                                out byte g,
                                out byte b,
                                out byte a)
                {
                    var index      = y * bmpData.Width + x;
                    var colorIndex = ptr[index];
                    var color      = palette[colorIndex];

                    r = color.R;
                    g = color.G;
                    b = color.B;
                    a = color.A;
                }

                accessHandler(GetHandler);
            });
        }
Example #2
0
        public unsafe void Access(IImage.AccessHandler accessHandler)
        {
            BitmapUtil.InvokeAsLocked(this.impl_, bmpData => {
                var ptr = (byte *)bmpData.Scan0;

                void GetHandler(int x,
                                int y,
                                out byte r,
                                out byte g,
                                out byte b,
                                out byte a)
                {
                    var index = 4 * (y * bmpData.Width + x);
                    b         = ptr[index];
                    g         = ptr[index + 1];
                    r         = ptr[index + 2];
                    a         = ptr[index + 3];
                }

                accessHandler(GetHandler);
            });
        }
Example #3
0
 public void Access(IImage.AccessHandler accessHandler)
 => this.impl_.Access(accessHandler);