Package org.openquark.gems.client.internal.effects

Examples of org.openquark.gems.client.internal.effects.Voronoi


     * @param g2d
     */
    private void paintCrazyPaving(DisplayedGem displayedGem, Graphics2D g2d) {
        // If this Gem is 'broken' draw the 'crazy paving'
        if (displayedGem.getGem().isBroken()) {
            Voronoi cachedCrazyPaving = crazyPavingCache.get(displayedGem);

            if (cachedCrazyPaving == null) {
                // Generate an appropriate crazy paving effect
                cachedCrazyPaving = Voronoi.makeRandomAreaVoronoi(displayedGem.getDisplayedBodyPart().getBounds(), DisplayConstants.CRACK_POINTS_PER_QTR);
                crazyPavingCache.put(displayedGem, cachedCrazyPaving);
            }  
           
            // Clip to triangle region
            Shape oldClip = g2d.getClip();
            g2d.setClip(displayedGem.getBodyShape());
           
            // Draw the crazy paving!
            g2d.setColor(getCrackColour(displayedGem));
            cachedCrazyPaving.show(g2d, true, false);

            // Restore clipping
            g2d.setClip(oldClip);
        }  
    }
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.internal.effects.Voronoi

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.