D
D
Daniel2020-05-21 11:16:23
C++ / C#
Daniel, 2020-05-21 11:16:23

What is it, where is it from???? What are the dots on the image? c#?

Where do these points come from, already in the second project in a row appear. And as always, I am unique, I have not found such a problem anywhere, but here out of the blue that I will not do that hello.
Image 3600 pixels by 3600 texture.
my
5ec630343c3bd213203861.png
app Photos App
5ec63044d7f03756143167.png

class PictureBoxCtrl : PictureBox
    { 


        
        public PictureBoxCtrl() : base()
        {
            Dock = DockStyle.Fill;
            BackColor = Color.Transparent; 
            DoubleBuffered = true;
            
        }
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            Invalidate();
        }


        protected override void OnPaint(PaintEventArgs pe)
        {
           
            //base.OnPaint(pe);
            if (Image != null)
            {
               

                //pe.Graphics.Clear(BackColor);
                float kX, kY;
                kX = Image.Width / (float)this.Width;
                kY = Image.Height / (float)this.Height;
                int w, h;
                if (kX < kY)
                {
                    w = (int)(  (float)Image.Width/kY);
                    h = (int)((float)Image.Height/kY);
                }
                else
                {
                    w = (int)((float)Image.Width / kX);
                    h = (int)((float)Image.Height / kX);

                }

                 
                var dstRect = new Rectangle(
                    (this.Width - w) / 2, (this.Height -h),
                    w, h
                    );
                var srcRect = new Rectangle((int)0,0, Image.Width, Image.Height);
                 pe.Graphics.DrawImage(Image,  dstRect, srcRect, GraphicsUnit.Pixel);
               
            } 
        }

Tried a trillion options already. And what are these dots, artifacts or what? while they are not present with an empty project. They also blink or appear in different places when dragging the window

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-05-21
@firedragon

You have transparency turned on, and artifacts appear in places where white reaches its maximum.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question