painting.c

来自「ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机」· C语言 代码 · 共 715 行 · 第 1/2 页

C
715
字号
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_PaintInvertRgn( hDC, hRgn, EMR_PAINTRGN );
      }
      return FALSE;
    }
 }
 // Could just use Dc_Attr->hbrush
 HBRUSH hbrush = (HBRUSH) GetDCObject( hDC, GDI_OBJECT_TYPE_BRUSH);
 
 return NtGdiFillRgn( hDC, hRgn, hBrush);
}


BOOL
STDCALL
PolyBezier(HDC hDC ,const POINT* Point, DWORD cPoints)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
 /*
  * Since MetaFiles don't record Beziers and they don't even record
  * approximations to them using lines.
  */
      return FALSE;
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return FALSE; // Not supported yet.
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, &cPoints, 1, GdiPolyBezier );
}
 

BOOL
STDCALL
PolyBezierTo(HDC hDC, const POINT* Point ,DWORD cPoints)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return FALSE;
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return FALSE; // Not supported yet.
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, &cPoints, 1, GdiPolyBezierTo );
}


BOOL
STDCALL
PolyDraw(HDC hDC, const POINT* Point, const BYTE *lpbTypes, int cCount )
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return FALSE;
    else
    { 
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return FALSE; // Not supported yet.
      }
      return FALSE;
    }
 }
 return NtGdiPolyDraw( hDC , Point, lpbTypes, cCount );
}


BOOL
STDCALL
Polygon(HDC hDC, const POINT *Point, int Count)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return MFDRV_Polygon( hDC, Point, Count );
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_Polygon( hDC, Point, Count );
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, &Count, 1, GdiPolygon );
}


BOOL
STDCALL
Polyline(HDC hDC, const POINT *Point, int Count)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return MFDRV_Polyline( hDC, Point, Count );
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_Polyline( hDC, Point, Count );
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, &Count, 1, GdiPolyPolyLine );
}


BOOL
STDCALL
PolylineTo(HDC hDC, const POINT* Point, DWORD Count)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return FALSE;
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return FALSE; // Not supported yet.
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, &Count, 1, GdiPolyLineTo );

}


BOOL
STDCALL
PolyPolygon(HDC hDC, const POINT* Point, const INT* Count, int Polys)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return MFDRV_PolyPolygon( hDC, Point, Count, Polys);
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_PolyPolygon( hDC, Point, Count, Polys );
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, Count, Polys, GdiPolygon );

}


BOOL
STDCALL
PolyPolyline(HDC hDC, const POINT* Point, const DWORD* Counts, DWORD Polys)
{
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return FALSE;
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_PolyPolyline(hDC, Point, Counts, Polys);
      }
      return FALSE;
    }
 }
 return NtGdiPolyPolyDraw( hDC , Point, Count, Polys, GdiPolyPolyLine );
}
#endif


BOOL
STDCALL
ExtFloodFill(
       HDC hDC,
       int nXStart, 
       int nYStart,
       COLORREF crFill,
       UINT fuFillType
             )
{
#if 0
// Handle something other than a normal dc object.
 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
 {
    if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
      return MFDRV_ExtFloodFill( hDC, nXStart, nYStart, crFill, fuFillType );
    else
    {
      PLDC pLDC = GdiGetLDC(hDC);
      if ( !pLDC )
      {
         SetLastError(ERROR_INVALID_HANDLE);
         return FALSE;
      }
      if (pLDC->iType == LDC_EMFLDC)
      {
        return EMFDRV_ExtFloodFill( hDC, nXStart, nYStart, crFill, fuFillType );
      }
      return FALSE;
    }
 }
#endif
    return NtGdiExtFloodFill(hDC, nXStart, nYStart, crFill, fuFillType);
}


BOOL
WINAPI
FloodFill(
    HDC hDC,
    int nXStart,
    int nYStart,
    COLORREF crFill)
{
    return ExtFloodFill(hDC, nXStart, nYStart, crFill, FLOODFILLBORDER);
}

BOOL WINAPI
MaskBlt(
	HDC hdcDest,
	INT nXDest,
	INT nYDest,
	INT nWidth,
	INT nHeight,
	HDC hdcSrc,
	INT nXSrc,
	INT nYSrc,
	HBITMAP hbmMask,
	INT xMask,
	INT yMask,
	DWORD dwRop)
{
	return NtGdiMaskBlt(hdcDest,
	                    nXDest,
	                    nYDest,
	                    nWidth,
	                    nHeight,
	                    hdcSrc,
	                    nXSrc,
	                    nYSrc,
	                    hbmMask,
	                    xMask,
	                    yMask,
	                    dwRop,
	                    0);
}


BOOL
WINAPI
PlgBlt(
	HDC hdcDest,
	const POINT *lpPoint,
	HDC hdcSrc,
	INT nXSrc,
	INT nYSrc,
	INT nWidth,
	INT nHeight,
	HBITMAP hbmMask,
	INT xMask,
	INT yMask)
{
	return NtGdiPlgBlt(hdcDest,
	                   (LPPOINT)lpPoint,
	                   hdcSrc,
	                   nXSrc,
	                   nYSrc,
	                   nWidth,
	                   nHeight,
	                   hbmMask,
	                   xMask,
	                   yMask,
	                   0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?