GpStatus stat;
GpTexture *texture = (GpTexture*)brush;
GpTexture *new_texture;
+ UINT width, height;
- stat = GdipCreateTexture(texture->image, texture->wrap, &new_texture);
+ stat = GdipGetImageWidth(texture->image, &width);
+ if (stat != Ok) return stat;
+ stat = GdipGetImageHeight(texture->image, &height);
+ if (stat != Ok) return stat;
+
+ stat = GdipCreateTextureIA(texture->image, texture->imageattributes, 0, 0, width, height, &new_texture);
if (stat == Ok)
{
GpTexture **texture)
{
UINT width, height;
- GpImageAttributes attributes;
+ GpImageAttributes *attributes;
GpStatus stat;
TRACE("%p, %d %p\n", image, wrapmode, texture);
if (stat != Ok) return stat;
stat = GdipGetImageHeight(image, &height);
if (stat != Ok) return stat;
- attributes.wrap = wrapmode;
- return GdipCreateTextureIA(image, &attributes, 0, 0, width, height,
+ stat = GdipCreateImageAttributes(&attributes);
+
+ if (stat == Ok)
+ {
+ attributes->wrap = wrapmode;
+
+ stat = GdipCreateTextureIA(image, attributes, 0, 0, width, height,
texture);
+
+ GdipDisposeImageAttributes(attributes);
+ }
+
+ return stat;
}
/******************************************************************************
GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode,
REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
{
- GpImageAttributes attributes;
+ GpImageAttributes *attributes;
+ GpStatus stat;
TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
x, y, width, height, texture);
- attributes.wrap = wrapmode;
- return GdipCreateTextureIA(image, &attributes, x, y, width, height,
- texture);
+ stat = GdipCreateImageAttributes(&attributes);
+
+ if (stat == Ok)
+ {
+ attributes->wrap = wrapmode;
+
+ stat = GdipCreateTextureIA(image, attributes, x, y, width, height,
+ texture);
+
+ GdipDisposeImageAttributes(attributes);
+ }
+
+ return stat;
}
/******************************************************************************
goto exit;
}
+ if (imageattr)
+ {
+ status = GdipCloneImageAttributes(imageattr, &(*texture)->imageattributes);
+ }
+ else
+ {
+ status = GdipCreateImageAttributes(&(*texture)->imageattributes);
+ if (status == Ok)
+ (*texture)->imageattributes->wrap = WrapModeTile;
+ }
+ if (status != Ok)
+ goto exit;
+
(*texture)->brush.lb.lbStyle = BS_PATTERN;
(*texture)->brush.lb.lbColor = 0;
(*texture)->brush.lb.lbHatch = (ULONG_PTR)hbm;
(*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb);
(*texture)->brush.bt = BrushTypeTextureFill;
- if (imageattr)
- (*texture)->wrap = imageattr->wrap;
- else
- (*texture)->wrap = WrapModeTile;
(*texture)->image = new_image;
exit:
if (*texture)
{
GdipDeleteMatrix((*texture)->transform);
+ GdipDisposeImageAttributes((*texture)->imageattributes);
GdipFree(*texture);
*texture = NULL;
}
case BrushTypeTextureFill:
GdipDeleteMatrix(((GpTexture*)brush)->transform);
GdipDisposeImage(((GpTexture*)brush)->image);
+ GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
break;
default:
break;
if(!brush || !wrapmode)
return InvalidParameter;
- *wrapmode = brush->wrap;
+ *wrapmode = brush->imageattributes->wrap;
return Ok;
}
if(!brush)
return InvalidParameter;
- brush->wrap = wrapmode;
+ brush->imageattributes->wrap = wrapmode;
return Ok;
}