コード例 #1
0
	graphics_context::graphics_context(const i_surface& aSurface, const font& aDefaultFont) :
		iSurface(aSurface), 
		iNativeGraphicsContext(aSurface.native_surface().create_graphics_context()), 
		iUnitsContext(*this),
		iDefaultFont(aDefaultFont),
		iOrigin(0, 0),
		iExtents(aSurface.extents()),
		iDrawingGlyphs(0)
	{
	}
コード例 #2
0
ファイル: surface_manager.cpp プロジェクト: basisbit/neogfx
	rect surface_manager::desktop_rect(const i_surface& aSurface) const
	{
#ifdef WIN32
		HMONITOR monitor = MonitorFromWindow(reinterpret_cast<HWND>(aSurface.native_surface().native_handle()), MONITOR_DEFAULTTONEAREST);
		MONITORINFOEX mi;
		mi.cbSize = sizeof(mi);
		GetMonitorInfo(monitor, &mi);
		return basic_rect<LONG>{ basic_point<LONG>{ mi.rcWork.left, mi.rcWork.top }, basic_size<LONG>{ mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top } };
#else
		/* todo */
		rect rectSurface{ aSurface.surface_position(), aSurface.surface_size() };
		std::multimap<double, uint32_t> matches;
		for (uint32_t i = 0; i < display_count(); ++i)
		{
			rect rectDisplay = desktop_rect(i);
			rect rectIntersection = rectDisplay.intersection(rectSurface);
			if (!rectIntersection.empty())
				matches[rectIntersection.width() * rectIntersection.height()] = i;
		}
		if (matches.empty())
			return desktop_rect(0);
		return desktop_rect(matches.rbegin()->second);
#endif
	}