📄 lcyimageprocessview.cpp
字号:
for(int j=0;j<=bitmapHeight;j=j+8)
{
::StretchDIBits(pDC->GetSafeHdc(),0, j-8 , i+1, 8,
bitmapWidth-i, bitmapHeight-j, i+1, 8,
pBitmapData, pBitmapInfo,
DIB_RGB_COLORS, SRCCOPY);
}
}*/
m_MemDC->SelectObject(OldBitmap);
}
void CLCYImageProcessView::OnViewMoveToup()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=22;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//向上移动显示
void CLCYImageProcessView::DrawPicture_toup()
{
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(int i=0;i<m_BmpImage->m_BiHeight;i++)
{
for(int j=0;j<m_BmpImage->m_BiWidth;j++)
{
colorref=m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbBlue<<16 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbGreen<<8 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbRed;
//画位图中的每一个象素点
m_MemDC->SetPixel(j,i,colorref);
}
}
for(i=0;i<m_BmpImage->m_BiHeight;i++)
{
for(int j=0;j<m_BmpImage->m_BiWidth;j=j+8) //8-图象显示定位量
{
dc.BitBlt(j-8,0,8,i+1,m_MemDC,j,i,SRCCOPY);
//dc.StretchBlt(i,j-8,i+1,8,m_MemDC,i,j,i+1,8,SRCCOPY);
//Sleep(5);
}
Sleep(5);
}
m_MemDC->SelectObject(OldBitmap);
}
void CLCYImageProcessView::OnKuozhang()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=31;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//图象扩张显示
//先显示图象的中间,再往上往下快速扫描
void CLCYImageProcessView::DrawPicture_kuozhang()
{
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
RGBCOLOR* temp=(RGBCOLOR*)(new BYTE[width*height*3]);
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
temp[i*width+j].rgbBlue=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbBlue;
temp[i*width+j].rgbGreen=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbGreen;
temp[i*width+j].rgbRed=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbRed;
}
}
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
//画位图中的每一个象素点
//colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
m_MemDC->SetPixel(j,i,colorref);
}
}
for(i=0;i<=height/2;i++)
{
dc.BitBlt(0,height/2+i,width,1,m_MemDC,0,height/2-i,SRCCOPY);
dc.BitBlt(0,height/2-i,width,1,m_MemDC,0,height/2+i,SRCCOPY);
//dc.BitBlt(0,i-m_BmpImage->m_BiHeight/2,m_BmpImage->m_BiWidth,1,m_MemDC,0,i,SRCCOPY);
Sleep(5);
}
m_MemDC->SelectObject(OldBitmap);
delete[] temp;
}
void CLCYImageProcessView::OnBothFly()
{
// TODO: Add your command handler code here
m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=41;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//图象交叉飞入显示
//将图象分为两部分,上部分水平右移,下部分水平左移
void CLCYImageProcessView::DrawPicture_fly()
{
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
RGBCOLOR* temp=(RGBCOLOR*)(new BYTE[width*height*3]);
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
temp[i*width+j].rgbBlue=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbBlue;
temp[i*width+j].rgbGreen=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbGreen;
temp[i*width+j].rgbRed=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbRed;
}
}
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
//画位图中的每一个象素点
//colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
m_MemDC->SetPixel(j,i,colorref);
}
}
for(i=0;i<=width;i++)
{
for(int j=0;j<=height/2;j=j+1)//1-显示定位量
{
dc.BitBlt(0,j,i+1,1,m_MemDC,width-i,height-j-1,SRCCOPY);
int k=j+1+height/2;
dc.BitBlt(width-i,k,i+1,1,m_MemDC,0,height-k,SRCCOPY);
}
Sleep(5);
}
m_MemDC->SelectObject(OldBitmap);
delete[] temp;
}
void CLCYImageProcessView::OnShousuo()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=51;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//图象的收缩显示
//先显示图象的上下边界,上边界往下扫描,下边界往上扫描
void CLCYImageProcessView::DrawPicture_shousuo()
{
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
RGBCOLOR* temp=(RGBCOLOR*)(new BYTE[width*height*3]);
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
temp[i*width+j].rgbBlue=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbBlue;
temp[i*width+j].rgbGreen=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbGreen;
temp[i*width+j].rgbRed=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbRed;
}
}
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
//画位图中的每一个象素点
//colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
m_MemDC->SetPixel(j,i,colorref);
}
}
for(int j=0;j<=height/2;j++)
{
dc.BitBlt(0,j,width,1,m_MemDC,0,height-j,SRCCOPY);
dc.BitBlt(0,height-j,width,1,m_MemDC,0,j,SRCCOPY);
Sleep(5);
}
m_MemDC->SelectObject(OldBitmap);
delete[] temp;
}
void CLCYImageProcessView::OnShuipingshantiao()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=61;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
long i = 0;
//m_Current=11;
Invalidate(false);
}
//图象的水平栅条显示
//将图象分成若干行,奇数行一组,偶数行一组
//显示时,奇数行从左向右平移,偶数行从右向左平移
void CLCYImageProcessView::DrawPicture_shuipingshantiao()
{
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
RGBCOLOR* temp=(RGBCOLOR*)(new BYTE[width*height*3]);
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
temp[i*width+j].rgbBlue=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbBlue;
temp[i*width+j].rgbGreen=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbGreen;
temp[i*width+j].rgbRed=m_BmpImage->m_ImageData[(height-i-1)*width+j].rgbRed;
}
}
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
//画位图中的每一个象素点
//colorref=temp[i*width+j].rgbBlue<<16 | temp[i*width+j].rgbGreen<<8 | temp[i*width+j].rgbRed;
m_MemDC->SetPixel(j,i,colorref);
}
}
int nb=1;
for(i=0;i<width;i++)
{
for(int j=0;j<=height;j=j+2*nb)
{
dc.BitBlt(0,j,i+1,nb,m_MemDC,width-i,height-j,SRCCOPY);
int k=j+nb;
dc.BitBlt(width-i,k,i+1,nb,m_MemDC,0,height-k,SRCCOPY);
}
Sleep(5);
}
m_MemDC->SelectObject(OldBitmap);
delete[] temp;
}
void CLCYImageProcessView::OnCuizhishantiao()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=62;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//图象垂直栅条显示
//将图象分成若干列,奇数列为一组,偶数列为一组
//奇数列从上往下显示,偶数列从下往上显示
void CLCYImageProcessView::DrawPicture_cuizhishantiao()
{
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(int i=0;i<m_BmpImage->m_BiHeight;i++)
{
for(int j=0;j<m_BmpImage->m_BiWidth;j++)
{
colorref=m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbBlue<<16 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbGreen<<8 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbRed;
//画位图中的每一个象素点
m_MemDC->SetPixel(j,i,colorref);
//dc.BitBlt(0,0,j,i,m_MemDC,0,0,SRCCOPY);
}
// dc.BitBlt(0,0,j,m_BmpImage->m_BiHeight-i,m_MemDC,0,0,SRCCOPY);
// Sleep(5);
}
int nb=1;
long height=m_BmpImage->m_BiHeight;
long width=m_BmpImage->m_BiWidth;
for(int j=0;j<height;j++)
{
for(int i=0;i<=width;i=i+2*nb)
{
dc.BitBlt(i,0,nb,j+1,m_MemDC,i,height-j,SRCCOPY);
int k=i+nb;
dc.BitBlt(k,height-j,nb,j+1,m_MemDC,k,0,SRCCOPY);
}
Sleep(5);
}
//dc.BitBlt(0,0,m_BmpImage->m_BiWidth,m_BmpImage->m_BiHeight,m_MemDC,0,0,SRCCOPY);
m_MemDC->SelectObject(OldBitmap);
}
void CLCYImageProcessView::OnJianxian()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
RGBCOLOR* temp=(RGBCOLOR*)(new BYTE[width*height*3]);
//存储原图象数据
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
temp[i*width+j].rgbBlue=m_BmpImage->m_ImageData[i*width+j].rgbBlue;
temp[i*width+j].rgbGreen=m_BmpImage->m_ImageData[i*width+j].rgbGreen;
temp[i*width+j].rgbRed=m_BmpImage->m_ImageData[i*width+j].rgbRed;
}
}
//Invalidate();
m_Current=0;
for(int n=50;n<=256;n+=5)
{
for(int i=0;i<width*height;i++)
{
m_BmpImage->m_ImageData[i].rgbBlue=m_BmpImage->m_ImageData[i].rgbBlue*n/256;
m_BmpImage->m_ImageData[i].rgbGreen=m_BmpImage->m_ImageData[i].rgbGreen*n/256;
m_BmpImage->m_ImageData[i].rgbRed=m_BmpImage->m_ImageData[i].rgbRed*n/256;
}
if(n==50)
{
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
else
{
//Invalidate();
DrawPicture();
}
for(int j=0;j<width*height;j++)
{
m_BmpImage->m_ImageData[j].rgbBlue=temp[j].rgbBlue;
m_BmpImage->m_ImageData[j].rgbGreen=temp[j].rgbGreen;
m_BmpImage->m_ImageData[j].rgbRed=temp[j].rgbRed;
}
Sleep(3);
}
delete[] temp;
//m_Current=100;
}
void CLCYImageProcessView::OnShuipingwin()
{
// TODO: Add your command handler code here
//m_BmpImage->LoadImageData();
//DrawPicture_bottom();
m_Current=71;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
//图象水平百叶窗显示
void CLCYImageProcessView::DrawPicture_shuipingwin()
{
CClientDC dc(this);
//CDC* dc;
CBitmap* OldBitmap=(CBitmap*) m_MemDC->SelectObject(m_Bitmap);
//draws a rectangle
m_MemDC->Rectangle(-1,-1,2000,2000);
//Selects the given region as the current clipping region for the device context
m_MemDC->SelectClipRgn(NULL);
COLORREF colorref;
for(int i=0;i<m_BmpImage->m_BiHeight;i++)
{
for(int j=0;j<m_BmpImage->m_BiWidth;j++)
{
colorref=m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbBlue<<16 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbGreen<<8 |
m_BmpImage->m_ImageData[i*m_BmpImage->m_BiWidth+j].rgbRed;
//画位图中的每一个象素点
m_MemDC->SetPixel(j,i,colorref);
}
}
long width=m_BmpImage->m_BiWidth;
long height=m_BmpImage->m_BiHeight;
int nb=8;
for(i=0;i<=width/nb;i++)
{
for(int j=0;j<=nb;j++)
{
dc.BitBlt(j*width/nb,0,i,height,m_MemDC,j*width/nb,0,SRCCOPY);
}
Sleep(10);
}
m_MemDC->SelectObject(OldBitmap);
}
void CLCYImageProcessView::OnZoom()
{
// TODO: Add your command handler code here
m_Current=0;
SuoFangDlg MyDlg;
if(MyDlg.DoModal()==IDOK)
{
m_BmpImage->SuoFang(MyDlg.m_zoom);
}
//m_Current=1;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
void CLCYImageProcessView::OnZoom1()
{
// TODO: Add your command handler code here
m_Current=0;
SuoFangDlg1 MyDlg;
if(MyDlg.DoModal()==IDOK)
{
m_BmpImage->SuoFang1(MyDlg.m_zoom1,MyDlg.m_zoom2);
}
//m_Current=1;
CLCYImageProcessDoc* pDoc=GetDocument();
pDoc->UpdateAllViews(NULL);
}
void CLCYImageProcessView::OnMove()
{
// TODO: Add your command handler code here
MoveDlg mydlg;
if(mydlg.DoModal()==IDOK)
{
m_BmpImage->Move(mydlg.m_xoff,mydlg.m_yoff);
}
Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -