Zach Beane ([info]xach) wrote,
@ 2008-06-30 16:36:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Entry tags:lisp, vecto

New vecto

I pushed out Vecto 1.3.1. New in this version:

  • stroke-to-paths will convert stroke outlines of the current path to a new set of paths you can fill
  • string-paths will add paths for a string in the current font, instead of painting the text
  • set-gradient-fill will let you fill paths with a simple axial gradient. It's not much, but it's a start...

Many thanks to Ben Deane for providing a functional fill patch that made adding gradients much easier, and for suggesting the text-to-paths functionality. Thanks also to Jakub Higersberger for showing me how easy gradients could be. (I wound up using a very simple formula straight from the Adobe PDF Reference.)

This uses a simple white-to-transparent gradient:

Here's some code that uses all three new features:

(defun text-paths (file)
  (with-canvas (:width 400 :height 100)
    (set-font (get-font "/tmp/font.ttf") 70)
    (centered-string-paths 200 15 "Hello, world!")
    (set-line-join :round)
    (set-line-cap :round)
    (set-line-width 3)
    (set-dash-pattern #(0 5) 0)
    (stroke-to-paths)
    (set-gradient-fill 0 0   1 0 0 0.5
                       0 100 1 1 1 1)
    (fill-path)
    (save-png file)))

I fell short of exporting and documenting the functional fill option that enabled gradients, because I've run out of time. Maybe next release!




(3 comments) - (Post a new comment)

very pretty!
(Anonymous)
2008-07-01 06:53 am UTC (link)
mind posting the code that generates the first picture?

(Reply to this) (Thread)

Re: very pretty!
(Anonymous)
2008-07-01 07:24 am UTC (link)
mind googling for 'vecto feedlike icon' ? (see first hit!)

(Reply to this) (Parent)

Re: very pretty!
[info]xach
2008-07-01 10:14 am UTC (link)
It's part of the vecto documentation at http://www.xach.com/lisp/vecto/

(Reply to this) (Parent)


(3 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…