Main Menu


Sponsored Links

  


  
  
Web Cartoon Maker: a Fun Way to Learn C++ Contents Previous Next

Image Objects

You already have learned about text objects. Beside text you can use images in your cartoons. You can add an image object to a scene almost the same way as text one.

void Scene1 ()

{

Image MyImg ( "http://www.webcartoonmaker.com/wcm_icon.png" );

MyImg.SetVisible ( true );


// We do not use SetTime. The lehgth of this cartoon

// will be set to one second automatically instead of zero

}

MyImg is and unique name for the image object. And we will use it to make it visible or invisible, move it, rotate and do other cool stuff. You can see that it also requires a parameter. But instead of a string of text to display, you should supply a valid URL of image. If URL is not valid, then no error will be reported but no image will be displayed either. Web Cartoon Maker supports images in SVG, EMF, PNG, JPG and GIF formats.

Note: If you haven’t read the tutorial and scripting help files about images, this would be a good time to read them, as well as to run the “Image objects in Web Cartoon Maker” tutorial script. A brief discussion of vector (SVG, EMF) vs. raster (PNG, JPG, GIF) formats will be presented in a later section. There are also many good discussions of this subject on the web.

You can also use images from your hard drive. In this case you must indicate a full local path to an image file instead of URL. And remember, in C++ you need to use double slashes ( "\\" ) instead of single ones ( "\" ), because single slashes are reserved for defining special symbols like "\n" or "\t" :

void Scene1 ()

{

Image LocalImg ( "c:\\myimage.png" );

LocalImg.SetVisible ( true );

}

Again, this must be a valid full local path to an image. And an image must exist on your hard drive. Most likely there is no image at located at "c:\\myimage.png " on your hard drive. Please replace this string with a valid path to an image in SVG, EMF, PNG, JPG or GIF format if you want to compile this example.

Web Cartoon Maker has its own online library of images optimized for cartoons. You can browse the library in your web browser (Internet Explorer 7.0 or later is recommended) at http://www.webcartoonmaker.com/?art=help/lib_images :

You can see that all the pictures have a shorter path assigned to them like "sport/beach_ball.svg" . You can use this short path instead of fully qualified URL if you want to use an image from online Web Cartoon Maker's library. For example if you want to display a ball you could write:

void Scene1 ()

{

Image LibImg ( "sport/beach_ball.svg" );

LocalImg.SetVisible ( true );

}


Contents Previous Next
  
News

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi

...

Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat

...

Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.

...

Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal

...

read more news...


Poll