func newNullPen() *nullPen { lb := &win.LOGBRUSH{LbStyle: win.BS_NULL} hPen := win.ExtCreatePen(win.PS_COSMETIC|win.PS_NULL, 1, lb, 0, nil) if hPen == 0 { panic("failed to create null brush") } return &nullPen{hPen: hPen} }
func NewCosmeticPen(style PenStyle, color Color) (*CosmeticPen, error) { lb := &win.LOGBRUSH{LbStyle: win.BS_SOLID, LbColor: win.COLORREF(color)} style |= win.PS_COSMETIC hPen := win.ExtCreatePen(uint32(style), 1, lb, 0, nil) if hPen == 0 { return nil, newError("ExtCreatePen failed") } return &CosmeticPen{hPen: hPen, style: style, color: color}, nil }
func NewGeometricPen(style PenStyle, width int, brush Brush) (*GeometricPen, error) { if brush == nil { return nil, newError("brush cannot be nil") } style |= win.PS_GEOMETRIC hPen := win.ExtCreatePen(uint32(style), uint32(width), brush.logbrush(), 0, nil) if hPen == 0 { return nil, newError("ExtCreatePen failed") } return &GeometricPen{ hPen: hPen, style: style, width: width, brush: brush, }, nil }