About realize the function of selecting discretioal image
-
In Windows' Drawing Tool,there is a funtion that is we can select the discretioal part of the image.How can it realize? Have I make a clear expression?;P I appreciate your hint.
-
In Windows' Drawing Tool,there is a funtion that is we can select the discretioal part of the image.How can it realize? Have I make a clear expression?;P I appreciate your hint.
Do you want to select sections of an image and cut or other actions on the it?
WhiteSky
-
Do you want to select sections of an image and cut or other actions on the it?
WhiteSky
Yes,I want to cut the section I select from the image.
-
Yes,I want to cut the section I select from the image.
Check this code:
BOOL CDialogDlg::OnInitDialog()
{
m_Image.Load("c:\\123.jpg");
}void CDialogDlg::OnPaint()
{
CPaintDC dc(this);
m_Image.BitBlt(dc.m_hDC,0,0,800,600,0,0);
CDialog::OnPaint();
}void CDialogDlg::OnBnClickedOk()
{
int x,y;
x=200;
y=200;
HDC dc;
HBITMAP hbit;
dc=CreateCompatibleDC(GetDC()->m_hDC);
hbit=CreateCompatibleBitmap(GetDC()->m_hDC,x,y);
SelectObject(dc,hbit);
BitBlt(dc,0,0,x,y,GetDC()->m_hDC,100,100,SRCCOPY);//output in the file
CImage m_Image33;
m_Image33.Attach(hbit);
m_Image33.Save("d:\\22.bmp");
m_Image33.Detach();
DeleteDC(dc);
DeleteObject(hbit);
}
WhiteSky
-
Check this code:
BOOL CDialogDlg::OnInitDialog()
{
m_Image.Load("c:\\123.jpg");
}void CDialogDlg::OnPaint()
{
CPaintDC dc(this);
m_Image.BitBlt(dc.m_hDC,0,0,800,600,0,0);
CDialog::OnPaint();
}void CDialogDlg::OnBnClickedOk()
{
int x,y;
x=200;
y=200;
HDC dc;
HBITMAP hbit;
dc=CreateCompatibleDC(GetDC()->m_hDC);
hbit=CreateCompatibleBitmap(GetDC()->m_hDC,x,y);
SelectObject(dc,hbit);
BitBlt(dc,0,0,x,y,GetDC()->m_hDC,100,100,SRCCOPY);//output in the file
CImage m_Image33;
m_Image33.Attach(hbit);
m_Image33.Save("d:\\22.bmp");
m_Image33.Detach();
DeleteDC(dc);
DeleteObject(hbit);
}
WhiteSky
But the section was selected by the mouse,so the section is not a rect.
-
But the section was selected by the mouse,so the section is not a rect.
You want to select an area with mouse ok,its easy you have a click when you click mouse you must save start position with
CPoint point;GetCursorPos(&point);
that is x and y and when you free mouse its height,width thus you can select an area.
WhiteSky
-
You want to select an area with mouse ok,its easy you have a click when you click mouse you must save start position with
CPoint point;GetCursorPos(&point);
that is x and y and when you free mouse its height,width thus you can select an area.
WhiteSky
But the area is not a regular one... X|