From 56173d400583915f60b0bfe75d08d9782b002cc3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 9 Nov 2008 14:32:26 +0300 Subject: [PATCH] gdiplus: Added GdipGetTextContrast. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/gdiplus_private.h | 1 + dlls/gdiplus/graphics.c | 13 +++++++++++++ dlls/gdiplus/tests/graphics.c | 23 +++++++++++++++++++++++ include/gdiplusflat.h | 1 + 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index a2790a33663..0a29c1010fa 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -395,7 +395,7 @@ @ stdcall GdipGetStringFormatTabStopCount(ptr ptr) @ stdcall GdipGetStringFormatTabStops(ptr long ptr ptr) @ stdcall GdipGetStringFormatTrimming(ptr ptr) -@ stub GdipGetTextContrast +@ stdcall GdipGetTextContrast(ptr ptr) @ stdcall GdipGetTextRenderingHint(ptr ptr) @ stub GdipGetTextureImage @ stdcall GdipGetTextureTransform(ptr ptr) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index d3dce6af946..57d63c2d350 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -100,6 +100,7 @@ struct GpGraphics{ GpMatrix * worldtrans; /* world transform */ BOOL busy; /* hdc handle obtained by GdipGetDC */ GpRegion *clip; + UINT textcontrast; /* not used yet. get/set only */ }; struct GpBrush{ diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3273494a612..764e9ac4c1e 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -763,6 +763,7 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra (*graphics)->unit = UnitDisplay; (*graphics)->scale = 1.0; (*graphics)->busy = FALSE; + (*graphics)->textcontrast = 4; return Ok; } @@ -2507,6 +2508,18 @@ GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *mo return Ok; } +GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics *graphics, UINT *contrast) +{ + TRACE("(%p, %p)\n", graphics, contrast); + + if(!graphics || !contrast) + return InvalidParameter; + + *contrast = graphics->textcontrast; + + return Ok; +} + /* FIXME: Text rendering hint is not used anywhere except the getter/setter. */ GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *hint) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 1b4e3104aff..9d06fd9fd77 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -902,6 +902,28 @@ static void test_clear(void) expect(InvalidParameter, status); } +static void test_textcontrast(void) +{ + GpStatus status; + HDC hdc = GetDC(0); + GpGraphics *graphics; + UINT contrast; + + status = GdipGetTextContrast(NULL, NULL); + expect(InvalidParameter, status); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + status = GdipGetTextContrast(graphics, NULL); + expect(InvalidParameter, status); + status = GdipGetTextContrast(graphics, &contrast); + expect(4, contrast); + + GdipDeleteGraphics(graphics); + ReleaseDC(0, hdc); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -926,6 +948,7 @@ START_TEST(graphics) test_get_set_clip(); test_isempty(); test_clear(); + test_textcontrast(); GdiplusShutdown(gdiplusToken); } diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 203bcec4504..b8f14e14e15 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -200,6 +200,7 @@ GpStatus WINGDIPAPI GdipGetPageScale(GpGraphics*,REAL*); GpStatus WINGDIPAPI GdipGetPageUnit(GpGraphics*,GpUnit*); GpStatus WINGDIPAPI GdipGetPixelOffsetMode(GpGraphics*,PixelOffsetMode*); GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics*,SmoothingMode*); +GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics*,UINT*); GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics*,TextRenderingHint*); GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*); GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics*,ARGB); -- 2.11.4.GIT