View Single Post
Old 22nd July 2015, 23:42   #1  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
"Polygon" - polygon drawing, feedback requested

Download: polygon0.1.zip

This is the very raw beginning of a plugin I'm working on for drawing high quality polygons (mainly with a view to being used as masks) in Avisynth, presented at this early stage mainly as a request for feedback.

It makes use of Windows's GDI+ API, so who knows what problems that might cause

Usage:

1. Define a polygon with pg_define:

Code:
poly=pg_define(x1,y1, x2,y2, x3,y3 ...)

# output is a specially formatted RGB32 clip
# floating point values ARE supported
2. Draw the polygon, passing a blankclip (or other RGB32 clip) to set output clip parameters:

Code:
pg_draw(blankclip(100,720,480),poly) # 100 frames, NTSC resolution
Improvements to come:
  • Constructors for specific polygons, e.g. regular, circle/ellipse approximations, etc
  • Support for non-polygon objects, e.g. lines (representing lines with thin polygons doesn't work well in GDI+)
  • Animation/tweening between polygons (not sure how well built-in animate will work with GDI+)
  • Oversampling to overcome deficiencies of GDI+ antialiasing
  • Other drawing modes, if any are especially useful, like overlaying an existing clip (would require colourspace conversions)
  • Output to other colourspaces
  • Translate/rotate/scale existing polygons
  • Smoothing of polygons
  • Built-in blurring

Feedback please!
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 23rd July 2015 at 01:16.
wonkey_monkey is offline   Reply With Quote