Sha256: 42fb841a156db3759dc4e95801bd5619b0dfecbe5787631d0dcb5c6577eec513

Contents?: true

Size: 690 Bytes

Versions: 5

Compression:

Stored size: 690 Bytes

Contents

# An image is recreated from its individual component colors.
# The many colors of the image are created through modulating the 
# red, green, and blue values. This is an exageration of an LCD display. 


def setup
  size 200, 200  
  no_stroke
  background 0  
  c = load_image "cait.jpg"  
  xoff, yoff = 0, 0
  p = 2
  pix = p * 3  
  (c.width * c.height).times do |i|    
    pixel = c.pixels[i]    
    fill red( pixel ), 0, 0
    rect xoff, yoff, p, pix    
    fill 0, green( pixel ), 0
    rect xoff+p, yoff, p, pix    
    fill 0, 0, blue( pixel )
    rect xoff+p*2, yoff, p, pix    
    xoff += pix
    if xoff >= (width-pix)
      xoff = 0
      yoff += pix
    end
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/color/reading/reading.rb
ruby-processing-2.6.2 samples/processing_app/basics/color/reading/reading.rb
ruby-processing-2.6.1 samples/processing_app/basics/color/reading/reading.rb
ruby-processing-2.6.0 samples/processing_app/basics/color/reading/reading.rb
ruby-processing-2.5.1 samples/processing_app/basics/color/reading/reading.rb