francesco fantoni | 1 Dec 2008 15:44
Favicon

cairo gradient shadows

second attempt at drop-down shadows with shoebot.
this time it's pure cairo gradient.
the results are much uglier than the bitmap solution with PIL, but quite
faster.
example:

http://www.hv-a.com/shoebot/images/shadow_2.png

it is made with a cairo radial gradient, and maybe a linear gradient
along path's bbox diagonal would look nicer,i will try.
needs more tweaking, maybe i'd put it in roadmap for 0.4 release or
something like that.

btw. with both methods i've tried up to now, there's an issue with
rotated paths, because shadows gets the rotation as well and looks like
light source had changed, but maybe i can solve this...

f.

--

-- 
architetto Francesco Fantoni
<HVA - Hermanitos Verdes Architetti>
l.go san giacomo, 38
I-41100 modena (italia)
tel.& fax. +39.059.217554
skype:  hva_studio
e.mail: francesco@...
web:    http://www.hv-a.com
Stuart Axon | 1 Dec 2008 16:07
Picon
Favicon

Re: cairo gradient shadows

How does the blur effect in inkscape work, could we do something similar ?

----- Original Message ----
From: francesco fantoni <francesco@...>
To: shoebot-devel@...
Sent: Monday, December 1, 2008 2:44:48 PM
Subject: [shoebot-devel] cairo gradient shadows

second attempt at drop-down shadows with shoebot.
this time it's pure cairo gradient.
the results are much uglier than the bitmap solution with PIL, but quite
faster.
example:

http://www.hv-a.com/shoebot/images/shadow_2.png

it is made with a cairo radial gradient, and maybe a linear gradient
along path's bbox diagonal would look nicer,i will try.
needs more tweaking, maybe i'd put it in roadmap for 0.4 release or
something like that.

btw. with both methods i've tried up to now, there's an issue with
rotated paths, because shadows gets the rotation as well and looks like
light source had changed, but maybe i can solve this...

f.

--

-- 
architetto Francesco Fantoni
<HVA - Hermanitos Verdes Architetti>
(Continue reading)

francesco fantoni | 1 Dec 2008 16:19
Favicon

Re: cairo gradient shadows

i don't think it's rendered via cairo yet, but i will check

Il giorno lun, 01/12/2008 alle 07.07 -0800, Stuart Axon ha scritto:
> How does the blur effect in inkscape work, could we do something similar ?
> 
> 
> 
> ----- Original Message ----
> From: francesco fantoni <francesco@...>
> To: shoebot-devel@...
> Sent: Monday, December 1, 2008 2:44:48 PM
> Subject: [shoebot-devel] cairo gradient shadows
> 
> second attempt at drop-down shadows with shoebot.
> this time it's pure cairo gradient.
> the results are much uglier than the bitmap solution with PIL, but quite
> faster.
> example:
> 
> http://www.hv-a.com/shoebot/images/shadow_2.png
> 
> it is made with a cairo radial gradient, and maybe a linear gradient
> along path's bbox diagonal would look nicer,i will try.
> needs more tweaking, maybe i'd put it in roadmap for 0.4 release or
> something like that.
> 
> btw. with both methods i've tried up to now, there's an issue with
> rotated paths, because shadows gets the rotation as well and looks like
> light source had changed, but maybe i can solve this...
> 
(Continue reading)

Favicon

Re: cairo gradient shadows

another test with dropdown shadow with cairo gradients, this time it
works with strokes as well, and it depends on path fill alpha.
I fixed the problem with shadow rotation as well.
there's a shadow(dx,dy,alpha,blur) and a noshadow() command.
dx and dy are shadow offset, alpha is a value that is multiplied with
path fillcolor alpha, and blur is obviously not used at present.

screenshots:
http://www.hv-a.com/shoebot/images/shadow_3.jpg
http://www.hv-a.com/shoebot/images/shadow_4.jpg

it's not too nice, and it's not too fast either, but as a first test it
could be ok.

Il giorno lun, 01/12/2008 alle 15.44 +0100, francesco fantoni ha
scritto:
> second attempt at drop-down shadows with shoebot.
> this time it's pure cairo gradient.
> the results are much uglier than the bitmap solution with PIL, but quite
> faster.
> example:
> 
> http://www.hv-a.com/shoebot/images/shadow_2.png
> 
> it is made with a cairo radial gradient, and maybe a linear gradient
> along path's bbox diagonal would look nicer,i will try.
> needs more tweaking, maybe i'd put it in roadmap for 0.4 release or
> something like that.
> 
> btw. with both methods i've tried up to now, there's an issue with
(Continue reading)

Dave Crossland | 2 Dec 2008 16:44
Gravatar

image() error

Hi,

image() doesn't work for me, giving the following traceback:

Traceback (most recent call last):
  File "./shoebot-ide", line 796, in run_script
    sbot_window = gtkui.ShoebotWindow(codestring,
self.use_socketserver, 7777, self.use_varwindow)
  File "/home/crossland/src/shoebot-ng/shoebot/gtkui.py", line 223, in __init__
    self.canvas = ShoebotDrawingArea(self, self.bot)
  File "/home/crossland/src/shoebot-ng/shoebot/gtkui.py", line 27, in __init__
    self.bot.run()
  File "/home/crossland/src/shoebot-ng/shoebot/__init__.py", line 312, in run
    exec source_or_code in self.namespace
  File "shoebot_code", line 25, in <module>
  File "/home/crossland/src/shoebot-ng/shoebot/__init__.py", line 765, in image
    self.context.set_source_surface(imagesurface, x, y)
