View Single Post
Old 18th October 2002, 08:14   #2
Posts: n/a
AndrewMackowski, they're nowhere that I've found either, but through some experimenting with DMove and my own stuff, here's what I've found so far. I'm far from an authority on the subject, but this should be enough to get you going. If anyone has any more information about some of these functions I'd be interested too.

not exactly sure about this one

bilinear filtering - smooths stuff out, I think, but doesn't seem to have much (any?) effect

not exactly sure about this one - has to do with whether the layer gets drawn in every frame and then the layer fx is applied or if layer fx are applied to the contents of the previous frame - but not exactly...

not exactly sure about this one

0 - only seems to update when mouse is over and moving (perhaps when there is any kind of movement over the layerFX? e.g. an animatedLayer)
1 - updates every x milliseconds (set by fx_setSpeed)

milliseconds per frame -- higher number => fewer frames per second

0 - uses the image on the layer normaly
1 - tiles the image on the layer

0 - use fx_onGetPixelR and x_onGetPixelD
1 - use fx_onGetPixelX and x_onGetPixelY

0 - don't use fx_onGetPixelA
1 - continually call fx_onGetPixelA (like other fx_onGetPixel calls)
2 - call fx_onGetPixelA once at the start of the script and use that value throughout

number of squares to divide layer into.
i.e. 4x4 == 16 squares
fewer squares => better performance
more squares => more precise rendering (but CPU hog)

Which brings us to the fx_onGetPixel... stuff. These are kind of difficult to explain, but here goes. In general, these are called every time the layerFX is updated at every square defined by fx_setGridSize. If setRect is set, then fx_onGetPixelX and fx_onGetPixelY are called. If not, then fx_onGetPixelR and fx_onGetPixelD are called. fx_onGetPixelA is called depending on how fx_setAlphaMode is set.

For all these functions:
Polar Coordinates - a point is determined by it's distance (radius) and angle from the origin:
r - angle in radians
d - disance from origin

Rectangular Coordinates - standard x and y coordinate system (cartesian plane)
x - x coordinate
y - y coordinate

a - Alpha value - opacity

As near as I can figure out, the origin is always in the center of the layerFX.

For each function, Winamp passes you 'starting' coordinates in both polar and rectangular form. Your job is to determine a 'new' value for one these coordinates (or alpha value) depending on the function. For example, with fx_onGetPixelR, you should return a 'new' r value. So, what do these new values do? All they do is translate what was at the 'starting' coordinate to the 'new' coordinate. But because winamp is special, for no extra work for you, the chunck that you just moved will also be squished (highly technical term) morphed, scaled, and whatnot in order to seamlessly blend the other chuncks that you'll be moving about.

fx_onGetPixelR(double r, double d, double x, double y)
//Return the new angle here
//(remember, in radians: radians = degrees * pi / 180 )

fx_onGetPixelD(double r, double d, double x, double y)
//Return the new distance from origin here

fx_onGetPixelX(double r, double d, double x, double y)
//Return the new x coordinate here

fx_onGetPixelY(double r, double d, double x, double y)
//Return the new y coordinate here

fx_onGetPixelA(double r, double d, double x, double y)
//Return the alpha value here

For some examples, I suggest looking at DMove (is this still available?) and rotationlayer.m. If I can be of further assistance, just let me know. Good luck!

  Reply With Quote