speeding up drawing in awt applet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • timtt

    speeding up drawing in awt applet

    does anyone guideline to speed up drawing in awt applet??

    i have thousands of g.drawstring() + d.drawline()

    actually, does Swing applet draw much faster than awt applet??


  • Neomorph

    #2
    Re: speeding up drawing in awt applet

    On Sun, 3 Aug 2003 10:55:29 +0800, "timtt" <kltsl@email.ho ngkong.com>
    two-finger typed:
    [color=blue]
    >does anyone guideline to speed up drawing in awt applet??
    >
    >i have thousands of g.drawstring() + d.drawline()[/color]

    Use (Applet.)create Image(width,hei ght) to create a buffer image, then use
    image.getGraphi cs() to get a graphics context, then you can draw in the
    image (in a seperate Thread, for example).
    You can even get the Dimensions of the Applet for the width and height of
    the image.

    In paint() you would only draw the image to the Applet/screen to refresh.

    I made a Mandelbrot Applet that way:

    [color=blue]
    >actually, does Swing applet draw much faster than awt applet??[/color]

    Nope. I would expect slower (due to overhead) since JApplet is based
    (extends) on Applet.
    [color=blue]
    >[/color]

    Cheers.

    Comment

    • Mr. J M Court

      #3
      Re: speeding up drawing in awt applet


      "Neomorph" <neomorph@nospa m.demon.co.uk> wrote in message
      news:3sopivoovp hvc3ntlkfma2bf7 otfiffd3e@4ax.c om...
      On Sun, 3 Aug 2003 10:55:29 +0800, "timtt" <kltsl@email.ho ngkong.com>
      two-finger typed:
      [color=blue]
      >does anyone guideline to speed up drawing in awt applet??
      >
      >i have thousands of g.drawstring() + d.drawline()[/color]

      Use (Applet.)create Image(width,hei ght) to create a buffer image, then use
      image.getGraphi cs() to get a graphics context, then you can draw in the
      image (in a seperate Thread, for example).
      You can even get the Dimensions of the Applet for the width and height of
      the image.

      In paint() you would only draw the image to the Applet/screen to refresh.

      I made a Mandelbrot Applet that way:


      You know when you zoom in a long way on your mandelbrot applet, it begins to
      look a bit grainy, do you think that is due to inaccuracy in your
      implementation of the maths? I am trying to think of a way to modify your
      code to avoid this, possibly by using a fractional representation rather
      then FP. Or have I got his wrong?

      John


      Comment

      Working...