Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > anti-aliased 2D vector graphics

Reply
Thread Tools

anti-aliased 2D vector graphics

 
 
Andy C
Guest
Posts: n/a
 
      08-01-2003
Where can I get a python package to draw such figures? I googled and found
PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
converter or something. Is there any other alternative?

I have looked at PIL, but it doesn't seem to support drawing anti-aliased
figures. Thanks for any suggestions.

Andy


 
Reply With Quote
 
 
 
 
Andy C
Guest
Posts: n/a
 
      08-01-2003
Note that I'm on Windows... if there is some windows-specific solution, that
would be fine. I know there is a python win32 interface, and I think GDI
supports anti-aliased vector graphics, but I'm not sure. And fonts -- I
need to draw text too. Anyone tried that approach?

thanks,
Andy

"Andy C" <(E-Mail Removed)> wrote in message
news:J3pWa.420$(E-Mail Removed) .com...
> Where can I get a python package to draw such figures? I googled and

found
> PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
> converter or something. Is there any other alternative?
>
> I have looked at PIL, but it doesn't seem to support drawing anti-aliased
> figures. Thanks for any suggestions.
>
> Andy
>
>



 
Reply With Quote
 
 
 
 
Udo Gleich
Guest
Posts: n/a
 
      08-01-2003
Hi,

pygame (www.pygame.org) can at least draw antialiased
lines. Look for the draw module in the documentation.

Udo
 
Reply With Quote
 
Christos TZOTZIOY Georgiou
Guest
Posts: n/a
 
      08-01-2003
On Fri, 01 Aug 2003 07:57:29 GMT, rumours say that "Andy C"
<(E-Mail Removed)> might have written:

>Where can I get a python package to draw such figures? I googled and found
>PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
>converter or something. Is there any other alternative?
>
>I have looked at PIL, but it doesn't seem to support drawing anti-aliased
>figures. Thanks for any suggestions.


Use PIL, and draw on an image twice the size (2*width, 2*height) as the
one you want. When you're done, resize the image --BILINEAR works fine
in this case.

You will need to draw thicker lines & arcs (I don't remember ATM if you
can use a <width> parameter with drawing methods)... create a custom
class to manage drawing double lines and arcs / circles when needed.
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
 
Reply With Quote
 
Robin Becker
Guest
Posts: n/a
 
      08-01-2003
In article <PipWa.422$(E-Mail Removed) >, Andy C
<(E-Mail Removed)> writes
>Note that I'm on Windows... if there is some windows-specific solution, that
>would be fine. I know there is a python win32 interface, and I think GDI
>supports anti-aliased vector graphics, but I'm not sure. And fonts -- I
>need to draw text too. Anyone tried that approach?
>
>thanks,
>Andy
>

ReportLab graphics does anti aliased bitmap drawing via libart_lgpl, but
I know it's not easy to get into.
--
Robin Becker
 
Reply With Quote
 
Erik Max Francis
Guest
Posts: n/a
 
      08-01-2003
Andy C wrote:

> Where can I get a python package to draw such figures? I googled and
> found
> PyX, I guess it outputs PostScript. I guess I can get a PostScript to
> BMP
> converter or something. Is there any other alternative?


One obvious solution would be to use GhostView to use PostScript to
generate an image, and then sample it down with a good resampling
library, like PNM.

--
Erik Max Francis && http://www.velocityreviews.com/forums/(E-Mail Removed) && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ As far as I'm concerned, being any gender is a drag.
\__/ Patti Smith
 
Reply With Quote
 
Terry Hancock
Guest
Posts: n/a
 
      08-02-2003
<posted & mailed>

Andy C wrote:

> Where can I get a python package to draw such figures? I googled and
> found
> PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
> converter or something. Is there any other alternative?
>
> I have looked at PIL, but it doesn't seem to support drawing anti-aliased
> figures. Thanks for any suggestions.


In addition to the other suggestions made, you might want to consider
Sketch. It's normally billed as an application, but it's also a pretty
powerful drawing library for python. I'm uncertain about installation
issues, it may be a little harder to build on Windows than on Linux, (but
I suspect this is less of a problem if you just want to use it as a
library). But it certainly can do everything that you've mentioned.

I'm pretty sure that Sketch has anti-aliased rendering, but you should also
be aware that you can get pretty good results simply by oversampling -- I
usually draw at 4X the intended scale and then scale down by 1/4 to get the
final result. This is somewhat coarse, but it works pretty well visually.

See http://sketch.sourceforge.net/ and links therein.

Cheers,
Terry

--
Terry Hancock
Anansi Spaceworks http://www.AnansiSpaceworks.com/

 
Reply With Quote
 
Dave Brown
Guest
Posts: n/a
 
      08-03-2003
In article <J3pWa.420$(E-Mail Removed) >,
Andy C <(E-Mail Removed)> wrote:
: Where can I get a python package to draw such figures? I googled and found
: PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
: converter or something. Is there any other alternative?

Sounds like a job for...SVG!

Here, have a look at this: http://www2.sfk.nl/svg

--Dave
--
"I had my first real beer (real meaning not sneaking it, or
the .5 crap), and amazingly enough, I wasn't immediately
surrounded by girls in bikinis. Go figure...."
-- Rob Hoadley
 
Reply With Quote
 
Christos TZOTZIOY Georgiou
Guest
Posts: n/a
 
      08-04-2003
On Sat, 02 Aug 2003 01:43:50 GMT, rumours say that "Andy C"
<(E-Mail Removed)> might have written:

[SNIP: My suggesting double size images and then resizing]

>Thanks for the suggestion, I think this will work fine for what I'm doing.
>A little off topic, but is this how it is typically done? Is there a
>special case for lines vs. fonts?


Font size should be doubled.
For lines, you *need* from 2 to 3 lines, but that involves some
math.atan2 style pre-calculations... (you can follow the easy way and
draw four lines as in the next paragraph.
For boxes, lines etc you better draw each 4 times
(x+0, y+0), (x+0, y+1), (x+1, y+0), (x+1, y+1)
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
 
Reply With Quote
 
Christos TZOTZIOY Georgiou
Guest
Posts: n/a
 
      08-04-2003
On Sat, 02 Aug 2003 01:43:50 GMT, rumours say that "Andy C"
<(E-Mail Removed)> might have written:

>A little off topic, but is this how it is typically done? Is there a
>special case for lines vs. fonts?


Ah, *that* was your question (I was hasty in answering a few minutes
earlier).
I believe that yes, this is what is typically done for line art; but my
answer is not authoritative.
For fonts, I do not know for certain, although I know for certain that
this is what *I* have done in a simple "ClearType"-like-display text
reader I have written for reading texts in my Win2K notebook (I won't
bother installing XP *only* for the ClearType capability).
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Initializing vector<vector<int> > and other vector questions... pmatos C++ 6 04-26-2007 05:39 PM
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
Intel Graphics Media Accelerator 900 Graphics Harvey Gratt Computer Support 3 10-09-2005 02:40 AM
how the vector is created, how to pass vector to webservices method apachesoap:Vector Rushikesh Joshi Perl Misc 0 07-10-2004 01:04 PM



Advertisments