pen.c 16.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * Copyright (C) 2007 Google (Evan Stade)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
24 25 26

#include "objbase.h"

27 28 29 30 31 32
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);

33 34 35 36 37 38 39 40 41 42 43 44 45 46
static DWORD gdip_to_gdi_dash(GpDashStyle dash)
{
    switch(dash){
        case DashStyleSolid:
            return PS_SOLID;
        case DashStyleDash:
            return PS_DASH;
        case DashStyleDot:
            return PS_DOT;
        case DashStyleDashDot:
            return PS_DASHDOT;
        case DashStyleDashDotDot:
            return PS_DASHDOTDOT;
        case DashStyleCustom:
47
            return PS_USERSTYLE;
48 49 50 51 52 53
        default:
            ERR("Not a member of GpDashStyle enumeration\n");
            return 0;
    }
}

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
static DWORD gdip_to_gdi_join(GpLineJoin join)
{
    switch(join){
        case LineJoinRound:
            return PS_JOIN_ROUND;
        case LineJoinBevel:
            return PS_JOIN_BEVEL;
        case LineJoinMiter:
        case LineJoinMiterClipped:
            return PS_JOIN_MITER;
        default:
            ERR("Not a member of GpLineJoin enumeration\n");
            return 0;
    }
}

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
static GpPenType bt_to_pt(GpBrushType bt)
{
    switch(bt){
        case BrushTypeSolidColor:
            return PenTypeSolidColor;
        case BrushTypeHatchFill:
            return PenTypeHatchFill;
        case BrushTypeTextureFill:
            return PenTypeTextureFill;
        case BrushTypePathGradient:
            return PenTypePathGradient;
        case BrushTypeLinearGradient:
            return PenTypeLinearGradient;
        default:
            return PenTypeUnknown;
    }
}

88 89
GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
{
90 91
    GpStatus stat;

92 93
    TRACE("(%p, %p)\n", pen, clonepen);

94 95 96
    if(!pen || !clonepen)
        return InvalidParameter;

97
    *clonepen = heap_alloc_zero(sizeof(GpPen));
98 99
    if(!*clonepen)  return OutOfMemory;

100
    **clonepen = *pen;
101

102 103 104
    (*clonepen)->customstart = NULL;
    (*clonepen)->customend = NULL;
    (*clonepen)->brush = NULL;
105
    (*clonepen)->dashes = NULL;
106 107 108 109 110 111 112 113 114

    stat = GdipCloneBrush(pen->brush, &(*clonepen)->brush);

    if (stat == Ok && pen->customstart)
        stat = GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);

    if (stat == Ok && pen->customend)
        stat = GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);

115 116
    if (stat == Ok && pen->dashes)
    {
117
        (*clonepen)->dashes = heap_alloc_zero(pen->numdashes * sizeof(REAL));
118 119 120 121 122 123
        if ((*clonepen)->dashes)
            memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
        else
            stat = OutOfMemory;
    }

124 125 126 127 128 129
    if (stat != Ok)
    {
        GdipDeletePen(*clonepen);
        *clonepen = NULL;
        return stat;
    }
130

131 132
    TRACE("<-- %p\n", *clonepen);

133 134 135
    return Ok;
}

136
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit,
137
    GpPen **pen)
138 139
{
    GpBrush *brush;
140 141
    GpStatus status;

142 143
    TRACE("(%x, %.2f, %d, %p)\n", color, width, unit, pen);

144
    GdipCreateSolidFill(color, (GpSolidFill **)(&brush));
145 146 147
    status = GdipCreatePen2(brush, width, unit, pen);
    GdipDeleteBrush(brush);
    return status;
148 149 150 151
}

GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
    GpPen **pen)
