3
현재 이미지 생성 용 마스크 생성기를 만들려고합니다. 여기 내 코드가있다.이미지에 경계선 그리기
Bitmap bmp = new Bitmap(file);
int w = bmp.Width;
int h = bmp.Height;
List<Point> vertices = new List<Point>();
for (int y=0; y<h; y++)
{
bool rowbegin = false;
for (int x=0; x<w; x++)
{
Color c = bmp.GetPixel(x, y);
if (!rowbegin)
{
// Check for a non alpha color
if (c.A != Color.Transparent.A)
{
rowbegin = true;
// This is the first point in the row
vertices.Add(new Point(x, y));
}
} else {
// Check for an alpha color
if (c.A == Color.Transparent.A)
{
// The previous pixel is the last point in the row
vertices.Add(new Point(x-1, y));
rowbegin = false;
}
}
}
}
// Convert to an array of points
Point[] polygon = vertices.ToArray();
Graphics g = Graphics.FromImage(bmp);
g.DrawPolygon(Pens.LawnGreen, polygon);
g.Dispose();
출력이 잘못 표시됩니다.
요구. 내가 원하는 무엇
는 문자 사이의 간격이 비어있을 수도 있습니다. 또한 DrawPolygon이 그것을 채우는 이유는 무엇입니까?
감사합니다.
한 스프라이트 시트에 그 이미지의 3입니다. –
예. 투명 공간을 없애고 싶습니다. –
무엇을 원하십니까? WPF에서 한 줄의 XAML과 동일한 효과를 적용 할 수 있다는 것을 알고 계셨습니까? 왜 winforms를 사용하고 있습니까? 그것은 그래픽을 지원하지 않습니다. –