examples/vignette.rb in rmagick-2.13.4 vs examples/vignette.rb in rmagick-2.14.0

- old
+ new

@@ -1,6 +1,6 @@ -require 'RMagick' +require 'rmagick' include Magick puts <<END_INFO vi-gnette (n.) vin-'yet @@ -11,11 +11,11 @@ images. This example creates a vignette from a picture of a ballerina. It takes a few seconds to run. Be patient. END_INFO -ballerina = Image.read("../doc/ex/images/Ballerina3.jpg")[0] +ballerina = Image.read('../doc/ex/images/Ballerina3.jpg')[0] # Note: this technique won't work with every image. To make a pretty # vignette you need an image with a uniform, fairly dark background. # Start by drawing a white oval on a black background. (Although you don't @@ -51,29 +51,28 @@ # the oval remain opaque. Each gray pixel around the border of the oval has a # varying level of transparency depending on how dark or light it is. ballerina.matte = true # Ensure the ballerina image's opacity channel is enabled. oval.matte = false # Force the CopyOpacityCompositeOp to use pixel intensity - # to determine how much transparency to add to the ballerina - # pixels. +# to determine how much transparency to add to the ballerina +# pixels. ballerina = ballerina.composite(oval, CenterGravity, CopyOpacityCompositeOp) # Since the vignette has multiple levels of transparency, we can't # save it as a GIF or a JPEG. The PNG format can handle it, though. begin - ballerina.write("vignette.png") + ballerina.write('vignette.png') rescue ImageMagickError - puts "Write failed. No PNG support?" - # In case PNG support isn't installed, just ignore the exception. + puts 'Write failed. No PNG support?' + # In case PNG support isn't installed, just ignore the exception. end # At this point the vignette is complete. However, the `display' method only # supports 1`level of transparency. Therefore, composite the vignette over a # standard "checkerboard" background. The resulting image will be 100% opaque. -checkerboard = Image.read("pattern:checkerboard") {self.size = "#{ballerina.columns}x#{ballerina.rows}"} +checkerboard = Image.read('pattern:checkerboard') {self.size = "#{ballerina.columns}x#{ballerina.rows}"} vignette = checkerboard[0].composite(ballerina, CenterGravity, OverCompositeOp) vignette.display exit -