Return to FunctionReference page
Function
SWF!JpegBitmap newSWF!JpegBitmap_fromInput(SWFInput input);
Purpose
Creates a new SWF!JpegBitmap from a SWFInput object.
Parameters
SWFInput input - The SWFInput object you want to read, holding the JPEG data.
Returns
A SWF!JpegBitmap object on success, NULL if an error occurred.
Language
- C
Ming version
- (unknown). At least 0.4.0 and onwards, possibly earlier versions as well.
Notes
None as yet
Example
Note - this is a code fragment from a Gnome/GTK program written in C. Not a great example, but hopefully better than nothing.
1 /* There should be all kinds of other stuff here, including headers, variables, etc */
2
3 // Convert the compressed image into jpeg data
4 return_code_bool = gdk_pixbuf_save_to_buffer(GDK_PIXBUF(resized_pixbuf),
5 &pixbuf_buffer, // Will come back filled out with location of jpeg data
6 &pixbuf_size, // Will come back filled out with size of jpeg data
7 "jpeg",
8 &error,
9 "quality",
10 "100",
11 NULL);
12
13 // Create the dictionary shape from the jpeg data
14 SWFInput image_input = newSWFInput_buffer((guchar *) pixbuf_buffer, pixbuf_size);
15 SWFJpegBitmap image_bitmap = newSWFJpegBitmap_fromInput(image_input);
16
17 // Adjust the dimensions of the movie to match the image file
18 bitmap_height = SWFBitmap_getHeight((SWFBitmap) image_bitmap);
19 bitmap_width = SWFBitmap_getWidth((SWFBitmap) image_bitmap);
20 SWFMovie_setDimension(test_movie, bitmap_width, bitmap_height);
21
22 // Set the frame rate for the movie to 12 frames per second
23 SWFMovie_setRate(test_movie, 12.0);
24
25 // Set the total number of frames in the movie to 120
26 SWFMovie_setNumberOfFrames(test_movie, 120);
27
28 // Add the image file to the movie
29 SWFMovie_add(test_movie, (SWFBlock) image_bitmap);
30
31 // Save the swf movie file to disk
32 SWFMovie_save(test_movie, "ming-test.swf");
33
34 return EXIT_SUCCESS;
35 }