AttributeError: NodeBot instance has no attribute 'context'

Here is my script:

----------
size(300, 300)
colorrange(255)
background(76,102,51)
fill(186,186,93)
image("/home/me/a.png", 50, 50, width=10, height=10, alpha=1.0, data=None)
----------

a.png is a 7x11px pixel image of a letter 'a' :-)
(Continue reading)

Dave Crossland | 2 Dec 2008 16:52
Gravatar

Re: image() error

2008/12/2 Dave Crossland <dave@...>:
>
> image() doesn't work for me,

This is with http://freehg.org/u/rlafuente/shoebot-ng - but image()
works in the stable 0.1 release. A diff shows that the lines for the
"def image()" (lines 766 - 779 in -ng tree) are unchanged, though. So
I'm not sure where the bug came in.
francesco fantoni | 2 Dec 2008 16:56
Favicon

Re: image() error

I think you're not using code from my tree, that's why image doesn't
work, the change has not gone into the main tree yet.

up to now it's only here:

http://freehg.org/u/hva/shoebot-ng/

but i think ricardo is going to work on revising it and eventually
merging in main tree in the next days

francesco

Il giorno mar, 02/12/2008 alle 15.44 +0000, Dave Crossland ha scritto:
> Hi,
> 
> image() doesn't work for me, giving the following traceback:
> 
> Traceback (most recent call last):
>   File "./shoebot-ide", line 796, in run_script
>     sbot_window = gtkui.ShoebotWindow(codestring,
> self.use_socketserver, 7777, self.use_varwindow)
>   File "/home/crossland/src/shoebot-ng/shoebot/gtkui.py", line 223, in __init__
>     self.canvas = ShoebotDrawingArea(self, self.bot)
>   File "/home/crossland/src/shoebot-ng/shoebot/gtkui.py", line 27, in __init__
>     self.bot.run()
>   File "/home/crossland/src/shoebot-ng/shoebot/__init__.py", line 312, in run
>     exec source_or_code in self.namespace
>   File "shoebot_code", line 25, in <module>
>   File "/home/crossland/src/shoebot-ng/shoebot/__init__.py", line 765, in image
>     self.context.set_source_surface(imagesurface, x, y)
(Continue reading)

francesco fantoni | 2 Dec 2008 17:00
Favicon

Re: image() error

it's because in your version image stuff was not yet ported to the new
structure, that separated the cairo canvas from the bot, so the
"context" attribute (that belongs to cairo) is in Canvas class now, and
though not accessible from the function as it was before.
I don't know if i got it right, maybe ricardo can explain it better.

Il giorno mar, 02/12/2008 alle 15.52 +0000, Dave Crossland ha scritto:
> 2008/12/2 Dave Crossland <dave@...>:
> >
> > image() doesn't work for me,
> 
> 
> This is with http://freehg.org/u/rlafuente/shoebot-ng - but image()
> works in the stable 0.1 release. A diff shows that the lines for the
> "def image()" (lines 766 - 779 in -ng tree) are unchanged, though. So
> I'm not sure where the bug came in.
> _______________________________________________
> Shoebot-devel mailing list
> Shoebot-devel@...
> http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
--

-- 
architetto Francesco Fantoni
<HVA - Hermanitos Verdes Architetti>
l.go san giacomo, 38
I-41100 modena (italia)
tel.& fax. +39.059.217554
skype:  hva_studio
e.mail: francesco@...
web:    http://www.hv-a.com
(Continue reading)

Dave Crossland | 2 Dec 2008 17:04
Gravatar

Re: image() error

2008/12/2 francesco fantoni <francesco@...>:
> I think you're not using code from my tree, that's why image doesn't
> work, the change has not gone into the main tree yet.
>
> up to now it's only here:
>
> http://freehg.org/u/hva/shoebot-ng/
>
> but i think ricardo is going to work on revising it and eventually
> merging in main tree in the next days

Aha okay cool :)
Dave Crossland | 3 Dec 2008 12:11
Gravatar

PNG broken?

Hi,

It seems PNG output is broken? :-( SVG works though. (This is with all
versions :-(

$ sbot script.bot -o output.png
Traceback (most recent call last):
  File "/usr/bin/sbot", line 113, in <module>
    run_oneshot(inputscript, outputfile)
  File "/usr/bin/sbot", line 37, in run_oneshot
    bot.finish()
  File "/usr/lib/python2.5/site-packages/shoebot/__init__.py", line
287, in finish
    self.canvas.finish()
  File "/usr/lib/python2.5/site-packages/shoebot/__init__.py", line
1111, in finish
    self._context.write_to_png("DUMMYOUTPUT.png")
AttributeError: 'cairo.Context' object has no attribute 'write_to_png'

--
Regards,
Dave

Gmane