Sha256: 1ef341d52414cd2e30dedd071305b3c430bad0075b50f93321a5ca8743fcb6e6

Contents?: true

Size: 653 Bytes

Versions: 9

Compression:

Stored size: 653 Bytes

Contents

require 'ruby-processing'

# Images can be loaded and displayed to the screen at their actual size
# or any other size. 

class LoadDisplayImage < Processing::App

  def setup
    # The file "jelly.jpg" must be in the data folder
  	# of the current sketch to load successfully
    @a = load_image "jelly.jpg"
    
    no_loop # Makes draw only run once
  end
  
  def draw
  	# Displays the image at its actual size at point (0,0)
  	image @a, 0, 0
	  # Displays the image at point (100, 0) at half of its size
  	image @a, 100, 0, @a.width/2, @a.height/2
  end
  
end

LoadDisplayImage.new :title => "Load Display Image", :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/load_display_image.rb
ruby-processing-1.0.10.1 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.9 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.3 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.4 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.5 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.6 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.7 samples/processing_app/basics/image/load_display_image.rb
ruby-processing-1.0.8 samples/processing_app/basics/image/load_display_image.rb