Ejemplo n.º 1
0
        public override void DrawImage(GraphicsHandler graphics, Rectangle source, Rectangle destination)
        {
            var bd = bmp.Lock();

            // we have to draw to a temporary bitmap pixel by pixel
            unsafe
            {
                fixed(byte *pSrc = Control)
                {
                    var dest  = (byte *)bd.Data;
                    var src   = pSrc;
                    var scany = rowStride;

                    if (graphics.Flipped)
                    {
                        src  += Control.Length - scany;
                        scany = -scany;
                    }

                    dest += source.Top * bd.ScanWidth;
                    dest += source.Left * sizeof(uint);

                    src += source.Top * scany;
                    src += source.Left;

                    for (int y = source.Top; y <= source.Bottom; y++)
                    {
                        var srcrow  = src;
                        var destrow = (uint *)dest;
                        for (int x = source.Left; x <= source.Right; x++)
                        {
                            var palindex = *srcrow;
                            var color    = colors[palindex];
                            *   destrow  = bd.TranslateArgbToData(color);
                            destrow++;
                            srcrow++;
                        }
                        dest += bd.ScanWidth;
                        src  += scany;
                    }
                }
            }
            bmp.Unlock(bd);

            bmp.DrawImage(graphics, source, destination);
        }
Ejemplo n.º 2
0
 public override void DrawImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
 {
     bmp.DrawImage(graphics, source, destination);
 }