René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Gradient [Ming wrapper example] | ||
This example demonstrates the use of Gradients.
This flash movie was created with the following program. GradientExample.cpp
#include "SWFMovie.h" void DrawRect(Shape& shape, int x, int y, int len) { shape.MoveTo(x, y); shape.Line( len, 0); shape.Line( 0, len); shape.Line( -len, 0); shape.Line( 0,-len); } int main() { Movie movie ("GradientExample.swf", 600, 400); Gradient gradient; Shape shape; gradient.Add(0.0, 0, 0,255); gradient.Add(1.0, 255, 0, 0); GradientFill fill = shape.GetRadial(gradient); fill.RotateTo(45); fill.ScaleXTo(0.5); fill.ScaleYTo(0.5); fill.MoveTo (300, 200); shape.Fill(fill); shape.LineStyle(10, 0, 0, 0); DrawRect(shape, 100, 100,150); DrawRect(shape, 20, 330, 50); DrawRect(shape, 500, 100, 60); DrawRect(shape, 420, 240, 80); DrawRect(shape, 320, 180, 60); DrawRect(shape, 390, 40, 90); DrawRect(shape, 330, 300, 70); DrawRect(shape, 220, 280, 50); DrawRect(shape, 10, 30, 40); DrawRect(shape, 540, 340, 40); movie.Add(shape); movie.NextFrame(); return 0; } This is one of a series of examples that demonstrates the C++ ming wrapper classes. Other examples can be found here.
|