Return to FunctionReference page
Function
void destroySWFBitmap(SWFBitmap bitmap);
Purpose
- Destroys a SWFBitmap, freeing the memory associated with it.
Parameters
SWFBitmap bitmap - Bitmap to be destroyed.
Returns
void - No return value
Language
- C
Ming version
- (unknown). At least 0.4.0 and onwards, possibly earlier versions as well.
Notes
None as yet
Example
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <ming.h>
4
5 int main(void)
6 {
7 // Create local variables
8 int i;
9 SWFDisplayItem image_display_item;
10 SWFInput input_image;
11 SWFJpegBitmap test_image;
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 desired compression level for the output (9 = maximum compression)
20 Ming_setSWFCompression(9);
21
22 // Set the background color for the movie
23 SWFMovie_setBackground(test_movie, 0x00, 0x00, 0x00);
24
25 // Adjust the dimensions of the movie
26 SWFMovie_setDimension(test_movie, 800, 600);
27
28 // Set the frame rate for the movie to 24 frames per second
29 SWFMovie_setRate(test_movie, 24.0);
30
31 // Create a new input channel, pointing to an image file on disk
32 input_image = newSWFInput_filename("image.jpg");
33 if (NULL == input_image)
34 {
35 // We couldn't open the file, so exit
36 return EXIT_FAILURE;
37 }
38
39 // Read from the input channel, turning it into a bitmap image we can use
40 test_image = newSWFJpegBitmap_fromInput(input_image);
41 if (NULL == test_image)
42 {
43 // Something went wrong, so exit
44 return EXIT_FAILURE;
45 }
46
47 // Add the image to the movie (at 0,0)
48 image_display_item = SWFMovie_add(test_movie, (SWFBlock) test_image);
49
50 // Move to 100, 100
51 SWFDisplayItem_moveTo(image_display_item, 100.00, 100.0);
52
53 // Progressively move the square down and to the right
54 for (i = 0; i <= 250; i++)
55 {
56 SWFMovie_nextFrame(test_movie);
57 SWFDisplayItem_move(image_display_item, 2, 2);
58 }
59
60 // Save the swf movie file to disk
61 SWFMovie_save(test_movie, "ming-test.swf");
62
63 // Free the swf movie in memory
64 destroySWFMovie(test_movie);
65
66 // Free the swf JPEG bitmap object
67 destroySWFBitmap((SWFBitmap) test_image);
68
69 // Free the swf input object
70 destroySWFInput(input_image);
71
72 return EXIT_SUCCESS;
73 }