bitmapの画像を処理して、データを保存するプログラムを作成しています。
int stride = WindowWidth * 4; int clipPointX = (int)(this.GridWidth.Value - WindowWidth) / 2; int clipPointY = (int)(this.GridHeight.Value - WindowHeight) / 2; byte[] pixels = new byte[stride * WindowHeight]; bmp.CopyPixels(new Int32Rect(clipPointX, clipPointY, WindowWidth, WindowHeight), pixels, stride, 0); System.Drawing.Bitmap clipBmp = new System.Drawing.Bitmap(WindowWidth, WindowHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Drawing.Imaging.BitmapData bmpData = clipBmp.LockBits(new System.Drawing.Rectangle(0, 0, WindowWidth, WindowHeight), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Runtime.InteropServices.Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length); clipBmp.UnlockBits(bmpData);
上記のやり方で、bitmapを描画しています。
この時、描画したい像とウィンドウのサイズで差が生じることがあり、隙間ができてしまいます。
現状、そこは透明になっているのですが、その透明となっているところを白くして保存したいと考えています。
透明なところを白くする方法はありますでしょうか?
ご回答宜しくお願い致します。
イメージ画像貼ってあるので、ご参照ください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。