deep inside java

Discussion in 'Java' started by Margus, Apr 28, 2004.

  1. Margus

    Margus Guest

    Hi
    At moment i'm searching solution for scaling chart picture in java without
    loss. The speed in scrolling with lightweights seems ok. But problem is with
    drawimage() the chart line gets fragmented if scaling with this function. I
    use the direct 8 parameter version of drawimage. Any techniques or solution
    to get over it.

    If anybody has some reading or material about drawing and awt components in
    lowlevel java and he can share it - it would be very big help.

    Best Regards
    Margus
    Margus, Apr 28, 2004
    #1
    1. Advertising

  2. Margus

    Liz Guest

    "Margus" <> wrote in message news:408f7e92$...
    > Hi
    > At moment i'm searching solution for scaling chart picture in java without
    > loss.


    what you mean, without loss?

    > The speed in scrolling with lightweights seems ok. But problem is with
    > drawimage() the chart line gets fragmented if scaling with this function.

    I
    > use the direct 8 parameter version of drawimage. Any techniques or

    solution
    > to get over it.
    >
    > If anybody has some reading or material about drawing and awt components

    in
    > lowlevel java and he can share it - it would be very big help.
    >
    > Best Regards
    > Margus
    >
    >
    Liz, Apr 28, 2004
    #2
    1. Advertising

  3. Margus

    Roedy Green Guest

    On Wed, 28 Apr 2004 12:51:13 +0300, "Margus" <> wrote or
    quoted :

    >At moment i'm searching solution for scaling chart picture in java without
    >loss. The speed in scrolling with lightweights seems ok. But problem is with
    >drawimage() the chart line gets fragmented if scaling with this function. I
    >use the direct 8 parameter version of drawimage. Any techniques or solution
    >to get over it.


    Check out http://mindprod.com/jgloss/java2d.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Apr 29, 2004
    #3
  4. Margus

    Margus Guest

    Hi again

    Well when this function resizes chart(making it smaller) . Some part of the
    chart line will not be visible anymore this is because the function
    automatically calculates the picture and scales it and the 1 pixel width
    line will not be visible anymore. Any ways to get around from this.

    I hope i explained it now more. Loss is really not very accurate :)

    Margus

    "Liz" <> wrote in message
    news:p6Tjc.6895$RE1.785238@attbi_s54...
    >
    > "Margus" <> wrote in message

    news:408f7e92$...
    > > Hi
    > > At moment i'm searching solution for scaling chart picture in java

    without
    > > loss.

    >
    > what you mean, without loss?
    >
    > > The speed in scrolling with lightweights seems ok. But problem is with
    > > drawimage() the chart line gets fragmented if scaling with this

    function.
    > I
    > > use the direct 8 parameter version of drawimage. Any techniques or

    > solution
    > > to get over it.
    > >
    > > If anybody has some reading or material about drawing and awt components

    > in
    > > lowlevel java and he can share it - it would be very big help.
    > >
    > > Best Regards
    > > Margus
    > >
    > >

    >
    >
    Margus, Apr 29, 2004
    #4
  5. Margus

    Guest

    "Margus" <> wrote in message news:<40909ed3$>...

    > automatically calculates the picture and scales it and the 1 pixel width
    > line will not be visible anymore. Any ways to get around from this.


    Not sure if this is what you mean: scaling a bitmap seems to drop
    pixels completely.

    This is what the default 'nearest neighbor' scaling algorithm does.
    It's the fastest and simplest way of scaling a bitmap. It drops one
    or more every one or more pixels.
    Java has at least 2 other scaling algorithms as well: linear, and
    bicubic.
    In linear, what it does is for each pixel in the resulting bitmap, it
    checks to see how much of the 4 pixels in the source it should sample
    from. Not perfect, but a lot better than nearest neighbor, and still
    pretty fast.
    Bicubic is way better, but a little slower, although Java's
    implementation has been optimized pretty darn well. What it does for
    each pixel, which area of pixels from the source should influence the
    outcome pixel. This means that if you scale a bitmap down a lot, for
    each pixel in the resulting bitmap, it needs to scan a larger number
    of pixels in the source bitmap, and calculate by weighted average each
    resulting pixel.

    What you should look at is in the paint(Graphics g), cast the g into a
    Graphics2D, and call setRenderingHints on it.
    You'll want to at least enable antialiasing, but probably also a few
    other ones.
    The quality goes way up for all sorts of things. Fonts, etc, it'll
    all look a 1.
    , May 8, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    439
    Mike Treseler
    Mar 8, 2006
  2. Jason

    IIS 2 level deep

    Jason, Dec 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    346
    Franck Quintana
    Dec 1, 2004
  3. Umut Tezduyar

    Build N-deep web sites with this control

    Umut Tezduyar, Jan 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    395
    Umut Tezduyar
    Jan 6, 2005
  4. John Dalberg
    Replies:
    1
    Views:
    9,944
    Juan T. Llibre
    Apr 15, 2005
  5. One Cent
    Replies:
    7
    Views:
    5,167
    ravik
    Sep 10, 2012
Loading...

Share This Page