473,624 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

52 New Member
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 1947
kadghar
1,295 Recognized Expert Top Contributor
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 Recognized Expert Expert
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
raghunadhs
52 New Member
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
raghunadhs
52 New Member
ok, killer, i will see that flood fill method...

Thanks,
regards:
raghunadhs.v
Jul 3 '07 #5
Killer42
8,435 Recognized Expert Expert
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
raghunadhs
52 New Member
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 Recognized Expert Expert
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
4432
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 on the image (it is a link to the content page) it changes to a third image AND STAYS THERE. ie: so the iamge won't change back to the omouseoff image. Does this make sense? Also, how do I "preload" the images before they are even needed? eg:...
2
3495
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 with image populate.gif? When I click p1 or p2 button, it will post the page to process.asp. 2) When I check the checkbox, I want the image in submit button change from populate.gif to validate.gif. Unfortunately, the code InputForm.p2.src =...
10
2048
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 placed on top. Right now I have that working just fine in Mozilla and horrible in IE. The page validates just fine for both CSS and HTML. This should be easy, but somehow I just don't get positioning. Here is the link to the page:...
0
1219
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 image yet). All available images sit in a subfolder. In one par of the form with image replace request I show a datalist hooked up to a paging data table. The other part of the form show a single big image that's being edited and is hooked up...
26
2422
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 displayed. Etc. etc. If today's date is not near a holiday, then the default LOGO.JPG is displayed. A while back, I was looking for a JavaScript that does this automagically. But each snippet I found traditionally displays the default logo for a...
4
2455
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"> '; eregi('(=")(pics/)(+...)(")',$htmlsource,$imagesintext); ?>
1
1584
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 type="image" src=/image/bt_save.jpg....> I want these image buttons to get disabled once i enter the form. On clicking any field in form i want this image button to get enabled.
2
2118
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 working in IE? <script type="text/javascript"> function MyHead() { var list = new Array();
4
63809
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.
0
8240
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.