Visual Effects for 'o' Images

A quick look at Table 6-1 shows that ImagesTests utilizes a large number of visuals effects. These can be classified into two groups:

  • Animations of image sequences, carried out by ImagesPlayer objects

  • Image-processing operations applied to o images

I've already described the first group, which leaves a total of 11 effects. These are applied to the o images inside paintComponent() of ImagesTests. The relevant code fragment is:

    // ------------------ 'o' images ---------------------
    /* The programmer must manually edit the code here in order to
       draw the 'o' images with different visual effects. */

    // drawImage(g2d, atomic, 10, 25); // only draw the image

    rotatingImage(g2d, atomic, 10, 25);
    mixedImage(g2d, balls, 110, 25);
    teleImage = teleportImage(g2d, bee, teleImage, 210, 25);
    flippingImage(g2d, cheese, 310, 25);
    blurringImage(g2d, eyeChart, 410, 25);
    reddenImage(g2d, house, 540, 25);
    zapImage = zapImage(g2d, pumpkin, zapImage, 710, 25);
    brighteningImage(g2d, scooter, 10, 160);
    fadingImage(g2d, ufo, 110, 140);
    negatingImage(g2d, owl, 450, 250);
    mixedImage(g2d, basn8, 650, 250);
    resizingImage(g2d, basn16, 750, 250);

All the methods have a similar interface, requiring a reference to the graphics context (g2d), the name of the image, and the (x, y) coordinate where the modified image will be drawn.

The operations can be grouped into eight categories, shown in Table 6-2.

Table 6-2. Visual-effect operations by category

Category

Example methods

Description

Get Killer Game Programming in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.