473,382 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

how to fill the image with a particular color(pls don't say replace one img by anothr

hi all!
i am developing a GUI in v.b 6.0. it consists of some images (asume there are some images such as power controls, some switches... like that). i want to give a choice to the user so that suppose if he clicks on a menu "Color Palete", a window should appear containing so many colors, if he selects one color. then immediately the image on GUI should be filled with that color.

i have done some experiments with "pset" which is one of the methods of Graphics in vb. here the problem is

All the images are round in shape, and a black cureve is inside it.
When ever a user selects a yellow color the entire image except that black curve should be filled with that color. i can observe the co ordinates of the black curve and fill the remaing part with yellow. but it is a very slow process....

What should i do to get my image be filled with desired color with fastness.... if u know kindly help me
Thanks in advance
Raghunadhs.v
Jul 2 '07 #1
7 1937
kadghar
1,295 Expert 1GB
hi all!
i am developing a GUI in v.b 6.0. it consists of some images (asume there are some images such as power controls, some switches... like that). i want to give a choice to the user so that suppose if he clicks on a menu "Color Palete", a window should appear containing so many colors, if he selects one color. then immediately the image on GUI should be filled with that color.

i have done some experiments with "pset" which is one of the methods of Graphics in vb. here the problem is

All the images are round in shape, and a black cureve is inside it.
When ever a user selects a yellow color the entire image except that black curve should be filled with that color. i can observe the co ordinates of the black curve and fill the remaing part with yellow. but it is a very slow process....

What should i do to get my image be filled with desired color with fastness.... if u know kindly help me
Thanks in advance
Raghunadhs.v
why dont you use a gif with transparences? let transparent the part that you want to change and change de backcolor of the object.

I think that may be easier.

Good Luck
Jul 2 '07 #2
Killer42
8,435 Expert 8TB
I don't remember the details right now (and don't have time to search for it) but there is an API call to do a "flood fill". That'll do what you want. Try a bit of searching. I should have time in a day or two to go looking for it.
Jul 3 '07 #3
I could not get your idea, regarding to the filling the image with a particular color.
can u give me an example.

here the problem is the image consists of a black curve in the middle of the image. when ever we are filling the image with paritcular color, that black curve should not be effected. it should be in black only...

kindly reply me if u know how to do it...

Thanks in advance:
regards:
Raghunadhs.v
Jul 3 '07 #4
ok, killer, i will see that flood fill method...

Thanks,
regards:
raghunadhs.v
Jul 3 '07 #5
Killer42
8,435 Expert 8TB
ok, killer, i will see that flood fill method...
I should be able to look it up in an hour or two. In the meantime, just be aware that the floodfill will start from the specified point, and works like what you'd expect from a graphics program. So if you started at a point inside your black shape, for example, you would fill the shape with a colour.

(I always assumed you didn't want to just fill the entire image, because you could do that just by setting background colour and doing CLS.)
Jul 4 '07 #6
Hi killer!
thanks for your regular correspondence. i saw an example of "flood fill method" but could not be able to understand that. so what i did was

(1): i found the black curve's co-ordinates by using the co-ordinates of the mouse click event.(... i collected co-ordinares by cliking the mouse on the curve, so the mouse's click event gives the x,y values of each pixel.. like that myanually i collected those stuff into an array)

(2):
now i filled the image with the user's color and then by using "pset" method i fill the co-ordinates that are in my array with black color one by one.

finally i got a image what i required.... actually this is applicable to pictur box only .. so i replaced my image to picture....


Killer... actually i don't know whether it is a proper way or not... but i have less time so i did like this.. if there is any othere methodology pls let me know...

And pls provide some sample code to the flood fill method.. it may use full to me in little future.

Thanks
regards:
raghunadhs.v
Jul 4 '07 #7
Killer42
8,435 Expert 8TB
Download the floodfill example from here. It's a simple form with a few lines of code, and produces wonderful results. No instructions, but you shouldn't have too much trouble picking the code apart.
Jul 4 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob Manger | last post by:
Hi All, I am hoping someone can help me. I am trying to setup my main page so that when the user moves the mouse over an image, it changes the source (got this working). When the user CLICKS...
2
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button...
10
by: Matt Silberstein | last post by:
I am trying to make a page that will be 800px wide. That is, I have an 800px image. I want the content of the page centered. I can do that fine. On the top, I want an image logo with a text menu...
0
by: lc | last post by:
I'm building a small image gallery type of site and along with it I'm adding a few pages for site maintenance. One of the maintenance functions is to replace an image (haven't tried delete and new...
26
by: Yeah | last post by:
I have a web site which changes the header logo based on the upcoming holiday. For example, from December 10th to 25th, XMAS.JPG is displayed. From October 20th to 31st, HALLWEEN.JPG is...
4
by: Nel | last post by:
Hi all, I am struggling with understanding a small eregi problem in php4. My code: <?PHP $htmlsource = '<img src="pics/hotdog.gif"> text text <img src="pics/silly%20sausage.gif"> ';...
1
by: Kirthikaiitm | last post by:
Hi, I am totally new to Javascript and i am struggling to work with JScript. Pls help me in this issue. I have form with save,cancel and delete as image buttons. Eg. My code is <input...
2
by: martin2106 | last post by:
Hi members, I was searching for a specific script and found it here. But the problem is that it works in Firefox but doesn`t work in Internet Explorer. Who has the solution to get this script...
4
by: thesti | last post by:
hi, how to display a gif image, in HTML but when it reaches the the last frame, it stops. don't loop the animation. thank you.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.