Return to FunctionReference page
Function
int SWFBitmap_getHeight(SWFBitmap b);
Purpose
- Returns an int with the height of the given SWFBitmap.
Parameters
SWFBitmap b - The bitmap you want to get the height of
Returns
- An integer with the height of the bitmap.
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 FILE *file_pointer = NULL;
9 int bitmap_height, bitmap_width;
10 SWFJpegBitmap image_file;
11 SWFMovie test_movie;
12
13
14 // Initialise the movie structure in memory
15 Ming_init();
16 test_movie = newSWFMovieWithVersion(7);
17
18 // Set the background color for the movie
19 SWFMovie_setBackground(test_movie, 0x00, 0x00, 0x00);
20
21 // Load an image file, ready for adding to the movie
22 file_pointer = fopen("image.jpg", "rb");
23 if (file_pointer == NULL)
24 {
25 fprintf(stderr, "Image file could not be opened\n");
26 return EXIT_FAILURE;
27 }
28 image_file = newSWFJpegBitmap(file_pointer);
29
30 // Adjust the dimensions of the movie to match the image file
31 bitmap_height = SWFBitmap_getHeight((SWFBitmap) image_file);
32 bitmap_width = SWFBitmap_getWidth((SWFBitmap) image_file);
33 SWFMovie_setDimension(test_movie, bitmap_width, bitmap_height);
34
35 // Set the frame rate for the movie to 12 frames per second
36 SWFMovie_setRate(test_movie, 12.0);
37
38 // Set the total number of frames in the movie to 120
39 SWFMovie_setNumberOfFrames(test_movie, 120);
40
41 // Add the image file to the movie
42 SWFMovie_add(test_movie, (SWFBlock) image_file);
43
44 // Save the swf movie file to disk
45 SWFMovie_save(test_movie, "ming-test.swf");
46
47 return EXIT_SUCCESS;
48 }