有谁知道哪儿有图象大的原码放????新手请教,,谢谢了

解决方案 »

  1.   

    兄弟你读了bmp数据后,把横向和纵向的象素都重写就加倍了
      

  2.   

    //单文档
    //1.在CzoomView类的头文件中增加protected:
    CSize m_sizeDest;
    CSize m_sizeSource;
    CBitmap * m_pBitmap;
    CDC * m_pdcMem;
    int oldx,oldy,s,d;   //s确定被放大区域,d确定放大显示区域,放大倍率=d/s
    bool recover;
    long mana;//2.在资源中加入一个位图 ID设为IDB_BITMAP1
    //3.
    CZoomPartView::CZoomPartView()
    {
    // TODO: add construction code here
    m_pdcMem = new CDC;
    m_pBitmap = new CBitmap;
    recover = true;
    s = 30; d = 45;
    mana = SRCCOPY;}
    CZoomPartView::~CZoomPartView()
    {
    delete m_pdcMem;
    delete m_pBitmap;
    }void CZoomPartView::OnDraw(CDC* pDC)
    {
    CZoomPartDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here //声明判断是否load位图的静态标志
    static bool load;
    //按原来大小显示位图
    if (!load) {
    BITMAP bm;
    load = !load;
    m_pBitmap->LoadBitmap(IDB_BITMAP1);
    m_pdcMem->CreateCompatibleDC(pDC);
    m_pdcMem->SelectObject(m_pBitmap);
    m_pBitmap->GetObject(sizeof(bm),&bm);
    m_sizeSource.cx = bm.bmWidth;
    m_sizeSource.cy = bm.bmHeight;
    m_sizeDest = m_sizeSource;
    pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy,
    m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana);
    }
    else {
    pDC->StretchBlt(0,0,m_sizeSource.cx,m_sizeSource.cy,
    m_pdcMem,0,0,m_sizeSource.cx,m_sizeSource.cy,mana);
    }}//在CzoomView 类中,用ClassWizard 响应WM_MOUSEMOVE消息  
    void CZoomPartView::OnMouseMove(UINT nFlags, CPoint point) 
    {
    //计算要放大的局部矩形的源图像位置和目标位置
    CString cord;
    int dd;
        CRect srect,drect,mrect;
    srect.left = point.x - s;
    srect.top = point.y - s;
    srect.right = point.x + s;
    srect.bottom = point.y + s;

    drect.left = point.x - d;
    drect.top = point.y - d;
    drect.right = point.x + d;
    drect.bottom = point.y + d;

    mrect.left = oldx - d;
    mrect.top = oldy - d;
    mrect.right = oldx + d;
    mrect.bottom = oldy + d;
    dd = 2*d;
    CDC * pDC = GetDC();
    OnPrepareDC(pDC);
    //放大图像
    if (recover)
    {
    pDC->BitBlt(mrect.left,mrect.top,dd,dd,
    m_pdcMem,mrect.left,mrect.top,mana);
    }
    pDC->StretchBlt(drect.left,drect.top,
    drect.Width(),drect.Height(),m_pdcMem,srect.left,
    srect.top,srect.Width(),srect.Height(),SRCCOPY);
    oldx = point.x; oldy = point.y;
    ReleaseDC(pDC);

    recover = true; CView::OnMouseMove(nFlags, point);
    }
    //同样 响应鼠标按下的消息void CZoomPartView::OnLButtonDown(UINT nFlags, CPoint point) 
    {
    //如果鼠标位置不在位图上,则还原位图大小显示
    CRect rc(0,0,m_sizeSource.cx,m_sizeSource.cy);
    if(!rc.PtInRect(point))
    {
    Invalidate();
    }
    else if (d > 5)//如果放大倍数大于5,就继续减小放大倍数,然后进行放大显示
    {
    CDC * pDC = GetDC();
    pDC->StretchBlt(oldx - d,oldy - d,2*d,
    2*d,m_pdcMem,oldx - d,oldy - d,2*d,2*d,mana);
    d -= 10;
    ReleaseDC(pDC);
    CZoomPartView::OnMouseMove(nFlags, point);

    CView::OnLButtonDown(nFlags, point);
    }//编译运行
      

  3.   

    StrechBlt
    或者使用XFORM(查查MSDN就知道了)可作自有变化
    或者自己写(使用反向变换,插值确定位图数据)