152 153
{
    GpPen *gp_pen;
154
    GpBrush *clone_brush;
155

156
    TRACE("(%p, %.2f, %d, %p)\n", brush, width, unit, pen);
157

158
    if(!pen || !brush)
159 160
        return InvalidParameter;

161
    gp_pen = heap_alloc_zero(sizeof(GpPen));
162
    if(!gp_pen)    return OutOfMemory;
163 164 165 166

    gp_pen->style = GP_DEFAULT_PENSTYLE;
    gp_pen->width = width;
    gp_pen->unit = unit;
167
    gp_pen->endcap = LineCapFlat;
168 169
    gp_pen->join = LineJoinMiter;
    gp_pen->miterlimit = 10.0;
170
    gp_pen->dash = DashStyleSolid;
171
    gp_pen->offset = 0.0;
172 173
    gp_pen->customstart = NULL;
    gp_pen->customend = NULL;
174
    GdipSetMatrixElements(&gp_pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
175

176
    if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
177
        FIXME("UnitWorld, UnitPixel only supported units\n");
178
        heap_free(gp_pen);
179 180 181
        return NotImplemented;
    }

182 183 184
    GdipCloneBrush(brush, &clone_brush);
    gp_pen->brush = clone_brush;

185 186
    *pen = gp_pen;

187 188
    TRACE("<-- %p\n", *pen);

189 190 191 192 193
    return Ok;
}

GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
{
194 195
    TRACE("(%p)\n", pen);

196
    if(!pen)    return InvalidParameter;
197

198
    GdipDeleteBrush(pen->brush);
199 200
    GdipDeleteCustomLineCap(pen->customstart);
    GdipDeleteCustomLineCap(pen->customend);
201 202
    heap_free(pen->dashes);
    heap_free(pen);
203 204 205

    return Ok;
}
206

207 208
GpStatus WINGDIPAPI GdipGetPenBrushFill(GpPen *pen, GpBrush **brush)
{
209 210
    TRACE("(%p, %p)\n", pen, brush);

211 212 213 214 215 216
    if(!pen || !brush)
        return InvalidParameter;

    return GdipCloneBrush(pen->brush, brush);
}

217 218
GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
{
219 220
    TRACE("(%p, %p)\n", pen, argb);

221 222 223
    if(!pen || !argb)
        return InvalidParameter;

224 225 226 227
    if(pen->brush->bt != BrushTypeSolidColor)
        return NotImplemented;

    return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
228 229
}

230 231
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap)
{
232 233
    TRACE("(%p, %p)\n", pen, customCap);

234 235 236 237 238 239 240 241 242 243 244 245 246
    if(!pen || !customCap)
        return InvalidParameter;

    if(!pen->customend){
        *customCap = NULL;
        return Ok;
    }

    return GdipCloneCustomLineCap(pen->customend, customCap);
}

GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap)
{
247 248
    TRACE("(%p, %p)\n", pen, customCap);

249 250 251 252 253 254 255 256 257 258 259
    if(!pen || !customCap)
        return InvalidParameter;

    if(!pen->customstart){
        *customCap = NULL;
        return Ok;
    }

    return GdipCloneCustomLineCap(pen->customstart, customCap);
}

260 261
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
{
262 263
    TRACE("(%p, %p, %d)\n", pen, dash, count);

264 265 266 267 268 269 270 271 272 273 274 275
    if(!pen || !dash || count > pen->numdashes)
        return InvalidParameter;

    /* note: if you pass a negative value for count, it crashes native gdiplus. */
    if(count < 0)
        return GenericError;

    memcpy(dash, pen->dashes, count * sizeof(REAL));

    return Ok;
}

276 277
GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)
{
278 279
    TRACE("(%p, %p)\n", pen, dashCap);

280 281 282 283 284 285 286 287
    if(!pen || !dashCap)
        return InvalidParameter;

    *dashCap = pen->dashcap;

    return Ok;
}

288 289
GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)
{
290 291
    TRACE("(%p, %p)\n", pen, count);

292 293 294 295 296 297 298 299
    if(!pen || !count)
        return InvalidParameter;

    *count = pen->numdashes;

    return Ok;
}

300 301
GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)
{
302 303
    TRACE("(%p, %p)\n", pen, offset);

304 305 306 307 308 309 310 311
    if(!pen || !offset)
        return InvalidParameter;

    *offset = pen->offset;

    return Ok;
}

312 313
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
{
314 315
    TRACE("(%p, %p)\n", pen, dash);

316 317 318 319 320 321 322 323
    if(!pen || !dash)
        return InvalidParameter;

    *dash = pen->dash;

    return Ok;
}

324 325
GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)
{
326 327
    TRACE("(%p, %p)\n", pen, endCap);

328 329 330 331 332 333 334 335
    if(!pen || !endCap)
        return InvalidParameter;

    *endCap = pen->endcap;

    return Ok;
}

336 337 338 339 340 341 342 343 344 345 346 347
GpStatus WINGDIPAPI GdipGetPenFillType(GpPen *pen, GpPenType* type)
{
    TRACE("(%p, %p)\n", pen, type);

    if(!pen || !type)
        return InvalidParameter;

    *type = bt_to_pt(pen->brush->bt);

    return Ok;
}

348 349
GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)
{
350 351
    TRACE("(%p, %p)\n", pen, lineJoin);

352 353 354 355 356 357 358 359
    if(!pen || !lineJoin)
        return InvalidParameter;

    *lineJoin = pen->join;

    return Ok;
}

360 361
GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *mode)
{
362 363
    TRACE("(%p, %p)\n", pen, mode);

364 365 366 367 368 369 370 371
    if(!pen || !mode)
        return InvalidParameter;

    *mode = pen->align;

    return Ok;
}

372 373
GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)
{
374 375
    TRACE("(%p, %p)\n", pen, miterLimit);

376 377 378 379 380 381 382 383
    if(!pen || !miterLimit)
        return InvalidParameter;

    *miterLimit = pen->miterlimit;

    return Ok;
}

384 385
GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)
{
386 387
    TRACE("(%p, %p)\n", pen, startCap);

388 389 390 391 392 393 394 395
    if(!pen || !startCap)
        return InvalidParameter;

    *startCap = pen->startcap;

    return Ok;
}

396 397
GpStatus WINGDIPAPI GdipGetPenUnit(GpPen *pen, GpUnit *unit)
{
398 399
    TRACE("(%p, %p)\n", pen, unit);

400 401 402 403 404 405 406 407
    if(!pen || !unit)
        return InvalidParameter;

    *unit = pen->unit;

    return Ok;
}

408 409
GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)
{
410 411
    TRACE("(%p, %p)\n", pen, width);

412 413 414 415 416 417 418 419
    if(!pen || !width)
        return InvalidParameter;

    *width = pen->width;

    return Ok;
}

420 421
GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen)
{
422 423
    TRACE("(%p)\n", pen);

424 425 426
    if(!pen)
        return InvalidParameter;

427
    GdipSetMatrixElements(&pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
428

429
    return Ok;
430 431
}

432 433 434 435 436 437 438 439 440 441
GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix)
{
    static int calls;

    TRACE("(%p,%p)\n", pen, matrix);

    if(!pen || !matrix)
        return InvalidParameter;

    if(!(calls++))
442
        FIXME("(%p,%p) Semi-stub\n", pen, matrix);
443

444 445 446
    pen->transform = *matrix;

    return Ok;
447 448
}

449 450 451 452 453 454 455
GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)
{
    TRACE("(%p,%p)\n", pen, matrix);

    if(!pen || !matrix)
        return InvalidParameter;

456
    *matrix = pen->transform;
457

458
    return Ok;
459 460
}

461 462 463 464 465 466 467
GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)
{
    TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order);

    if(!pen)
        return InvalidParameter;

468
    return GdipTranslateMatrix(&pen->transform, dx, dy, order);
469 470
}

471 472
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)
{
473 474
    TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, sx, sy, order);

475 476 477
    if(!pen)
        return InvalidParameter;

478
    return GdipScaleMatrix(&pen->transform, sx, sy, order);
479 480
}

481 482 483 484 485 486 487
GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)
{
    TRACE("(%p,%0.2f,%u)\n", pen, angle, order);

    if(!pen)
        return InvalidParameter;

488
    return GdipRotateMatrix(&pen->transform, angle, order);
489 490
}

491 492 493 494 495 496 497 498
GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix,
    GpMatrixOrder order)
{
    TRACE("(%p,%p,%u)\n", pen, matrix, order);

    if(!pen)
        return InvalidParameter;

499
    return GdipMultiplyMatrix(&pen->transform, matrix, order);
500 501
}

502 503
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
{
504 505
    TRACE("(%p, %p)\n", pen, brush);

506 507 508 509
    if(!pen || !brush)
        return InvalidParameter;

    GdipDeleteBrush(pen->brush);
510
    return GdipCloneBrush(brush, &pen->brush);
511 512
}

513 514
GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
{
515 516
    TRACE("(%p, %x)\n", pen, argb);

517 518 519 520 521 522 523 524 525
    if(!pen)
        return InvalidParameter;

    if(pen->brush->bt != BrushTypeSolidColor)
        return NotImplemented;

    return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
}

526 527 528 529 530 531 532 533 534 535
GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)
{
    FIXME("(%p, %p): stub\n", pen, count);

    if (!pen || !count)
        return InvalidParameter;

    return NotImplemented;
}

536 537 538
GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash,
    INT count)
{
539
    FIXME("(%p, %p, %i): stub\n", pen, dash, count);
540 541 542 543 544 545 546

    if (!pen || !dash || count < 2 || count%2 == 1)
        return InvalidParameter;

    return NotImplemented;
}

547 548 549 550 551
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap)
{
    GpCustomLineCap * cap;
    GpStatus ret;

552 553
    TRACE("(%p, %p)\n", pen, customCap);

554 555
    /* native crashes on pen == NULL, customCap != NULL */
    if(!customCap) return InvalidParameter;
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570

    if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
        GdipDeleteCustomLineCap(pen->customend);
        pen->endcap = LineCapCustom;
        pen->customend = cap;
    }

    return ret;
}

GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap)
{
    GpCustomLineCap * cap;
    GpStatus ret;

571 572
    TRACE("(%p, %p)\n", pen, customCap);

573 574
    /* native crashes on pen == NULL, customCap != NULL */
    if(!customCap) return InvalidParameter;
575 576 577 578 579 580 581 582 583 584

    if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
        GdipDeleteCustomLineCap(pen->customstart);
        pen->startcap = LineCapCustom;
        pen->customstart = cap;
    }

    return ret;
}

585 586 587
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
    INT count)
{
588 589 590
    INT i;
    REAL sum = 0;

591 592
    TRACE("(%p, %p, %d)\n", pen, dash, count);

593 594 595
    if(!pen || !dash)
        return InvalidParameter;

596 597 598
    if(count <= 0)
        return OutOfMemory;

599 600
    for(i = 0; i < count; i++){
        sum += dash[i];
601
        if(dash[i] <= 0.0)
602 603 604
            return InvalidParameter;
    }

605
    heap_free(pen->dashes);
606 607 608
    pen->dashes = NULL;

    if(count > 0)
609
        pen->dashes = heap_alloc_zero(count * sizeof(REAL));
610 611 612 613 614
    if(!pen->dashes){
        pen->numdashes = 0;
        return OutOfMemory;
    }

615
    GdipSetPenDashStyle(pen, DashStyleCustom);
616 617 618 619 620 621
    memcpy(pen->dashes, dash, count * sizeof(REAL));
    pen->numdashes = count;

    return Ok;
}

