GradientFillRectanglePixels draws a gradient filled rectangle in native pixels.
(color1, color2 Color, orientation Orientation, bounds Rectangle)
| 531 | |
| 532 | // GradientFillRectanglePixels draws a gradient filled rectangle in native pixels. |
| 533 | func (c *Canvas) GradientFillRectanglePixels(color1, color2 Color, orientation Orientation, bounds Rectangle) error { |
| 534 | vertices := [2]win.TRIVERTEX{ |
| 535 | { |
| 536 | X: int32(bounds.X), |
| 537 | Y: int32(bounds.Y), |
| 538 | Red: uint16(color1.R()) * 256, |
| 539 | Green: uint16(color1.G()) * 256, |
| 540 | Blue: uint16(color1.B()) * 256, |
| 541 | Alpha: 0, |
| 542 | }, { |
| 543 | X: int32(bounds.X + bounds.Width), |
| 544 | Y: int32(bounds.Y + bounds.Height), |
| 545 | Red: uint16(color2.R()) * 256, |
| 546 | Green: uint16(color2.G()) * 256, |
| 547 | Blue: uint16(color2.B()) * 256, |
| 548 | Alpha: 0, |
| 549 | }, |
| 550 | } |
| 551 | |
| 552 | indices := win.GRADIENT_RECT{ |
| 553 | UpperLeft: 0, |
| 554 | LowerRight: 1, |
| 555 | } |
| 556 | |
| 557 | var o uint32 |
| 558 | if orientation == Vertical { |
| 559 | o = 1 |
| 560 | } |
| 561 | |
| 562 | if !win.GradientFill(c.hdc, &vertices[0], 2, unsafe.Pointer(&indices), 1, o) { |
| 563 | return newError("GradientFill failed") |
| 564 | } |
| 565 | |
| 566 | return nil |
| 567 | } |
| 568 | |
| 569 | // DrawText draws text at given location in 1/96" units. |
| 570 | // |
no test coverage detected