| Growing image created with Victor resizeex function. |
To display the animation place the Java applets and image together in the same directory and insert the applet-calling code below into your .html document.
// Use src image to make a film strip of growing image. Desimg is empty imgdes to be allocated here. int makegrowfilmstrip(int frames, imgdes *srcimg, imgdes *desimg) { int rcode = NO_ERROR; int cols, rows; int j; int wd, ht; cols = CALC_WIDTH(srcimg); rows = CALC_HEIGHT(srcimg); wd = cols/frames/2; ht = rows/frames/2; rcode = allocimage(desimg, cols * frames, rows, srcimg->bmh->biBitCount); zeroimage(255, desimg);// Create a white background if(rcode == NO_ERROR) { for(j = 0; j < frames; j++) { // Set destination region to resize into before each call to resizeex setimagearea(desimg, cols * (frames-j-1) + wd*j, ht*j, cols * (frames-j-1) + cols-wd*j-1, rows-ht*j-1); resizeex(srcimg, desimg, 1 /*RESAMPLEBILINEAR*/); } // Restore image area to entire image before saving setimagearea(desimg, 0, 0, desimg->bmh->biWidth-1, desimg->bmh->biHeight-1); // Save as sequential optimized JPEG at quality = 75 rcode = savejpgex("growing.jpg", desimg, 75, 2); } return (rcode); }
Insert these lines into your .html document.
<applet code="JavaLogo.class" width="278" height="63"> <param name="link" value="http://www.catenary.com"> <param name="image" value="growing.jpg"> <param name="bgcolor" value="ffffff"> <param name="delay" value="100"> <param name="number" value="8"> </applet>
Download the required Java applets (3 kb). For more information about the Java applets visit http://java.sun.com/openstudio/applets/logo.html
Victor Image Processing Library homepage |
Victor Sample Code