前提・実現したいこと
挿入した画像に点を描画したいのですが、画像の裏に点が描画されてしまい、画像の上に点が描画されません。
挿入した画像の上に点を描画するにはどうすればいいですか?
ソースコード
private void button1_Click(object sender, EventArgs e) { // Retrieve the image. Bitmap image1 = new Bitmap(@"C:\Users\peanuts\Source\Repos\WindowsFormsApp1\WindowsFormsApp1\Resources\blue.png"); int x, y; // Loop through the images pixels to reset color. int xpitch = image1.Width / 100; int ypitch = image1.Height / 100; for (x = 0; x < image1.Width; x += xpitch) { for (y = 0; y < image1.Height; y += ypitch) { double z = -0.138 + (-0.019 * x) + (-0.070 * y) + (0.005 * x * x) + (0.0 * x * y) + (0.013 * y * y); if (z % 0.2 <= 0.005) { Color pixelColor = image1.GetPixel(x, y); Color newColor = Color.FromArgb(pixelColor.R, 0, 0); image1.SetPixel(x, y, newColor); } } } // Set the PictureBox to display the image. pictureBox1.Image = image1; } } }
挿入画像
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー