Archive

Posts Tagged ‘rmagick’

RMagick4J 0.3.6

August 16th, 2008 Serabe No comments

I am glad to announce a new version of rmagick4j.

RMagick4J aims to implement the ImageMagick funcionality and the C
portions of RMagick for make it works in JRuby.

Current stable version: 0.3.6
Project URL: http://code.google.com/p/rmagick4j/
Installation: gem install rmagick4j

Google Summer of Code project should be thanked for making this new
release possible.

In release 0.3.6 you can find the next improvements:

  • More Draw primitives (clip-path [creatin a clip-path and using a
    clip-path], fill-rule, rotate, scale [reimplemented], skewX, slewY,
    stroke-linecap, stroke-linejoin, stroke-miterlimit, translate).
  • Solve a bug with transparent stroke and line primitive.
  • Added the following Draw instance methods:
    • annotate
    • get_multiline_type_metrics
  • Solved a bug that caused the background become black while resizing
    images with alpha channel.

Please try out your applications with rmagick4j and help us provide
feedback. It is our goal to make a fully-compatible implementation of
RMagick4j in JRuby.

article clipper RMagick4J 0.3.6
 
share save 171 16 RMagick4J 0.3.6

RMagick: Dibujar con patrones

July 22nd, 2008 Serabe No comments

Una interesante cualidad de la clase Draw de RMagick es la posibilidad de definir patrones a través del método pattern.

En primer lugar, lo básico:

[ruby]
require ‘rubygems’
require ‘RMagick’

include Magick
[/ruby]

Ahora definamos el patrón. Para ello, necesitamos cinco parámetros, el nombre, dos números que recomiendo ponerlos a cero (después de unas cuantas pruebas, no he notado diferencias notables) y después las dimensiones del patrón.

[ruby]
draw = Draw.new

draw.pattern(‘circles’, 0, 0, 10, 10) do
draw.stroke ‘none’
draw.fill ‘red’
draw.rectangle 0, 0, 10, 10
draw.stroke ‘LightGreen’
draw.fill ‘blue’
draw.circle 5, 5, 5, 0
end
[/ruby]

Ya, por último, dibujamos un cuadrado y lo plasmamos en una imagen de 300×300.

[ruby]
draw.stroke ‘circles’
draw.stroke_width 25

draw.fill ‘none’

draw.polygon 150,0, 300,150, 150,300, 0,150

img = Image.new 300, 300

draw.draw img

img.write ‘pattern.jpg’
[/ruby]

Obteniéndose el siguiente resultado:

pattern RMagick: Dibujar con patrones

Dibujo con patrón como brocha

article clipper RMagick: Dibujar con patrones
 
share save 171 16 RMagick: Dibujar con patrones