Return to FunctionReference page

Function

  • void SWFShape_move!PenTo(SWFShape shape, float x, float y);

Purpose

  • Moves the pen to the given x, y position (without drawing), relative to the shape origin.

Parameters

  1. SWFShape shape - The SWF shape the pen will be moved for

  2. float x - The x position the pen will be moved to (NOT a delta)

  3. float y - The y position the pen will be moved to (NOT a delta)

Returns

  • void - No return value

Language

  • C

Ming version

  • (unknown). At least 0.4.0 and onwards, possibly earlier versions as well.

Notes

  • The x and y co-ordinates used are relative to the shape origin.

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         SWFShape square_definition;
  10         SWFDisplayItem square_display_item;
  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         // Set the frame rate for the movie to 12 frames per second
  22         SWFMovie_setRate(test_movie, 12.0);
  23 
  24         // Set the total number of frames in the movie to 120
  25         SWFMovie_setNumberOfFrames(test_movie, 2);
  26 
  27         // Create a new fill style (semi-transparent)
  28         fill_style = newSWFSolidFillStyle(0xa5, 0xa5, 0xff, 0x80);
  29         
  30         // Create an empty shape object
  31         square_definition = newSWFShape();
  32 
  33         // Move the pen vertically down a bit without drawing
  34         SWFShape_movePenTo(square_definition, 0, 50.0);
  35 
  36         // Draw a square from the new pen position
  37         SWFShape_setRightFillStyle(square_definition, fill_style);
  38         SWFShape_drawLine(square_definition, 100.0, 0.0);
  39         SWFShape_drawLine(square_definition, 0.0, 100.0);
  40         SWFShape_drawLine(square_definition, -100.0, 0.0);
  41         SWFShape_drawLine(square_definition, 0.0, -100.0);
  42 
  43         // Add the square to the movie (at 0,0)
  44         square_display_item = SWFMovie_add(test_movie, (SWFBlock) square_definition);
  45 
  46         // Move to 100, 100
  47         SWFDisplayItem_moveTo(square_display_item, 100.00, 100.0);
  48 
  49         // Set the desired compression level for the output (9 = maximum compression)
  50         Ming_setSWFCompression(9);
  51 
  52         // Save the swf movie file to disk
  53         SWFMovie_save(test_movie, "ming-test.swf");
  54 
  55         return EXIT_SUCCESS;
  56 }