Return to FunctionReference page
Function
void SWFShape_setLine(SWFShape shape, unsigned short width, byte r, byte g, byte b, byte a);
Purpose
- Sets the line color used for a given SWF Shape.
Parameters
SWFShape shape - The SWF shape this line style will be applied to
unsigned short width - The width of the line. Defaults to pixels, but this can be adjusted by calling Ming_setScale() first.
byte r - Red value of line color. (0-255)
byte g - Green value of line color. (0-255)
byte b - Blue value of line color. (0-255)
byte a - Transparency value for line. (0-255. 0 being completely transparent, 255 being completely opaque)
Returns
void - No return value
Language
- C
Ming version
- (unknown). At least 0.3.0 and onwards, possibly earlier versions as well.
Notes
- Use this functions for swf versions up to 7. Use SWFShape_setLine2() for swf version 8.
The width of the line defaults to pixels, but this can be adjusted by calling Ming_setScale() first.
Example
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <ming.h>
4
5 int main(void)
6 {
7 // Create local variables
8 SWFFillStyle fill_style;
9 int i;
10 SWFShape square_definition;
11 SWFDisplayItem square_display_item;
12 SWFMovie test_movie;
13
14
15 // Initialise the movie structure in memory
16 Ming_init();
17 test_movie = newSWFMovieWithVersion(7);
18
19 // Set the background color for the movie
20 SWFMovie_setBackground(test_movie, 0x00, 0x00, 0x00);
21
22 // Adjust the dimensions of the movie
23 SWFMovie_setDimension(test_movie, 800, 600);
24
25 // Set the frame rate for the movie to 24 frames per second
26 SWFMovie_setRate(test_movie, 24.0);
27
28 // Create a new fill style (semi-transparent)
29 fill_style = newSWFSolidFillStyle(0xa5, 0xa5, 0xff, 0x80);
30
31 // Create a square
32 square_definition = newSWFShape();
33 SWFShape_setRightFillStyle(square_definition, fill_style);
34 SWFShape_setLine(square_definition, 2, 0xc0, 0x00, 0xc0, 0x80);
35 SWFShape_drawLine(square_definition, 200.0, 0.0);
36 SWFShape_drawLine(square_definition, 0.0, 200.0);
37 SWFShape_drawLine(square_definition, -200.0, 0.0);
38 SWFShape_drawLine(square_definition, 0.0, -200.0);
39
40 // Add the square to the movie (at 0,0)
41 square_display_item = SWFMovie_add(test_movie, (SWFBlock) square_definition);
42
43 // Move to 100, 100
44 SWFDisplayItem_moveTo(square_display_item, 100.00, 100.0);
45
46 // Progressively move the square down and to the right
47 for (i = 0; i <= 250; i++)
48 {
49 SWFMovie_nextFrame(test_movie);
50 SWFDisplayItem_move(square_display_item, 2, 2);
51 }
52
53 // Set the desired compression level for the output (9 = maximum compression)
54 Ming_setSWFCompression(9);
55
56 // Save the swf movie file to disk
57 SWFMovie_save(test_movie, "ming-test.swf");
58
59 return EXIT_SUCCESS;
60 }