Color, GetPixel();, SetPixel();, FromArgb();, getC.R
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show("Good~!");
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp1 = new Bitmap(@"C:\Users\sgi320\Desktop\lena.bmp");
Graphics g = this.CreateGraphics();
int w = bmp1.Width;
int h = bmp1.Height;
g.DrawImage(bmp1, 1, 1, w, h);
Color getC;
for (int y = 0; y < h; y++)
{
for (int x=0; x < w; x++)
{
getC = bmp1.GetPixel(x, y);
bmp1.SetPixel(x, y, Color.FromArgb(getC.G, getC.R, getC.B));
}
}
g.DrawImage(bmp1, 5+bmp1.Width, 1);
g.Dispose();
bmp1.Dispose();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show("Good~!");
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp1 = new Bitmap(@"C:\Users\sgi320\Desktop\lena.bmp");
Graphics g = this.CreateGraphics();
int w = bmp1.Width;
int h = bmp1.Height;
g.DrawImage(bmp1, 1, 1, w, h);
Color getC;
for (int y = 0; y < h; y++)
{
for (int x=0; x < w; x++)
{
getC = bmp1.GetPixel(x, y);
bmp1.SetPixel(x, y, Color.FromArgb(getC.G, getC.R, getC.B));
}
}
g.DrawImage(bmp1, 5+bmp1.Width, 1);
g.Dispose();
bmp1.Dispose();
}
}
}
댓글
댓글 쓰기