Results 1 to 7 of 7

Thread: Paint [Resolved (FLOODFILL!)]

  1. #1

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Paint [Resolved (FLOODFILL!)]

    Let's say I got a black circle drawned on a bitmap object, in the middle of a white background...

    How do I paint the black circle to red...

    Don't tell me to paint another circle over it... , I'm looking for a way to paint a single color from a specifyed point to another color...

    I don't really feel like going through each pixel... it's my last resort, but my guess is that there is something out there way easier... right?

    I've tried...

    VB Code:
    1. 'Dim p As New Region(New Rectangle(x, y, x + 1, y + 1))
    2.                     'Dim newFillMode As System.Drawing.Drawing2D.FillMode = System.Drawing.Drawing2D.FillMode.Alternate
    3.                     'Buffer.FillRegion(MyPen.Brush, p)
    4.  
    5.                     Dim Point1 As New PointF(x, y)
    6.                     Dim Point2 As New PointF(x + 1, y)
    7.                     Dim Point3 As New PointF(x, y + 1)
    8.                     Dim Point4 As New PointF(x + 1, y + 1)
    9.                     Dim pF As PointF() = {Point1, Point2, Point3, Point4}
    10.  
    11.                     'Buffer.FillPolygon(MyPen.Brush, pF, Drawing2D.FillMode.Winding)
    12.  
    13.                     Dim i As New System.Drawing.Drawing2D.GraphicsPath(pF, Nothing)
    14.                     Buffer.FillPath(MyPen.Brush, i)

    Plenty of crap that always returned the same kind of result:

    I got a square and it just does the same as clearing the section to another color...


    HEEEEKO


    Last edited by Ruku; Dec 26th, 2005 at 10:26 PM.

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Paint

    You use a Brush object in order to fill in shapes...

    Here's a link to sample code in filling in shapes..
    http://www.vbdotnetheaven.com/Code/Aug2003/2152.asp

  3. #3

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Paint

    yeah, I know that... ok, look at attachement for a better idea of what I want...

    so basically, to fill a color with another... stopping at another color's touch...
    Attached Images Attached Images  

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  4. #4

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Paint

    *bump?*

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  5. #5
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Paint [Unresolved]

    So you basically want a floodfill routine then?

    Google "FloodFill Algorithm"
    I don't live here any more.

  6. #6
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Paint

    Quote Originally Posted by gigemboy
    You use a Brush object in order to fill in shapes...

    Here's a link to sample code in filling in shapes..
    http://www.vbdotnetheaven.com/Code/Aug2003/2152.asp

    Hi gigemboy,

    Great link thanks!

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  7. #7

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Paint [Unresolved]

    Quote Originally Posted by wossname
    So you basically want a floodfill routine then?

    Google "FloodFill Algorithm"
    hehe, alright, so I really don't have any choice but to go through each pixel then... , I'll like it up

    thx for keywords!


    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width