Re: Scaling of data into dc



Joseph M. Newcomer schrieb:
This is a completely wrong approach. Use SetViewportExt/SetWindowExt to accomplish this.
Otherwise, you end up scaling the bitmap which gets really lousy representation for the
graphics.

I tried to implement the scaling with SetViewportExt/SetWindowExt.

That however worked only partly

- What is the difference between the two ?
- I changed in CMemDC.h the lines

SetMapMode(pDC->GetMapMode());
SetWindowExt(pDC->GetWindowExt());
SetViewportExt(pDC->GetViewportExt());

to

SetMapMode(MM_ANISOTROPIC);
SetWindowExt(CSize(m_rect_dest.Width(), m_rect_dest.Height()));
SetViewportExt(CSize(m_rect_source.Width(), m_rect_source.Height()));


and changed from StrechBlt to BitBlt again, because I do not want to mix two differend streching ways.

The generated bitmap is now scaled, BUT

- only the size of the data (if smaller the the dc size) is invalidated/shown, although the UpdatePlot invalidates the whole area:

which means that if the data has size 50x50 and the dc 100x100 then the data is streched on the dc twice, but only the area 50x50 is shown.

void CGraphCtrl::UpdatePlot()
{
CRect rc;
GetClientRect(rc);
InvalidateRect(&rc);
UpdateWindow();
}

Now my code has changed but the overall problem is still the same and I have no idea how to proceed.

Matthias

.


Loading