Hello there all,
i have a simple function to draw an image, but i cannot for the life
of me figgure out from the docs how to make it about 20% transparent.
def circle_image(zoom)
site = self.site
zoomhash = {13 => 0.5, 14 => 1, 15 => 2, 16 => 4}
r = (self.radius.to_f * zoomhash[zoom.to_i].to_f)
canvas = Magick::Image.new((2 * r), (2*r),
Magick::HatchFill.new('transparent', 'transparent'))
gc = Magick::Draw.new
# for the outside perimeter of the circle
gc.stroke('black')
gc.stroke_width(1)
# fill in the inside
color = KeyWord.stat_description(site.status_sensor.last_value)[1]
gc.fill(color)
gc.circle(r, r, 0, r)
image = gc.draw(canvas)
canvas.write("public/images/tmp/#{site.id}.png")
end
Hello there all,
i have a simple function to draw an image, but i cannot for the life
of me figgure out from the docs how to make it about 20% transparent.
def circle_image(zoom)
site = self.site
zoomhash = {13 => 0.5, 14 => 1, 15 => 2, 16 => 4}
r = (self.radius.to_f * zoomhash[zoom.to_i].to_f)
canvas = Magick::Image.new((2 * r), (2*r),
Magick::HatchFill.new('transparent', 'transparent'))
gc = Magick::Draw.new
# for the outside perimeter of the circle
gc.stroke('black')
gc.stroke_width(1)
# fill in the inside
color = KeyWord.stat_description(site.status_sensor.last_value)[1]
gc.fill(color)
gc.circle(r, r, 0, r)
image = gc.draw(canvas)
canvas.write("public/images/tmp/#{site.id}.png")
end
fill_opacity was what i was looking for,
thanks very much.
shawn
···
On Feb 6, 2008 9:27 AM, Tim Hunter <rmagick@gmail.com> wrote:
Shawn Bright wrote:
> Hello there all,
> i have a simple function to draw an image, but i cannot for the life
> of me figgure out from the docs how to make it about 20% transparent.
>
> def circle_image(zoom)
> site = self.site
> zoomhash = {13 => 0.5, 14 => 1, 15 => 2, 16 => 4}
> r = (self.radius.to_f * zoomhash[zoom.to_i].to_f)
> canvas = Magick::Image.new((2 * r), (2*r),
> Magick::HatchFill.new('transparent', 'transparent'))
> gc = Magick::Draw.new
> # for the outside perimeter of the circle
> gc.stroke('black')
> gc.stroke_width(1)
> # fill in the inside
> color = KeyWord.stat_description(site.status_sensor.last_value)[1]
> gc.fill(color)
> gc.circle(r, r, 0, r)
> image = gc.draw(canvas)
> canvas.write("public/images/tmp/#{site.id}.png")
> end
>
> please help, thanks
>
> shawn