622 623
GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)
{
624 625
    TRACE("(%p, %d)\n", pen, dashCap);

626 627 628 629 630 631 632 633
    if(!pen)
        return InvalidParameter;

    pen->dashcap = dashCap;

    return Ok;
}

634 635 636
/* FIXME: dash offset not used */
GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)
{
637 638
    TRACE("(%p, %.2f)\n", pen, offset);

639 640 641 642 643 644 645 646
    if(!pen)
        return InvalidParameter;

    pen->offset = offset;

    return Ok;
}

647 648
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
649 650
    TRACE("(%p, %d)\n", pen, dash);

651 652 653
    if(!pen)
        return InvalidParameter;

654
    if(dash != DashStyleCustom){
655
        heap_free(pen->dashes);
656 657 658 659
        pen->dashes = NULL;
        pen->numdashes = 0;
    }

660 661 662 663 664 665 666 667
    pen->dash = dash;
    pen->style &= ~(PS_ALTERNATE | PS_SOLID | PS_DASH | PS_DOT | PS_DASHDOT |
                    PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME);
    pen->style |= gdip_to_gdi_dash(dash);

    return Ok;
}

668 669
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
{
670 671
    TRACE("(%p, %d)\n", pen, cap);

672 673
    if(!pen)    return InvalidParameter;

674 675 676
    /* The old custom cap gets deleted even if the new style is LineCapCustom. */
    GdipDeleteCustomLineCap(pen->customend);
    pen->customend = NULL;
677 678 679 680
    pen->endcap = cap;

    return Ok;
}
681

682 683 684 685
/* FIXME: startcap, dashcap not used. */
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
    GpLineCap end, GpDashCap dash)
{
686 687
    TRACE("%p, %d, %d, %d)\n", pen, start, end, dash);

688 689 690
    if(!pen)
        return InvalidParameter;

691 692 693 694 695
    GdipDeleteCustomLineCap(pen->customend);
    GdipDeleteCustomLineCap(pen->customstart);
    pen->customend = NULL;
    pen->customstart = NULL;

696 697 698 699 700 701 702
    pen->startcap = start;
    pen->endcap = end;
    pen->dashcap = dash;

    return Ok;
}

703 704 705 706
/* FIXME: Miter line joins behave a bit differently than they do in windows.
 * Both kinds of miter joins clip if the angle is less than 11 degrees. */
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
{
707 708
    TRACE("(%p, %d)\n", pen, join);

709 710 711 712 713 714 715 716
    if(!pen)    return InvalidParameter;

    pen->join = join;
    pen->style &= ~(PS_JOIN_ROUND | PS_JOIN_BEVEL | PS_JOIN_MITER);
    pen->style |= gdip_to_gdi_join(join);

    return Ok;
}
717 718 719

GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL limit)
{
720 721
    TRACE("(%p, %.2f)\n", pen, limit);

722 723 724 725 726 727 728
    if(!pen)
        return InvalidParameter;

    pen->miterlimit = limit;

    return Ok;
}
729 730 731

GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
{
732 733
    TRACE("(%p, %d)\n", pen, cap);

734 735 736 737 738 739 740 741
    if(!pen)    return InvalidParameter;

    GdipDeleteCustomLineCap(pen->customstart);
    pen->customstart = NULL;
    pen->startcap = cap;

    return Ok;
}
742 743 744

GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
{
745 746
    TRACE("(%p, %.2f)\n", pen, width);

747 748 749 750 751 752
    if(!pen)    return InvalidParameter;

    pen->width = width;

    return Ok;
}
753

754
GpStatus WINGDIPAPI GdipSetPenMode(GpPen *pen, GpPenAlignment mode)
755
{
756 757
    TRACE("(%p, %d)\n", pen, mode);

758 759
    if(!pen)    return InvalidParameter;

760
    pen->align = mode;
761 762 763

    return Ok;
}