이것은 이상한 질문 일 수 있지만 이미지를 C#으로 스케일 할 때 픽셀 화되고 앤티 앨리어싱이 필요하지 않습니다. 스케일링 할 때 MSpaint처럼.C#에서 별명을 지정하기 위해 크기 조정 된 이미지가 필요합니다.
기본적으로 C#에서 이미지 앤티 앨리어싱을 원합니다. 그렇지 않으면 내가 원하지 않는 것을 변경했습니다.
나는 Graphics.InterpolationMode
으로 경기를 시도했지만 거기에는 운이 없습니다. 나는 이미지를 유지하기 위해 비트 맵 객체를 사용하고 있는데 그것은과 같이 구성되어있다 :
// A custom control holds the image
this.m_ZoomPanPicBox.Image = new Bitmap(szImagePath);
그리고 사용자 지정 컨트롤에 대한 간단한 SYNAPSIS :
class ZoomPanPicBox : ScrollableControl
{
Image m_image;
float m_zoom = 1.0f;
InterpolationMode m_interpolationMode;
...
////////////////////////////////////////////////////////
public ZoomPanPicBox()
{
//Double buffer the control
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
this.AutoScroll=true;
}
////////////////////////////////////////////////////////
protected override void OnPaint(PaintEventArgs e)
{
//if no image, don't bother
if(m_image==null)
{
base.OnPaintBackground(e);
return;
}
//Set up a zoom matrix
Matrix mx = new Matrix(m_zoom,0,0,m_zoom,0,0);
//now translate the matrix into position for the scrollbars
mx.Translate(this.AutoScrollPosition.X/m_zoom, this.AutoScrollPosition.Y/m_zoom);
//use the transform
e.Graphics.Transform = mx;
//and the desired interpolation mode
e.Graphics.InterpolationMode = m_interpolationMode;
//Draw the image ignoring the images resolution settings.
e.Graphics.DrawImage(m_image,new Rectangle(0,0,this.m_image.Width,this.m_image.Height),0,0,m_image.Width, m_image.Height,GraphicsUnit.Pixel);
base.OnPaint(e);
}
어떤 아이디어? 감사.
분명히하기 위해 'e.Graphics.InterpolationMode = NearestNeighbor'을 시도했지만 아무 것도하지 않았습니까? –
Nah 나는 그 중 하나를 시도하지 않았다 : (... 나는 NearestNeighbor를 사용했고 효과가 있었다.) 고마워요. – Balk