Esempio n. 1
0
CRect Framework::Win32::PointsToPixels(const Framework::Win32::CRect& pointsRect)
{
	int ydpi = GetDeviceCaps(GetDC(NULL), LOGPIXELSY);
	Framework::Win32::CRect pixelsRect(0, 0, 0, 0);
	pixelsRect.SetLeft(MulDiv(pointsRect.Left(), ydpi, 96));
	pixelsRect.SetTop(MulDiv(pointsRect.Top(), ydpi, 96));
	pixelsRect.SetRight(MulDiv(pointsRect.Right(), ydpi, 96));
	pixelsRect.SetBottom(MulDiv(pointsRect.Bottom(), ydpi, 96));
	return pixelsRect;
}
Esempio n. 2
0
void CPixelBufferView::FitBitmap()
{
	if(m_pixelBufferBitmap.IsEmpty()) return;

	Framework::Win32::CRect clientRect = GetClientRect();
	unsigned int marginSize = 50;
	float normalizedSizeX = static_cast<float>(m_pixelBufferBitmap.GetWidth()) / static_cast<float>(clientRect.Right() - marginSize);
	float normalizedSizeY = static_cast<float>(m_pixelBufferBitmap.GetHeight()) / static_cast<float>(clientRect.Bottom() - marginSize);

	float normalizedSize = std::max<float>(normalizedSizeX, normalizedSizeY);

	m_zoomFactor = 1 / normalizedSize;
	m_panX = 0;
	m_panY = 0;

	Refresh();
}
void CPixelBufferView::FitBitmap()
{
	auto pixelBuffer = GetSelectedPixelBuffer();
	if(!pixelBuffer) return;
	const auto& pixelBufferBitmap = pixelBuffer->second;

	Framework::Win32::CRect clientRect = GetClientRect();
	unsigned int marginSize = 50;
	float normalizedSizeX = static_cast<float>(pixelBufferBitmap.GetWidth()) / static_cast<float>(clientRect.Right() - marginSize);
	float normalizedSizeY = static_cast<float>(pixelBufferBitmap.GetHeight()) / static_cast<float>(clientRect.Bottom() - marginSize);

	float normalizedSize = std::max<float>(normalizedSizeX, normalizedSizeY);

	m_zoomFactor = 1 / normalizedSize;
	m_panX = 0;
	m_panY = 0;

	Refresh();
}