WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
+/*
+ Unix stuff
+ Code from http://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
+*/
+double erf(double x)
+{
+ const float a1 = 0.254829592;
+ const float a2 = -0.284496736;
+ const float a3 = 1.421413741;
+ const float a4 = -1.453152027;
+ const float a5 = 1.061405429;
+ const float p = 0.3275911;
+ float t, y, sign;
+
+ /* Save the sign of x */
+ sign = 1;
+ if (x < 0)
+ sign = -1;
+ x = abs(x);
+
+ /* A & S 7.1.26 */
+ t = 1.0/(1.0 + p*x);
+ y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
+
+ return sign*y;
+}
+
/******************************************************************************
* GdipCloneBrush [GDIPLUS.@]
*/
switch(brush->bt){
case BrushTypeSolidColor:
+ {
+ GpSolidFill *fill;
*clone = GdipAlloc(sizeof(GpSolidFill));
if (!*clone) return OutOfMemory;
+ fill = (GpSolidFill*)*clone;
+
memcpy(*clone, brush, sizeof(GpSolidFill));
+ (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
+ fill->bmp = ARGB2BMP(fill->color);
+ break;
+ }
+ case BrushTypeHatchFill:
+ *clone = GdipAlloc(sizeof(GpHatch));
+ if (!*clone) return OutOfMemory;
+
+ memcpy(*clone, brush, sizeof(GpHatch));
+
(*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
break;
case BrushTypePathGradient:{
break;
}
- case BrushTypeLinearGradient:
- *clone = GdipAlloc(sizeof(GpLineGradient));
- if(!*clone) return OutOfMemory;
+ case BrushTypeLinearGradient:{
+ GpLineGradient *dest, *src;
+ INT count, pcount;
+
+ dest = GdipAlloc(sizeof(GpLineGradient));
+ if(!dest) return OutOfMemory;
+
+ src = (GpLineGradient*)brush;
+
+ memcpy(dest, src, sizeof(GpLineGradient));
+
+ dest->brush.gdibrush = CreateSolidBrush(dest->brush.lb.lbColor);
+
+ count = dest->blendcount;
+ dest->blendfac = GdipAlloc(count * sizeof(REAL));
+ dest->blendpos = GdipAlloc(count * sizeof(REAL));
+ pcount = dest->pblendcount;
+ if (pcount)
+ {
+ dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
+ dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
+ }
+
+ if (!dest->blendfac || !dest->blendpos ||
+ (pcount && (!dest->pblendcolor || !dest->pblendpos)))
+ {
+ GdipFree(dest->blendfac);
+ GdipFree(dest->blendpos);
+ GdipFree(dest->pblendcolor);
+ GdipFree(dest->pblendpos);
+ DeleteObject(dest->brush.gdibrush);
+ GdipFree(dest);
+ return OutOfMemory;
+ }
+
+ memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
+ memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
- memcpy(*clone, brush, sizeof(GpLineGradient));
+ if (pcount)
+ {
+ memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
+ memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
+ }
- (*clone)->gdibrush = CreateSolidBrush((*clone)->lb.lbColor);
+ *clone = &dest->brush;
break;
+ }
case BrushTypeTextureFill:
*clone = GdipAlloc(sizeof(GpTexture));
if(!*clone) return OutOfMemory;
return Ok;
}
+static const char HatchBrushes[][8] = {
+ { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HatchStyleHorizontal */
+ { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleVertical */
+ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HatchStyleForwardDiagonal */
+ { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HatchStyleBackwardDiagonal */
+ { 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleCross */
+ { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }, /* HatchStyleDiagonalCross */
+ { 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80 }, /* HatchStyle05Percent */
+ { 0x00, 0x02, 0x00, 0x88, 0x00, 0x20, 0x00, 0x88 }, /* HatchStyle10Percent */
+ { 0x00, 0x22, 0x00, 0xcc, 0x00, 0x22, 0x00, 0xcc }, /* HatchStyle20Percent */
+ { 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc }, /* HatchStyle25Percent */
+ { 0x00, 0xcc, 0x04, 0xcc, 0x00, 0xcc, 0x40, 0xcc }, /* HatchStyle30Percent */
+ { 0x44, 0xcc, 0x22, 0xcc, 0x44, 0xcc, 0x22, 0xcc }, /* HatchStyle40Percent */
+ { 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc }, /* HatchStyle50Percent */
+ { 0x55, 0xcd, 0x55, 0xee, 0x55, 0xdc, 0x55, 0xee }, /* HatchStyle60Percent */
+ { 0x55, 0xdd, 0x55, 0xff, 0x55, 0xdd, 0x55, 0xff }, /* HatchStyle70Percent */
+ { 0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff }, /* HatchStyle75Percent */
+ { 0x55, 0xff, 0x59, 0xff, 0x55, 0xff, 0x99, 0xff }, /* HatchStyle80Percent */
+ { 0x77, 0xff, 0xdd, 0xff, 0x77, 0xff, 0xfd, 0xff }, /* HatchStyle90Percent */
+ { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, /* HatchStyleLightDownwardDiagonal */
+ { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, /* HatchStyleLightUpwardDiagonal */
+ { 0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc }, /* HatchStyleDarkDownwardDiagonal */
+ { 0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99 }, /* HatchStyleDarkUpwardDiagonal */
+ { 0xc1, 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0 }, /* HatchStyleWideDownwardDiagonal */
+ { 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83, 0xc1 }, /* HatchStyleWideUpwardDiagonal */
+ { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* HatchStyleLightVertical */
+ { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleLightHorizontal */
+ { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, /* HatchStyleNarrowVertical */
+ { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }, /* HatchStyleNarrowHorizontal */
+ { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, /* HatchStyleDarkVertical */
+ { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
+};
+
+/******************************************************************************
+ * GdipCreateHatchBrush [GDIPLUS.@]
+ */
+GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
+{
+ COLORREF fgcol = ARGB2COLORREF(forecol);
+ GpStatus stat = Ok;
+
+ TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
+
+ if(!brush) return InvalidParameter;
+
+ *brush = GdipAlloc(sizeof(GpHatch));
+ if (!*brush) return OutOfMemory;
+
+ if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
+ {
+ HBITMAP hbmp;
+ HDC hdc;
+ BITMAPINFOHEADER bmih;
+ DWORD* bits;
+ int x, y;
+
+ hdc = CreateCompatibleDC(0);
+
+ if (hdc)
+ {
+ bmih.biSize = sizeof(bmih);
+ bmih.biWidth = 8;
+ bmih.biHeight = 8;
+ bmih.biPlanes = 1;
+ bmih.biBitCount = 32;
+ bmih.biCompression = BI_RGB;
+ bmih.biSizeImage = 0;
+
+ hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+
+ if (hbmp)
+ {
+ for (y=0; y<8; y++)
+ for (x=0; x<8; x++)
+ if ((HatchBrushes[hatchstyle][y] & (0x80 >> x)) != 0)
+ bits[y*8+x] = forecol;
+ else
+ bits[y*8+x] = backcol;
+ }
+ else
+ stat = GenericError;
+
+ DeleteDC(hdc);
+ }
+ else
+ stat = GenericError;
+
+ if (stat == Ok)
+ {
+ (*brush)->brush.lb.lbStyle = BS_PATTERN;
+ (*brush)->brush.lb.lbColor = 0;
+ (*brush)->brush.lb.lbHatch = (ULONG_PTR)hbmp;
+ (*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
+
+ DeleteObject(hbmp);
+ }
+ }
+ else
+ {
+ FIXME("Unimplemented hatch style %d\n", hatchstyle);
+
+ (*brush)->brush.lb.lbStyle = BS_SOLID;
+ (*brush)->brush.lb.lbColor = fgcol;
+ (*brush)->brush.lb.lbHatch = 0;
+ (*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
+ }
+
+ if (stat == Ok)
+ {
+ (*brush)->brush.bt = BrushTypeHatchFill;
+ (*brush)->forecol = forecol;
+ (*brush)->backcol = backcol;
+ (*brush)->hatchstyle = hatchstyle;
+ }
+ else
+ {
+ GdipFree(*brush);
+ *brush = NULL;
+ }
+
+ return stat;
+}
+
/******************************************************************************
* GdipCreateLineBrush [GDIPLUS.@]
*/
(*line)->wrap = wrap;
(*line)->gamma = FALSE;
+ (*line)->rect.X = (startpoint->X < endpoint->X ? startpoint->X: endpoint->X);
+ (*line)->rect.Y = (startpoint->Y < endpoint->Y ? startpoint->Y: endpoint->Y);
+ (*line)->rect.Width = fabs(startpoint->X - endpoint->X);
+ (*line)->rect.Height = fabs(startpoint->Y - endpoint->Y);
+
+ if ((*line)->rect.Width == 0)
+ {
+ (*line)->rect.X -= (*line)->rect.Height / 2.0f;
+ (*line)->rect.Width = (*line)->rect.Height;
+ }
+ else if ((*line)->rect.Height == 0)
+ {
+ (*line)->rect.Y -= (*line)->rect.Width / 2.0f;
+ (*line)->rect.Height = (*line)->rect.Width;
+ }
+
+ (*line)->blendcount = 1;
+ (*line)->blendfac = GdipAlloc(sizeof(REAL));
+ (*line)->blendpos = GdipAlloc(sizeof(REAL));
+
+ if (!(*line)->blendfac || !(*line)->blendpos)
+ {
+ GdipFree((*line)->blendfac);
+ GdipFree((*line)->blendpos);
+ DeleteObject((*line)->brush.gdibrush);
+ GdipFree(*line);
+ *line = NULL;
+ return OutOfMemory;
+ }
+
+ (*line)->blendfac[0] = 1.0f;
+ (*line)->blendpos[0] = 1.0f;
+
+ (*line)->pblendcolor = NULL;
+ (*line)->pblendpos = NULL;
+ (*line)->pblendcount = 0;
+
return Ok;
}
GpLineGradient **line)
{
GpPointF start, end;
+ GpStatus stat;
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
wrap, line);
if(!line || !rect)
return InvalidParameter;
- start.X = rect->X;
- start.Y = rect->Y;
- end.X = rect->X + rect->Width;
- end.Y = rect->Y + rect->Height;
+ switch (mode)
+ {
+ case LinearGradientModeHorizontal:
+ start.X = rect->X;
+ start.Y = rect->Y;
+ end.X = rect->X + rect->Width;
+ end.Y = rect->Y;
+ break;
+ case LinearGradientModeVertical:
+ start.X = rect->X;
+ start.Y = rect->Y;
+ end.X = rect->X;
+ end.Y = rect->Y + rect->Height;
+ break;
+ case LinearGradientModeForwardDiagonal:
+ start.X = rect->X;
+ start.Y = rect->Y;
+ end.X = rect->X + rect->Width;
+ end.Y = rect->Y + rect->Height;
+ break;
+ case LinearGradientModeBackwardDiagonal:
+ start.X = rect->X + rect->Width;
+ start.Y = rect->Y;
+ end.X = rect->X;
+ end.Y = rect->Y + rect->Height;
+ break;
+ default:
+ return InvalidParameter;
+ }
+
+ stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
- return GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
+ if (stat == Ok)
+ (*line)->rect = *rect;
+
+ return stat;
}
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
(*sf)->brush.gdibrush = CreateSolidBrush(col);
(*sf)->brush.bt = BrushTypeSolidColor;
(*sf)->color = color;
+ (*sf)->bmp = ARGB2BMP(color);
return Ok;
}
n_y + n_height > ((GpBitmap*)image)->height)
return InvalidParameter;
- IPicture_get_Handle(image->picture, (OLE_HANDLE*)&hbm);
+ hbm = ((GpBitmap*)image)->hbitmap;
if(!hbm) return GenericError;
- IPicture_get_CurDC(image->picture, &hdc);
+ hdc = ((GpBitmap*)image)->hdc;
bm_is_selected = (hdc != 0);
pbmi = GdipAlloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
/* image is flipped */
if(pbmi->bmiHeader.biHeight > 0){
- dibits += pbmi->bmiHeader.biSizeImage;
+ dibits += image_stride * (pbmi->bmiHeader.biHeight - 1);
image_stride *= -1;
textbits += stride * (n_height - 1);
stride *= -1;
return Ok;
}
+GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
+{
+ TRACE("(%p, %p)\n", brush, backcol);
+
+ if(!brush || !backcol) return InvalidParameter;
+
+ *backcol = brush->backcol;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
+{
+ TRACE("(%p, %p)\n", brush, forecol);
+
+ if(!brush || !forecol) return InvalidParameter;
+
+ *forecol = brush->forecol;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
+{
+ TRACE("(%p, %p)\n", brush, hatchstyle);
+
+ if(!brush || !hatchstyle) return InvalidParameter;
+
+ *hatchstyle = brush->hatchstyle;
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
{
TRACE("(%p)\n", brush);
GdipFree(((GpPathGradient*) brush)->blendpos);
break;
case BrushTypeSolidColor:
+ if (((GpSolidFill*)brush)->bmp)
+ DeleteObject(((GpSolidFill*)brush)->bmp);
+ break;
case BrushTypeLinearGradient:
+ GdipFree(((GpLineGradient*)brush)->blendfac);
+ GdipFree(((GpLineGradient*)brush)->blendpos);
+ GdipFree(((GpLineGradient*)brush)->pblendcolor);
+ GdipFree(((GpLineGradient*)brush)->pblendpos);
break;
case BrushTypeTextureFill:
GdipDeleteMatrix(((GpTexture*)brush)->transform);
}
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
- GDIPCONST REAL *blend, GDIPCONST REAL* positions, INT count)
+ GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
{
- static int calls;
+ REAL *new_blendfac, *new_blendpos;
- if(!brush || !blend || !positions || count <= 0)
+ TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
+
+ if(!brush || !factors || !positions || count <= 0 ||
+ (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
+ new_blendfac = GdipAlloc(count * sizeof(REAL));
+ new_blendpos = GdipAlloc(count * sizeof(REAL));
+
+ if (!new_blendfac || !new_blendpos)
+ {
+ GdipFree(new_blendfac);
+ GdipFree(new_blendpos);
+ return OutOfMemory;
+ }
+
+ memcpy(new_blendfac, factors, count * sizeof(REAL));
+ memcpy(new_blendpos, positions, count * sizeof(REAL));
+
+ GdipFree(brush->blendfac);
+ GdipFree(brush->blendpos);
+
+ brush->blendcount = count;
+ brush->blendfac = new_blendfac;
+ brush->blendpos = new_blendpos;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
+ REAL *positions, INT count)
+{
+ TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
+
+ if (!brush || !factors || !positions || count <= 0)
+ return InvalidParameter;
+
+ if (count < brush->blendcount)
+ return InsufficientBuffer;
+
+ memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
+ memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
+{
+ TRACE("(%p, %p)\n", brush, count);
+
+ if (!brush || !count)
+ return InvalidParameter;
+
+ *count = brush->blendcount;
return Ok;
}
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
REAL scale)
{
- static int calls;
+ REAL factors[33];
+ REAL positions[33];
+ int num_points = 0;
+ int i;
+ const int precision = 16;
+ REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
+ REAL min_erf;
+ REAL scale_erf;
+
+ TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
+ /* we want 2 standard deviations */
+ erf_range = 2.0 / sqrt(2);
- return NotImplemented;
+ /* calculate the constants we need to normalize the error function to be
+ between 0.0 and scale over the range we need */
+ min_erf = erf(-erf_range);
+ scale_erf = scale / (-2.0 * min_erf);
+
+ if (focus != 0.0)
+ {
+ positions[0] = 0.0;
+ factors[0] = 0.0;
+ for (i=1; i<precision; i++)
+ {
+ positions[i] = focus * i / precision;
+ factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
+ }
+ num_points += precision;
+ }
+
+ positions[num_points] = focus;
+ factors[num_points] = scale;
+ num_points += 1;
+
+ if (focus != 1.0)
+ {
+ for (i=1; i<precision; i++)
+ {
+ positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
+ factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
+ }
+ num_points += precision;
+ positions[num_points-1] = 1.0;
+ factors[num_points-1] = 0.0;
+ }
+
+ return GdipSetLineBlend(line, factors, positions, num_points);
}
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
return NotImplemented;
}
+GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
+ GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
+{
+ FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
ARGB argb)
{
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
REAL scale)
{
- static int calls;
+ REAL factors[3];
+ REAL positions[3];
+ int num_points = 0;
- if(!(calls++))
- FIXME("not implemented\n");
+ TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
- return NotImplemented;
+ if (!brush) return InvalidParameter;
+
+ if (focus != 0.0)
+ {
+ factors[num_points] = 0.0;
+ positions[num_points] = 0.0;
+ num_points++;
+ }
+
+ factors[num_points] = scale;
+ positions[num_points] = focus;
+ num_points++;
+
+ if (focus != 1.0)
+ {
+ factors[num_points] = 0.0;
+ positions[num_points] = 1.0;
+ num_points++;
+ }
+
+ return GdipSetLineBlend(brush, factors, positions, num_points);
}
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
+{
+ ARGB *new_color;
+ REAL *new_pos;
+ TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
+
+ if (!brush || !blend || !positions || count < 2 ||
+ positions[0] != 0.0f || positions[count-1] != 1.0f)
+ {
+ return InvalidParameter;
+ }
+
+ new_color = GdipAlloc(count * sizeof(ARGB));
+ new_pos = GdipAlloc(count * sizeof(REAL));
+ if (!new_color || !new_pos)
+ {
+ GdipFree(new_color);
+ GdipFree(new_pos);
+ return OutOfMemory;
+ }
+
+ memcpy(new_color, blend, sizeof(ARGB) * count);
+ memcpy(new_pos, positions, sizeof(REAL) * count);
+
+ GdipFree(brush->pblendcolor);
+ GdipFree(brush->pblendpos);
+
+ brush->pblendcolor = new_color;
+ brush->pblendpos = new_pos;
+ brush->pblendcount = count;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
+ ARGB *blend, REAL* positions, INT count)
+{
+ if (!brush || !blend || !positions || count < 2)
+ return InvalidParameter;
+
+ if (brush->pblendcount == 0)
+ return GenericError;
+
+ if (count < brush->pblendcount)
+ return InsufficientBuffer;
+
+ memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
+ memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
+ INT *count)
+{
+ if (!brush || !count)
+ return InvalidParameter;
+
+ *count = brush->pblendcount;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
{
static int calls;
return NotImplemented;
}
+GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy,
+ GpMatrixOrder order)
+{
+ static int calls;
+
+ if(!(calls++))
+ FIXME("not implemented\n");
+
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient* brush,
REAL dx, REAL dy, GpMatrixOrder order)
{
if(!brush || !rect)
return InvalidParameter;
- rect->X = (brush->startpoint.X < brush->endpoint.X ? brush->startpoint.X: brush->endpoint.X);
- rect->Y = (brush->startpoint.Y < brush->endpoint.Y ? brush->startpoint.Y: brush->endpoint.Y);
-
- rect->Width = fabs(brush->startpoint.X - brush->endpoint.X);
- rect->Height = fabs(brush->startpoint.Y - brush->endpoint.Y);
+ *rect = brush->rect;
return Ok;
}
return ret;
}
+
+GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
+ REAL angle, GpMatrixOrder order)
+{
+ static int calls;
+
+ if(!brush)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
+
+ return NotImplemented;
+}