求高手指点 用mfc cimage类如何实现图像的裁剪功能
解决方案 »
- 求助帖 熟悉汇编或vc的高手进来
- 如何生成动态数据结构
- 急,请教大家DBGrid\DBList\FlexGrid的区别是什么啊:),非常感谢各位了!!!!
- 得到了内嵌在页面中的一个IHTMLFrameElement的接口指针,现在想得到里面Form并且附值,该怎么做??大家帮忙。。。
- 请问:
- 我的关于atl开发Activex的见解,望高手指正!
- 如何将bmp文件读取到二进制变量?sdk最好!
- int average( int first, ... )
- 数据库DAO编程时,可以将某个字段的值取出吗,并保存在某个变量里
- 简单问题,希望有人回答!关于类指针。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
- 建议
- 请教如何在vc.net中写一个sizeof()函数dll,供vb.net使用?
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
originpoint.x=point.x;
originpoint.y=point.y;
CFormView::OnLButtonDown(nFlags, point);
}void CvrhumanView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
endpoint.x=point.x;
endpoint.y=point.y;
cutwidth=endpoint.x-originpoint.x;
cutheight=endpoint.y-originpoint.y; LONG imageWidth = _cimage->GetWidth();
LONG imageHeight = _cimage->GetHeight();
BYTE* bits = (BYTE*)_cimage->GetBits(); BYTE* dstImage=new BYTE[cutheight*cutwidth];
memset(dstImage,(BYTE)255,cutheight*cutwidth);
for ( int i = 0 ; i < cutheight; ++ i )
{
for ( int j = 0 ; j < cutwidth ; ++ j )
{
dstImage [i * cutwidth + j] = bits[ (i+originpoint.y) * _cimage->GetPitch() +(j+originpoint.x )];
}
} //for ( int i = 0 ; i < cutheight; ++ i )//测试用
//{
// for ( int j = 0 ; j < cutwidth ; ++ j )
// {
// bits[ i*_cimage->GetPitch() +j]= dstImage [i * cutwidth + j];
// }
//} //Invalidate();//测试用 _cimage->Destroy(); _cimage->Create(cutwidth,cutheight,8,0); BYTE* bits1 = (BYTE*)_cimage->GetBits();
for ( int i = 0 ; i < cutheight; ++ i )
{
for ( int j = 0 ; j < cutwidth ; ++ j )
{
bits1[ i * _cimage->GetPitch() +j] = dstImage [i* cutwidth + j];
}
}
Invalidate();
delete dstImage;
dstImage = NULL;
CFormView::OnLButtonUp(nFlags, point);
}void CvrhumanView::OnDraw(CDC* pDC)
{ if ( _cimage != NULL )
{
CRect rctWindowSize;
GetClientRect(rctWindowSize);
//_cimage->StretchBlt(dc,0,0,rctWindowSize.Width(),rctWindowSize.Height(),SRCCOPY);
_cimage->StretchBlt(pDC->m_hDC,0,0,_cimage->GetWidth(),_cimage->GetHeight(),SRCCOPY); }
}这是我自己写的代码 但是显示时截取的图像光显示黑色 源图像中截取的信息没法保存下来 请多多帮忙!
自己下载cximage看,里面代码都现成的!