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.bt = BrushTypeTextureFill;
(*texture)->wrap = imageattr->wrap;
GdipFree(dibits);
GdipFree(buff);
@ -912,6 +913,21 @@ GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
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.@]
*/
@ -1138,6 +1154,23 @@ GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
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,
ARGB color2)
{

View file

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

View file

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

View file

@ -235,6 +235,54 @@ static void test_transform(void)
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)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -254,6 +302,7 @@ START_TEST(brush)
test_getbounds();
test_getgamma();
test_transform();
test_texturewrap();
GdiplusShutdown(gdiplusToken);
}

View file

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