728x90
728x170
using System.Drawing;
#region 비트맵 경계선 설정하기 - SetBitmapBorderLine(sourceImage, borderLineThickness, borderLineColor)
/// <summary>
/// 경계선 설정하기
/// </summary>
/// <param name="sourceImage">소스 이미지</param>
/// <param name="borderLineThickness">경계선 두께</param>
/// <param name="borderLineColor">경계선 색상</param>
/// <returns>경계선 설정 비트맵</returns>
public Bitmap SetBitmapBorderLine(Image sourceImage, int borderLineThickness, Color borderLineColor)
{
Bitmap targetBitmap = new Bitmap(sourceImage);
for(int y = 0; y < borderLineThickness; y++)
{
for(int x = 0; x < sourceImage.Width; x++)
{
targetBitmap.SetPixel(x, y, borderLineColor);
targetBitmap.SetPixel(x, image.Height - 1 - y, borderLineColor);
}
}
for(int x = 0; x < borderLineThickness; x++)
{
for(int y = 0; y < sourceImage.Height; y++)
{
targetBitmap.SetPixel(x, y, borderLineColor);
targetBitmap.SetPixel(image.Width - 1 - x, y, borderLineColor);
}
}
return targetBitmap;
}
#endregion
※ sourceBitmap : 32비트 RGB 비트맵을 가정한다.
728x90
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 히스토그램 비트맵 구하기 (0) | 2015.06.19 |
---|---|
[C#/WINFORM] 비트맵 설정하기 (0) | 2015.06.19 |
[C#/WINFORM] 비트맵 배열 구하기 (0) | 2015.06.19 |
[C#/WINFORM] 회색조 비트맵 설정하기 (0) | 2015.06.15 |
[C#/WINFORM] 회색조 비트맵 배열 구하기 (0) | 2015.06.15 |
[C#/WINFORM] 회색조 비트맵 명도 조정하기 (0) | 2015.06.13 |
[C#/WINFORM] 비트맵 명도 조정하기 (0) | 2015.06.13 |
[C#/WINFORM] 회색조 비트맵 구하기 (0) | 2015.06.13 |
[C#/WINFORM] RichTextBox 클래스 : 텍스트 라인 추가하기 (0) | 2015.05.15 |
[C#/WINFORM] RichTextBox 클래스 : 텍스트 추가하기 (0) | 2015.05.15 |