BufferedShapeLayer

From: Chinh Tang <ctang@teloptica.com>
Date: Thu Aug 02 2001 - 16:12:58 EDT

Hey all,

I found that BufferedShapeLayer repaints much faster if I create a copy of
the Graphics object, paint on this buffer, then paint it back on the
original Graphics object.
Modified paint() is below. Is there a reason why this was not done before?

-Chinh

    /**
     * Renders the layer on the map.
     *
     * @param g a graphics context
     */
    public void paint (Graphics g) {
   // grab local for thread safety
   OMGraphicList omg = omgraphics;

   Graphics g2 = g.create();

   if (omg != null){
       if (Debug.debugging("shape"))
      Debug.output("ShapeLayer.paint(): " + omg.size() +
              " omg" + " shadow=" + shadowX + "," + shadowY);

       if (shadowX != 0 || shadowY != 0){
      Graphics shadowG = g2.create();
      shadowG.translate(shadowX, shadowY);
      omg.render(shadowG);
       } else {
      omg.render(g2);
       }
       if (Debug.debugging("shape")){
      Debug.output("ShapeLayer.paint(): done");
       }
   }
    ((Graphics2D)g).draw(g2.getClip());
    g2.dispose();
    g.dispose();
    }

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Aug 2 16:15:39 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT