1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

photobot.Canvas.fill()

Syntax

canvas.fill(rgb, x=0, y=0, w=None, h=None, name="")

Description

Creates a new layer filled with the given rgb color. The rgb parameter is a tuple with three values (red, green, blue) ranging between 0 and 255. For example, fill((255,0,0)) creates a red fill. The layer fills the entire canvas by default, or you can set its position and size with the x, y, w (width) and h (height) parameters. You can supply a name for the fill layer.

Example

This puts the robot.jpg image at 95% opacity on an orange background .

photobot = ximport("photobot")
canvas = photobot.canvas(200,200)
canvas.fill((255,128,0))
canvas.layer("images/robot.jpg")
canvas.layers[2].opacity(95)