GDI Color Depth

Discussion in 'ASP .Net' started by RobT, Nov 6, 2008.

  1. RobT

    RobT Guest

    I'll admit, that I don't do a lot of GDI+ programming and I'm sure this is
    an easy answer. I'm trying to draw a couple of shapes in a web site. I can
    display them just fine, but on some of the fill colors are pixelated. Is
    there a way to render these colors at a better color depth?

    Dim bmp As Bitmap
    bmp = New Bitmap(200, 200)
    Dim g As Graphics
    g = Graphics.FromImage(bmp)
    g.Clear(Color.White)
    g.SmoothingMode = SmoothingMode.AntiAlias
    Dim brsh As SolidBrush
    brsh = New SolidBrush(Color.DarkGoldenrod)
    g.FillPie(brsh, 10, 10, 50, 50, 0, 360)

    Thanks
     
    RobT, Nov 6, 2008
    #1
    1. Advertising

  2. RobT wrote:
    > I'll admit, that I don't do a lot of GDI+ programming and I'm sure this is
    > an easy answer. I'm trying to draw a couple of shapes in a web site. I
    > can
    > display them just fine, but on some of the fill colors are pixelated. Is
    > there a way to render these colors at a better color depth?
    >
    > Dim bmp As Bitmap
    > bmp = New Bitmap(200, 200)
    > Dim g As Graphics
    > g = Graphics.FromImage(bmp)
    > g.Clear(Color.White)
    > g.SmoothingMode = SmoothingMode.AntiAlias
    > Dim brsh As SolidBrush
    > brsh = New SolidBrush(Color.DarkGoldenrod)
    > g.FillPie(brsh, 10, 10, 50, 50, 0, 360)
    >
    > Thanks
    >


    The Bitmap object gets the bit depth 24 by default, so the image is all
    right in the code that you posted. The problem is with how you save the
    image data into a file format. If you for example save it in GIF format,
    that only supports a palette of 256 colors.

    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    Göran Andersson, Nov 6, 2008
    #2
    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. **ham

    GDI+ performance issue

    **ham, Dec 12, 2004, in forum: ASP .Net
    Replies:
    10
    Views:
    7,975
    Steve McLellan
    Dec 14, 2004
  2. Martin
    Replies:
    0
    Views:
    1,040
    Martin
    Sep 17, 2004
  3. Duke the Coward
    Replies:
    3
    Views:
    1,504
    Jeffrey Silverman
    Dec 6, 2004
  4. Robin van de Water [synthesiSFactory]

    GDI+ is not properly initialized (internal GDI+ error).

    Robin van de Water [synthesiSFactory], Jan 10, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    1,350
    Robin van de Water [synthesiSFactory]
    Jan 10, 2007
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    429
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page