Made to Order Software Corporation Logo

SWF Gradient (swf_gradient)

SWF Structure Info
Tag Flash Version: 
SWF Structure: 
struct swf_gradient {
	if(tag == DefineShape4) {
		unsigned		f_spread_mode : 2;
		unsigned		f_interpolation_mode : 2;
		unsigned		f_count : 4;
	else {
		unsigned		f_pad : 4;
		unsigned		f_count : 4;
	swf_gradient_record	f_gradient_record[f_count];
	/* f_type is defined in the swf_fill_style encompassing this gradient */
	if(f_type == 0x13) {
		signed short fixed	f_focal_point;

This structure defines a gradient. This is a set of colors which are used to define an image with colors smoothly varying from one color to the next. The gradient can be radial (circular) or linear (rectangular).

The f_count field is limited depending on the tag used and the version of SWF as defined below:

Range Tag Version
1 to 8 DefineShape 3
1 to 8 DefineShape2 3
1 to 8 DefineShape3 3
1 to 15 DefineShape4 8
1 to 8 DefineShapeMorph 3
1 to 8(1) DefineShapeMorph2 8
(1)  To be determined. The Macromedia documentation says it is limited to 8, the player needs to be tested to verify that DefineShapeMorph2 cannot support 15 gradients

The f_spread_mode is an enumeration and appeared in version 8 (undefined values are reserved.)

Value Comment Version
0 Pad 8
1 Reflect 8
2 Repeat 8

The f_interpolation_mode is an enumeration and appeared in version 8 (undefined values are reserved.)

Value Comment Version
0 Normal RGB mode 8
1 Linear RGB mode 8

The f_focal_point is a position from the left edge of the gradient square to the center and then to the right edge of the gradient. The left edge is at position -1.0, the center at 0.0 and the right edge at +1.0. This is particularly useful for radial gradients.


Post new comment

The content of this field is kept private and will not be shown publicly.
This question is for testing whether you are a human visitor and to prevent automated spam submissions.