void RunSampleA(PixelFarm.Drawing.Painter p)
        {
            //1. create simple vertical line to test agg's lcd rendernig technique
            //create gray-scale actual image
            ActualImage      glyphImg = new ActualImage(100, 100, PixelFormat.ARGB32);
            AggRenderSurface glyph2d  = new AggRenderSurface(glyphImg);
            AggPainter       painter  = new AggPainter(glyph2d);

            painter.StrokeColor = PixelFarm.Drawing.Color.Black;
            painter.StrokeWidth = 2.0f * 3;
            int x = 10, y = 10;

            painter.DrawLine(x * 3, 0, y * 3, 20); //scale horizontal 3 times,
            int lineLen = 4;


            //painter.Line(x * 3, 0, y * 3, 20); //scale horizontal 3 times,
            //painter.Line(2, 0, 2, 15);
            //painter.Line(2, 0, 20, 20);
            //painter.Line(2, 0, 30, 15);
            //painter.Line(2, 0, 30, 5);
            //clear surface bg
            p.Clear(PixelFarm.Drawing.Color.White);
            //draw img into that bg
            //---------------
            //convert glyphImg from RGBA to grey Scale buffer
            //---------------
            //lcd process ...
            byte[] glyphGreyScale = CreateGreyScaleBuffer(glyphImg);
            //---------------

            //swap gray scale
            int newGreyImgStride;

            byte[] expanedGreyScaleBuffer = CreateNewExpandedLcdGrayScale(glyphGreyScale, glyphImg.Width, glyphImg.Height, out newGreyImgStride);

            //blend lcd
            var aggPainer = (PixelFarm.Agg.AggPainter)p;

            Blend(aggPainer.RenderSurface.DestActualImage, expanedGreyScaleBuffer, newGreyImgStride, glyphImg.Height);
            //---------------
            p.DrawImage(glyphImg, 0, 50);
        }
Exemple #2
0
        void RunSampleA(PixelFarm.Drawing.Painter p)
        {
            //1. create simple vertical line to test agg's lcd rendernig technique
            //create gray-scale actual image
            using (MemBitmap glyphBmp = new MemBitmap(100, 100))
            {
                int x = 10, y = 10;
                using (AggPainterPool.Borrow(glyphBmp, out var painter))
                {
                    painter.StrokeColor = PixelFarm.Drawing.Color.Black;
                    painter.StrokeWidth = 2.0f * 3;
                    painter.DrawLine(x * 3, 0, y * 3, 20); //scale horizontal 3 times, s
                }


                //painter.Line(x * 3, 0, y * 3, 20); //scale horizontal 3 times,
                //painter.Line(2, 0, 2, 15);
                //painter.Line(2, 0, 20, 20);
                //painter.Line(2, 0, 30, 15);
                //painter.Line(2, 0, 30, 5);
                //clear surface bg
                p.Clear(PixelFarm.Drawing.Color.White);
                //draw img into that bg
                //---------------
                //convert glyphImg from RGBA to grey Scale buffer
                //---------------
                //lcd process ...
                byte[] glyphGreyScale         = CreateGreyScaleBuffer(glyphBmp);
                //---------------

                //swap gray scale
                int    newGreyImgStride;
                byte[] expanedGreyScaleBuffer = CreateNewExpandedLcdGrayScale(glyphGreyScale, glyphBmp.Width, glyphBmp.Height, out newGreyImgStride);

                //blend lcd
                var aggPainer                 = (PixelFarm.CpuBlit.AggPainter)p;
                Blend(aggPainer.RenderSurface.DestBitmap, expanedGreyScaleBuffer, newGreyImgStride, glyphBmp.Height);
                //---------------
                p.DrawImage(glyphBmp, 0, 50);
            }
        }
Exemple #3
0
 void RunSampleB(PixelFarm.Drawing.Painter p)
 {
     //version 2:
     //1. create simple vertical line to test agg's lcd rendernig technique
     //create gray-scale actual image
     using (MemBitmap glyphBmp = new MemBitmap(100, 100))
     {
         AggPainter painter = AggPainter.Create(glyphBmp);
         //
         painter.StrokeColor = PixelFarm.Drawing.Color.Black;
         painter.StrokeWidth = 2.0f;
         painter.DrawLine(2, 0, 3, 15); //not need to scale3
                                        //
                                        //clear surface bg
         p.Clear(PixelFarm.Drawing.Color.White);
         //--------------------------
         var aggPainer = (PixelFarm.CpuBlit.AggPainter)p;
         BlendWithLcdTechnique(aggPainer.RenderSurface.DestBitmap, glyphBmp, PixelFarm.Drawing.Color.Black);
         //---------------
         p.DrawImage(glyphBmp, 0, 50);
         //---------------
     }
 }
        void RunSampleB(PixelFarm.Drawing.Painter p)
        {
            //version 2:
            //1. create simple vertical line to test agg's lcd rendernig technique
            //create gray-scale actual image
            ActualImage      glyphImg = new ActualImage(100, 100, PixelFormat.ARGB32);
            AggRenderSurface glyph2d  = new AggRenderSurface(glyphImg);
            AggPainter       painter  = new AggPainter(glyph2d);

            //
            painter.StrokeColor = PixelFarm.Drawing.Color.Black;
            painter.StrokeWidth = 2.0f;
            painter.DrawLine(2, 0, 3, 15);//not need to scale3
            //
            //clear surface bg
            p.Clear(PixelFarm.Drawing.Color.White);
            //--------------------------
            var aggPainer = (PixelFarm.Agg.AggPainter)p;

            BlendWithLcdTechnique(aggPainer.RenderSurface.DestActualImage, glyphImg, PixelFarm.Drawing.Color.Black);
            //---------------
            p.DrawImage(glyphImg, 0, 50);
            //---------------
        }