gdiplus: Added Gdip[Get/Set]TextureWrapMode.

This commit is contained in:
Nikolay Sivov 2008-10-21 19:39:21 +04:00 committed by Alexandre Julliard
parent 92f5aa0a69
commit 37bbe9d4bc
5 changed files with 87 additions and 2 deletions

View File

@ -605,6 +605,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
(*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb); (*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb);
(*texture)->brush.bt = BrushTypeTextureFill; (*texture)->brush.bt = BrushTypeTextureFill;
(*texture)->wrap = imageattr->wrap;
GdipFree(dibits); GdipFree(dibits);
GdipFree(buff); GdipFree(buff);
@ -912,6 +913,21 @@ GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
return Ok; return Ok;
} }
/******************************************************************************
* GdipGetTextureWrapMode [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
{
TRACE("(%p, %p)\n", brush, wrapmode);
if(!brush || !wrapmode)
return InvalidParameter;
*wrapmode = brush->wrap;
return Ok;
}
/****************************************************************************** /******************************************************************************
* GdipResetTextureTransform [GDIPLUS.@] * GdipResetTextureTransform [GDIPLUS.@]
*/ */
@ -1138,6 +1154,23 @@ GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
return Ok; return Ok;
} }
/******************************************************************************
* GdipSetTextureWrapMode [GDIPLUS.@]
*
* WrapMode not used, only stored
*/
GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
{
TRACE("(%p, %d)\n", brush, wrapmode);
if(!brush)
return InvalidParameter;
brush->wrap = wrapmode;
return Ok;
}
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1, GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
ARGB color2) ARGB color2)
{ {

View File

@ -399,7 +399,7 @@
@ stdcall GdipGetTextRenderingHint(ptr ptr) @ stdcall GdipGetTextRenderingHint(ptr ptr)
@ stub GdipGetTextureImage @ stub GdipGetTextureImage
@ stdcall GdipGetTextureTransform(ptr ptr) @ stdcall GdipGetTextureTransform(ptr ptr)
@ stub GdipGetTextureWrapMode @ stdcall GdipGetTextureWrapMode(ptr ptr)
@ stub GdipGetVisibleClipBounds @ stub GdipGetVisibleClipBounds
@ stub GdipGetVisibleClipBoundsI @ stub GdipGetVisibleClipBoundsI
@ stdcall GdipGetWorldTransform(ptr ptr) @ stdcall GdipGetWorldTransform(ptr ptr)
@ -596,7 +596,7 @@
@ stub GdipSetTextContrast @ stub GdipSetTextContrast
@ stdcall GdipSetTextRenderingHint(ptr long) @ stdcall GdipSetTextRenderingHint(ptr long)
@ stdcall GdipSetTextureTransform(ptr ptr) @ stdcall GdipSetTextureTransform(ptr ptr)
@ stub GdipSetTextureWrapMode @ stdcall GdipSetTextureWrapMode(ptr long)
@ stdcall GdipSetWorldTransform(ptr ptr) @ stdcall GdipSetWorldTransform(ptr ptr)
@ stdcall GdipShearMatrix(ptr long long long) @ stdcall GdipShearMatrix(ptr long long long)
@ stdcall GdipStartPathFigure(ptr) @ stdcall GdipStartPathFigure(ptr)

View File

@ -139,6 +139,7 @@ struct GpLineGradient{
struct GpTexture{ struct GpTexture{
GpBrush brush; GpBrush brush;
GpMatrix *transform; GpMatrix *transform;
WrapMode wrap; /* not used yet */
}; };
struct GpPath{ struct GpPath{

View File

@ -235,6 +235,54 @@ static void test_transform(void)
ReleaseDC(0, hdc); ReleaseDC(0, hdc);
} }
static void test_texturewrap(void)
{
GpStatus status;
GpTexture *texture;
GpGraphics *graphics = NULL;
GpBitmap *bitmap;
HDC hdc = GetDC(0);
GpWrapMode wrap;
status = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
status = GdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
expect(Ok, status);
status = GdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
expect(Ok, status);
/* NULL */
status = GdipGetTextureWrapMode(NULL, NULL);
expect(InvalidParameter, status);
status = GdipGetTextureWrapMode(texture, NULL);
expect(InvalidParameter, status);
status = GdipGetTextureWrapMode(NULL, &wrap);
expect(InvalidParameter, status);
/* get */
wrap = WrapModeClamp;
status = GdipGetTextureWrapMode(texture, &wrap);
expect(Ok, status);
expect(WrapModeTile, wrap);
/* set, then get */
wrap = WrapModeClamp;
status = GdipSetTextureWrapMode(texture, wrap);
expect(Ok, status);
wrap = WrapModeTile;
status = GdipGetTextureWrapMode(texture, &wrap);
expect(Ok, status);
expect(WrapModeClamp, wrap);
status = GdipDeleteBrush((GpBrush*)texture);
expect(Ok, status);
status = GdipDisposeImage((GpImage*)bitmap);
expect(Ok, status);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
ReleaseDC(0, hdc);
}
START_TEST(brush) START_TEST(brush)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
@ -254,6 +302,7 @@ START_TEST(brush)
test_getbounds(); test_getbounds();
test_getgamma(); test_getgamma();
test_transform(); test_transform();
test_texturewrap();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }

View File

@ -208,6 +208,8 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage*,GDIPCONST GpImageAttributes*,
REAL,REAL,REAL,REAL,GpTexture**); REAL,REAL,REAL,REAL,GpTexture**);
GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage*,GDIPCONST GpImageAttributes*, GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage*,GDIPCONST GpImageAttributes*,
INT,INT,INT,INT,GpTexture**); INT,INT,INT,INT,GpTexture**);
GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture*, GpWrapMode*);
GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture*, GpWrapMode);
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush*); GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush*);
GpStatus WINGDIPAPI GdipGetBrushType(GpBrush*,GpBrushType*); GpStatus WINGDIPAPI GdipGetBrushType(GpBrush*,GpBrushType*);
GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient*,BOOL*); GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient*,BOOL*);