I removed some of the new features under development to be able to release 2.02 quickly. The current issues with AlphaBlt are constantly on my mind and I don't want you guys struggling with issues that have already been resolved.
Clipping is there in 2.02 and works perfectly on lines, rectangles, blits, cursors and even fonts.
Yep, it's finally possible to draw text anywhere (x=-10, y=-10) and all letters will clip nicely as needed.
The implementation for clipping is:
CGapiSurface::SetViewPort(RECT* pRect);
and
CGapiSurface::GetViewPort(RECT* pRect);
Clipping is by default disabled on all surfaces and will have to be enabled on a surface-by-surface basis.
(1) Setting a clipping viewport to clip near the surface boundaries
surface.SetViewPort(NULL);
The entire surface will be used for clipping. Drawing outside the surface will clip automatically.
(2) Setting a clipping viewport to a rectangle on the surface
CRect myrect;
myrect.SetRect(10, 10, surface.GetWidth() - 10, surface.GetHeight() - 10);
surface.SetViewPort(&myrect);
The above will clip all blits, lines, rectangles, fonts, etc to the viewport. The class CRect is almost identical to the MFC class CRect and resides in CGapiDrawExtension.h.
(3) Removing a clipping viewport
CRect myrect(0, 0, 0, 0);
surface.SetViewPort(&myrect);
Set the viewport to an empty rectangle to remove viewport clipping on the surface.
Currently there are some rounding issues with Blt, AlphaBlt and clipping. This is because DirectDraw does not support clipping in hardware (coords are unsigned DWORDS) and the scaling may cause some rendering issues (should not be visible under normal circumstances).
Clipping is there in 2.02 and works perfectly on lines, rectangles, blits, cursors and even fonts.
The implementation for clipping is:
CGapiSurface::SetViewPort(RECT* pRect);
and
CGapiSurface::GetViewPort(RECT* pRect);
Clipping is by default disabled on all surfaces and will have to be enabled on a surface-by-surface basis.
(1) Setting a clipping viewport to clip near the surface boundaries
surface.SetViewPort(NULL);
The entire surface will be used for clipping. Drawing outside the surface will clip automatically.
(2) Setting a clipping viewport to a rectangle on the surface
CRect myrect;
myrect.SetRect(10, 10, surface.GetWidth() - 10, surface.GetHeight() - 10);
surface.SetViewPort(&myrect);
The above will clip all blits, lines, rectangles, fonts, etc to the viewport. The class CRect is almost identical to the MFC class CRect and resides in CGapiDrawExtension.h.
(3) Removing a clipping viewport
CRect myrect(0, 0, 0, 0);
surface.SetViewPort(&myrect);
Set the viewport to an empty rectangle to remove viewport clipping on the surface.
Currently there are some rounding issues with Blt, AlphaBlt and clipping. This is because DirectDraw does not support clipping in hardware (coords are unsigned DWORDS) and the scaling may cause some rendering issues (should not be visible under normal circumstances).