Sha256: 0772a4f0fb4eb2bc09dd0b02bfe2c3eb921b833a37aa21fdf624e1cac2ababdf

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

#ifndef SVG_GRADIENT_H
#define SVG_GRADIENT_H

#include <iostream>
#include <map>
#include <libxml/tree.h>
#include "Geom.h"
#include "SVGColor.h"
#include "SVGAttributeParser.h"
#include "SWFShapeMaker.h"



namespace SWF {

class SVGGradientStop;

class SVGGradient {
	public:
		SVGGradient();
		
		virtual void parse(xmlNodePtr node);
		virtual void writeXML(xmlNodePtr node, Rect &bounds, bool hadModes) = 0;
		
		enum SpreadMethod {
			PAD,
			REFLECT,
			REPEAT
		};

	protected:
		virtual void parseGradient() = 0;
		void parseStops(xmlNodePtr parent);
		void parseStop(xmlNodePtr node);
		void parseTransform();
		void parseSpreadMethod();
		void writeCommonXML(xmlNodePtr node, Matrix& m, bool hasModes);

		std::map<double, SVGGradientStop> stops;
		Matrix transform;
		AttributeParser attribs;
		SpreadMethod spreadMethod;
		
		bool userSpace;
};

class SVGLinearGradient : public SVGGradient {
	public:
		void writeXML(xmlNodePtr node, Rect &bounds, bool hasModes);
	
	protected:
		void parseGradient();
		
		double x1, x2, y1, y2;
};

class SVGRadialGradient : public SVGGradient {
	public:
		void writeXML(xmlNodePtr node, Rect &bounds, bool hasModes);
		
	protected:
		void parseGradient();
				
		double cx, cy, fx, fy, r;
		bool hasFocalPoint;
};

class SVGGradientStop {
	public:
		void setColor(const char *c) { color.parse(c); }
		void setAlpha(unsigned char alpha) { color.setAlpha(alpha); }
		void setAlpha(double alpha) { color.setAlpha(alpha); }
		void writeXML(xmlNodePtr node, double offset);
		
	private:
		SVGColor color;
};

}

#endif

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
swfmill-0.0.6 ext/swfmill/src/swft/SVGGradient.h
swfmill-0.0.5 ext/swfmill/src/swft/SVGGradient.h
swfmill-0.0.4 ext/swfmill/src/swft/SVGGradient.h
swfmill-0.0.3 ext/swfmill/src/swft/SVGGradient.h
swfmill-0.0.2 ext/swfmill/src/swft/SVGGradient.h
swfmill-0.0.1 ext/swfmill/src/swft/SVGGradient.h