첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System.Drawing;

#region 회색조 비트맵 배열 구하기 - GetGraySacleBitmapArray(sourceBitmap)

/// <summary>
/// 회색조 비트맵 배열 구하기
/// </summary>
/// <param name="sourceBitmap">소스 비트맵</param>
/// <returns>회색조 비트맵 배열</returns>
public int[,] GetGraySacleBitmapArray(Bitmap sourceBitmap)
{
    int[,] targetArray = new int[sourceBitmap.Height, sourceBitmap.Width];
    Color  color;

    for(int y = 0; y < sourceBitmap.Height; y++)
    {
        for(int x = 0; x < sourceBitmap.Width; x++)
        {
            color = sourceBitmap.GetPixel(x, y);

            targetArray[y, x] = (int)(0.299 * color.R + 0.587 * color.G + 0.114 * color.B);
        }
    }

    return targetArray;
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요