Filling A Bitmap With A Color?

Nov 4, 2010

Ok basically I want to select a point on a bitmap and then fill all of the color that is the same as the color at that point touching that color with a different color. If that sounds confusing, just think of the paint bucket tool in mspaint or photoshop. Currently I do this by starting with the point selected and then check all the points around it in an ever expanding box until at last no new contiguous points of the color to replace are found.The bad news: This is slow as heck =(I remember my windows 98 computer could handle this just fine with no noticeable delay. So I'm either missing something algorithmically (is there a better approach) or VB.net is just too slow to accomplish this without some sort of different approach/optimization.

[Code]...

As you can see, right now I just select the middle point as where I want to start filling from, and I fill with the color aquamarine. later I want to make this more flexible, but right now I just need this to be faster.

My general algorithm works like this:Start with a 3x3 pixel box with the first pixel (already changed to your new color, with the old color stored) as your start point.Check if each pixel is the color you stored (the one you're replacing) If it is, check if it's next to the new color you're replacing the old color with. If it is, replace it and increase the size of the box.The process ends when no new pixels are replaced.

View 7 Replies


ADVERTISEMENT

VS 2008 Filling Array With Pixel Data And Turning It Into A Bitmap?

Jul 22, 2009

I have a small 10px by 10px image, and I want to use VB.NET to find out if that image is (an exact) part of a larger image.I thought a method of doing this would be to lock the bits of the larger image into memory and then loop through each pixel in the image and for each pixel, I could take the 10px by 10px section which is down and to the right of that pixel.. and then compare it to my smaller image.

This is the code I have so far:

'Lockbits of larger image to memory
Dim bmp As New Bitmap(Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory() & "picture.bmp"))
Dim pxF As PixelFormat = PixelFormat.Format24bppRgb

[code]....

when I'm looping through the 10 by 10 section and I find the R G B bytes for each pixel, how do I store this in my rawImage array so I can convert it to a back bitmap and compare it with my original small 10by10 image?

View 12 Replies

Filling In Gaps With Another Color Within Dashed Line?

Aug 23, 2010

How to find the correct DashOffset and DashPattern to fill in the gaps with another color within a dashed line if the 1st DashPattern has an array of mixed values?
If the 1st array for a DashPattern is like this though?
myPen.DashPattern = New Single() {20, 15, 30, 45}

View 6 Replies

Set The Background Color For A Bitmap?

Mar 2, 2006

How do I set the background color for a bitmap that I create from a graphics object?

Basically I create graphichs object from a bitmap object and draw on the graphics object. T hebackgroung color is black, the drawing color follow the pens used. How do is set the background Color?

View 3 Replies

16 Color Bitmap Image And Interpert?

Apr 2, 2010

I need to read a bitmap generated with paint or similar programs and interpert the picture to detect straight lines of black, larger squares in red and smaller squares of yellow, green or red. Which one of the Visual Basic environments are is best suited for this? WPF or Forms or..The lines represent walls and for start we have square objects as obsticles. I would like to create a maze and allow a dot to travel between obstacles leaving a trace of pixels and not hit any of the objects untill it exits.

I like to write the logic for it but I do not know how would I read a 500x500 pixel picture and decode the colors of each pixel. I like to assign a byte for each pixel's color (256color) but only use 4 bits of it to for start.

I am doing this as hobby. So please forgive me because I should only look at your answers during my free times.It will take some time before I could see it and mark your work as Helpful or Answer.

View 10 Replies

Add Border Around A Single-color Region In A Bitmap?

Mar 16, 2012

I'm looking for a code/algorithm that will help me to draw border around different color regions inside a bitmap.I have a bitmap like the "before" image.I want to add border around the colored regions like the "after" image.

VS Version: 2005-2010 (Doesn't matter)
Language: VB.Net / C# / C++ (Doesn't matter as long as it can be called from a managed exe)

View 3 Replies

Graphics Reduse The Depth Of Color Of A Bitmap?

Apr 18, 2010

What im trying to do is to minimize the file size of an image to as low as possible.Its 640x480 and i need to be 30kb or even 20 kb in file size...

View 3 Replies

TextRenderer.DrawText To Bitmap With ClearType And Color.Transparent Background?

Sep 28, 2008

The following code does not appear to draw text properly to the bitmap. The text is rendered bold and anything but "clear". Can someone please help? I've searched all over the web for a solution and have not been able to locate one.The Code:

[Code]...

View 6 Replies

Interface And Graphics :: Get The General Color Based On What Is Returned From Bitmap.GetPixel()?

Aug 28, 2009

how can i get the general color based on what is returned from Bitmap.GetPixel()? Like i want all shades of blue to just be blue, and so on

View 10 Replies

System Memory In Bitmap - Using Bitmap To Show Picture Box Like Slideshow Using Timer

Jul 3, 2011

I'm using Bitmap to show picture box like slideshow using Timer. For each timer interval, I've to go for new instance of Bitmap, there System memory increases to 1MB, How to resolve this, 'BG is picture box

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tic Dim img As Bitmap

img = New Bitmap(System.Drawing.Bitmap.FromFile(FileIO.FileSystem.GetFiles

[CODE]...

View 1 Replies

Use A ToolTip Directly To A Bitmap Object (System.Drawing.Bitmap)?

Dec 15, 2010

I'm trying to use a ToolTip directly to a Bitmap Object (System.Drawing.Bitmap), aparently I can't do this because Bitmap isnt a Windows Control.

View 1 Replies

Create Monochrome Bitmap From Semi Transparent Bitmap?

Sep 17, 2011

how can i create a monochrome bitmap from a semi transparent bitmap in vb.net? the bmp is for a transparency mask image for an icon i'm trying to create with the CreateIconIndirect API function.

i'm using vb2008 .Net3.5, but i would prefer an answer that would also work in vb2005

View 9 Replies

Extraxct A Rectangle Bitmap From A Big Bitmap?

May 26, 2011

Here is a short program to demonstrate my question. I just want to extraxct a rectangle bitmap from a big bitmap.Code as follows:

Private
Sub Button3_Click(ByVal sender
As System.Object,[code]....

Execution stops when hitting the Dim cloneBitmap statement, which should have created a bitmap out of the rectangle cut out.The message is:

"MissingMemeberException was unhandled.

No default member was found for type 'bitmap"

I just don't get it. Seems that the method Clone(Rectangle, PixelFormat was not found.

View 8 Replies

Parameter Is Not Valid - Bitmap Bmp = New Bitmap()

Feb 10, 2010

I have a grass image located here in my directory. I want to just create a Bitmap, but I am getting an error. (Parameter is not valid.) Immediate Window: A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll

[URL]

private void Form1_Load(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap("grass.jpg");
}
bertino

View 3 Replies

Creating .BMP File From Bitmap.Save(Path, ImageFormat.Bmp) Differs From Using Bitmap.Save(Path)?

Oct 1, 2011

The code below reads an Icon from an .ico file, converts the Icon read to a Bitmap and saves the bitmap using:

Bitmap.Save(PathA)
Then does:
PanelShowWrittenIconA.BackgroundImage = New Bitmap(PathA)

[code].....

View 2 Replies

Change A Forms Background System Color Schemes To Windows Default Color?

May 9, 2011

How to change a forms background system color schemes to windows default color schemes in vb.net?

View 2 Replies

VB - Pops Up A Color Picker Dialog And Let User To Change The Background Color Of The Label

Feb 15, 2012

I have a question of VB event handler and color picker. Now I have a label, and I want when user click it, it pops up a color picker dialog and let user to change the background color of the label. Not sure how to implement this, can anyone give me a direction?

View 2 Replies

VB 2008 - List Of Colors - To Change The Background Color Of The Combo Box To The Selected Color

Mar 3, 2010

Alright inside of a combo box I have a list of colors and I want to change the background color of the combo box to the selected color...basically this... but im not sure what the problem is here anyone have some advice or is this not possible?

CBLinerColor.BackColor() = CBLinerColor.Items.Item(0)

Basically i want dynamic code that will change the color depending on the items in the box.

View 3 Replies

VS 2008 Background Of Form To Be The Same Color As The Window Frame Color That The User Selects

Jun 19, 2009

I want the background of my form to be the same color as the window frame color that the user selects, even if that changes. I selected System->WindowFrame as my background color, but it always remains a dark grey, regardless of what I have my window color set to. How else would I achieve what I want? I assumed I was doing it the correct way. Do I actually need code that gets the system window color and then apply it?

View 4 Replies

Color Array Quantizer - Custom Colors And Are Not A Standard 256 Color Palette

Mar 23, 2012

I have a array of pixels. And I would like to Quantize them.

For Example

FF00FF,00FFFF stuff like that, but most are custom colors and are not a standard 256 color palette. So I need code to convert a color to a 256 color. I dont have any idea on how to do this, but thats why I came here. I do not want to use System.Graphics.Image.Palette or anything like that as this project uses arrays for images. I would like to if at all possible be able to convert a R, G, B color to 8bit, 16bit, 256bit and possibly use the HSL or NeuQuant method or something close to that, or maybe even some other methods of doing it. I do need to be able to do this for a single pixel, but I will also need a method for a array of them.

View 2 Replies

ContextMenuStrip Color Properties - Set The Background Color Of A Selected Menu Item?

Oct 15, 2009

Right Click drop down menu using ContextMenuStrip. The background color of an unselected menu item is set with "BackColor".The color of the text of a selected menu item is set with "ForeColor".How to set the background color of a selected menu item? Default appears as a dark grey and I would like to change it.

View 2 Replies

VS 2005 How Change Data Grid View Button Back Color And Fore Color

Dec 31, 2009

How to change the Data Gridview Button Back Color and Fore Color Based on Condition in Vb.net2005. i'm Attaching the gif toooo

View 5 Replies

Change Item Text Color Or Background Color In ListBox In .NET 1.1

Jun 17, 2009

I am using .NET 1.1, so I don't have the access to listitem object. I would like to change the text color or the background color of certain items in a listbox. can it do it in .NET 1.1?

View 5 Replies

Color Picker Luke Office 2007 Color Chooser?

Feb 13, 2010

I need to a color picker luke office 2007 color chooser this must be as "toolstripItem" for adding to toolbar!

View 1 Replies

Vb.2010 - Load All Known Color Names From Color.xxxxxxx In A ComboBox

Jan 28, 2012

I am trying to write code to load all nown color names from color.xxxxxxx in a ComboBox, but can not get it right. I can not find the Color Enum member. What I had in mind was something like this:

[Code]....

View 4 Replies

Color.FromName To Return A Solid Black Color When The Function Doesn't Recognize Any Text In The String Passed To It?

Jan 29, 2012

[URL] That way if the string that is not recognised that is passed to Color.FromName it returns a SolidColor of

Color.Black = Color.FromARGB(255,0,0,0)

That way, Forms and controls that only support SolidColors are supported.Installing VB6 on Windows 7?

View 15 Replies

Color Chooser (color Palette) Showing All Colors?

Jul 24, 2009

i would like to have an image like this one on my form.e form to turn this color

View 2 Replies

Convert Brush Color To Pen Color And Vice Versa?

May 3, 2009

Convert brush`color to pen color and vice versa?

View 6 Replies

Dynamic DataGrid Textbox Color The Same As Alternating Row Color

Apr 7, 2009

vb.net 2003 asp.net 1.1Web ApplicationI have a dynamic DataGrid with the alternating rowcolors and paging, with a textbox in each row. I need to know how to make the background color ofthe texboxes the same color as the row that they are in.

[Code]...

View 1 Replies

Possible To Replace A Specific Pixel Color With A Defined Color?

Mar 12, 2009

In either of these (preferably Vb6), is it possible to replace a specific pixel color with a defined color? For example, if i scan my screen for 100,200,150, is there a way i can replace every instance of that with a specific color?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved