CMYK Fill

Set a fill before drawing a shape. A cmyk color used while exporting to a .pdf or an image. Handy if the file is used for print.

drawBot.cmykFill(c, m=None, y=None, k=None, alpha=1)

Set a fill using a CMYK color before drawing a shape. This is handy if the file is intended for print.

Sets the CMYK fill color. Each value must be a float between 0.0 and 1.0.

x, y = 0, 0
s = 100

# cyan
cmykFill(1, 0, 0, 0)
rect(x, y, s, s)
x += s

# magenta
cmykFill(0, 1, 0, 0)
rect(x, y, s, s)
x += s

# yellow
cmykFill(0, 0, 1, 0)
rect(x, y, s, s)
x += s

# black
cmykFill(0, 0, 0, 1)
rect(x, y, s, s)
drawBot.cmykLinearGradient(startPoint=None, endPoint=None, colors=None, locations=None)

A cmyk linear gradient fill with:

  • startPoint as (x, y)
  • endPoint as (x, y)
  • colors as a list of colors, described similary as cmykFill
  • locations of each color as a list of floats. (optionally)

Setting a gradient will ignore the fill.

# set a gradient as the fill color
linearGradient(
    (100, 100),                                     # startPoint
    (200, 200),                                     # endPoint
    [(1, 0, 0, 1), (0, 0, 1, 0), (0, 1, 0, .2)],    # colors
    [0, .2, 1]                                      # locations
    )
# draw a rectangle
rect(100, 100, 100, 100)
drawBot.cmykRadialGradient(startPoint=None, endPoint=None, colors=None, locations=None, startRadius=0, endRadius=100)

A cmyk radial gradient fill with:

  • startPoint as (x, y)
  • endPoint as (x, y)
  • colors as a list of colors, described similary as cmykFill
  • locations of each color as a list of floats. (optionally)
  • startRadius radius around the startPoint in degrees (optionally)
  • endRadius radius around the endPoint in degrees (optionally)

Setting a gradient will ignore the fill.

# set a gradient as the fill color
cmykRadialGradient(
    (100, 100),                                     # startPoint
    (200, 200),                                     # endPoint
    [(1, 0, 0, 1), (0, 0, 1, 0), (0, 1, 0, .2)],    # colors
    [0, .2, 1],                                     # locations
    0,                                              # startRadius
    100                                             # endRadius
    )
# draw a rectangle
rect(100, 100, 100, 100)
drawBot.cmykShadow(offset, blur=None, color=None)

Adds a cmyk shadow with an offset (x, y), blur and a color. The color argument must be a tuple similarly as cmykFill.

# a red shadow with some blur and a offset
cmykShadow((3, 3), 10, (1, 0, 0, 0))

# draw a rect
rect(100, 100, 30, 30)