Class RSILLogoMaker
In: rsil/examples/rsillogomaker.rb
Parent: Object
RSILLogoMaker TopLevel
Class:RSILLogoMaker
File:rsillogomaker.rb
Purpose:RSILLogoMaker is a programm that generates an animated GIF with the help of module RSIL and RMagick.
Created by:Mario Pehle, 2006/06/18
Required modules:-
Offers functions:-

Methods

make_logo  

Public Instance methods

Description:Reads in the ressoureces, generates the logo and saves it to ‘ani.gif‘
Precondition:-
Postcondition:-
Exceptions:-
Uses:RS::Graphics::RSImage, RS::Graphics::RSImageList, RS::Graphics::RSFilter, RS::Geometry::RSPoint, RS::Geometry::RSRectangle, RS::Converter::RSConverter, Magick::ImageList
Returns:self
Parameters:Name | i/o/io | default | Meaning
:(anonymous) | i | - | Block, the code to proceed

[Source]

    # File rsil/examples/rsillogomaker.rb, line 43
43:   def make_logo
44:     
45:     bgimage = RS::Graphics::RSImageX.new 'images/bg.jpg'
46:     headlist = RS::Graphics::RSImageList.new
47:     filter = RS::Graphics::RSFilter.new 'CISourceAtopCompositing', true
48:     rectangle = RS::Geometry::RSRectangle.new(
49:       0.0, 0.0, nil,
50:       bgimage.width, bgimage.height
51:     )
52:     4.times do |i|
53:       headlist << RS::Graphics::RSImageX.new("images/k#{i+1}.png")
54:       headlist.last.draw_on(
55:         rectangle,
56:         RS::Geometry::RSPoint.new(
57:           (bgimage.width-headlist.last.width)/2.0,
58:           (bgimage.height-headlist.last.height)/2.0
59:         )
60:       )
61:       filter.inputImage = headlist.last
62:       filter.inputBackgroundImage = bgimage
63:       headlist.last.apply_filters! filter
64:     end
65: 
66:     4.times do |i|
67:       headlist.unshift RS::Graphics::RSImageX.new('images/k1.png')
68:       headlist.first.draw_on(
69:         rectangle,
70:         RS::Geometry::RSPoint.new(
71:           (bgimage.width-headlist.first.width)/2.0,
72:           (i+1)*bgimage.height/4
73:         )
74:       )
75:       filter.inputImage = headlist.first
76:       filter.inputBackgroundImage = bgimage
77:       headlist.first.apply_filters! filter
78:     end
79: 
80:     scalefilter = RS::Graphics::RSFilter.new 'CILanczosScaleTransform', true
81:     headlist.each do |e|
82:       scalefilter.inputScale = 0.5
83:       scalefilter.inputImage = e
84:       e.apply_filters! scalefilter
85:     end
86: 
87:     temp = headlist.reverse
88:     temp.delete_at 0
89:     temp.delete_at temp.length-1
90:     headlist.concat temp
91: 
92:     converter = RS::Converter::RSConverter.new
93:     rmlist = converter.convert(headlist, Magick::ImageList)
94:     rmlist.each { |e| e.delay = 10 }
95:     rmlist.first.delay = 250
96:     rmlist.write 'ani.gif'
97:     
98:   end

[Validate]