gdiplus: Added first GDI+ graphics implementation.

This commit is contained in:
Evan Stade 2007-06-11 11:54:03 -07:00 committed by Alexandre Julliard
parent fcd7a62e93
commit d50be49775
4 changed files with 77 additions and 4 deletions

View File

@ -4,10 +4,11 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = gdiplus.dll
IMPORTLIB = libgdiplus.$(IMPLIBEXT)
IMPORTS = gdi32 advapi32 kernel32 ntdll
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
C_SRCS = \
gdiplus.c \
graphics.c \
pen.c
@MAKE_DLL_RULES@

View File

@ -81,8 +81,8 @@
@ stub GdipCreateFontFromLogfontA
@ stub GdipCreateFontFromLogfontW
@ stub GdipCreateFromHDC2
@ stub GdipCreateFromHDC
@ stub GdipCreateFromHWND
@ stdcall GdipCreateFromHDC(long ptr)
@ stdcall GdipCreateFromHWND(long ptr)
@ stub GdipCreateFromHWNDICM
@ stub GdipCreateHBITMAPFromBitmap
@ stub GdipCreateHICONFromBitmap
@ -132,7 +132,7 @@
@ stub GdipDeleteCustomLineCap
@ stub GdipDeleteFont
@ stub GdipDeleteFontFamily
@ stub GdipDeleteGraphics
@ stdcall GdipDeleteGraphics(ptr)
@ stub GdipDeleteMatrix
@ stub GdipDeletePath
@ stub GdipDeletePathIter

View File

@ -35,4 +35,9 @@ struct GpPen{
HPEN gdipen;
};
struct GpGraphics{
HDC hdc;
HWND hwnd;
};
#endif

67
dlls/gdiplus/graphics.c Normal file
View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2007 Google (Evan Stade)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
{
if(hdc == NULL)
return OutOfMemory;
if(graphics == NULL)
return InvalidParameter;
*graphics = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GpGraphics));
(*graphics)->hdc = hdc;
(*graphics)->hwnd = NULL;
return Ok;
}
GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
{
GpStatus ret;
if((ret = GdipCreateFromHDC(GetDC(hwnd), graphics)) != Ok)
return ret;
(*graphics)->hwnd = hwnd;
return Ok;
}
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
{
if(!graphics) return InvalidParameter;
if(graphics->hwnd)
ReleaseDC(graphics->hwnd, graphics->hdc);
HeapFree(GetProcessHeap(), 0, graphics);
return Ok;
}