Sha256: 30103423bb5eacfecb1b424bb5125113cfa4b6cd0c080f05387f505ff0a387a7

Contents?: true

Size: 550 Bytes

Versions: 9

Compression:

Stored size: 550 Bytes

Contents

require 'ruby-processing'

# Loads a "mask" for an image to specify the transparency 
# in different parts of the image. The two images are blended
# together using the mask() method of PImage. 

class Alphamask < Processing::App

  def setup
    @image = load_image "test.jpg"
    @image_mask = load_image "mask.jpg"
    @image.mask @image_mask
  end
  
  def draw
  	background (mouse_x + mouse_y) / 1.5
  	image @image, 50, 50
  	image @image, mouse_x-50, mouse_y-50
  end
  
end

Alphamask.new :title => "Alphamask", :width => 200, :height => 200

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-processing-1.0.11 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.10.1 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.9 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.4 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.3 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.5 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.6 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.7 samples/processing_app/basics/image/alphamask.rb
ruby-processing-1.0.8 samples/processing_app/basics/image/alphamask.rb