473,659 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Colour map implemented as a bitmap

EARNEST
128 New Member
Hello there,
I would like to create N x M colour map, pixel at location(a,b) would be of certain colour based on certain range of values of double/integer filters. The trick is that it would have like 70*50 pixels that would change their colors very fast (depending on those double filters). I implemented it as a bitmap.

Expand|Select|Wrap|Line Numbers
  1. for loop i
  2. {
  3. for loop j
  4. {
  5. myColorMap.SetPixel(i, j, Color);
  6. }
  7. }
Is it efficient? Are there any better implementations ?
Mar 7 '10 #1
3 2161
GaryTexmo
1,501 Recognized Expert Top Contributor
Honestly, I don't know how efficient this implementation is. I think a bitmap like that lives in memory so it shouldn't be terribly slow, but there's also a good chance it doesn't use your graphics card to handle the drawing, which may be slow.

You could give GDI+ a try (though I'm not sure how fast that is either), or you could look at embedding an XNA game object (google these terms :D) into your form and use that to draw, where you can either use a Texture2D object as your color map (manipulate the Texture2D data, which is a 2D array of Color) or use a 1x1 pixel texture with SpriteBatch.Dra w to serve as a "pixel".

If it were me, I'd try a bunch of different methods to see what gave you the performance you were looking for :)
Mar 7 '10 #2
EARNEST
128 New Member
Hm, totally forgot about Sprites for 2d...thats a good idea. I'll give it a try, but need to do more research, not that good with CG and XNA. Thanks a lot.
Mar 7 '10 #3
GaryTexmo
1,501 Recognized Expert Top Contributor
I should add that manipulating the color data for a Texture2D object is probably no different than writing to an in-memory bitmap like you're already doing. It's just that the draw itself might be a little faster.
Mar 7 '10 #4

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

Similar topics

6
5230
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and black text but when I change Windows start menu->settings->control panel ->display -> appearance and change scheme to 'High Contrast Black' the background in the browser changes to black and the text to white. I understand that the windows scheme...
11
2457
by: Mr. B | last post by:
While at first this may seem a simple tast, it has plagued me for a while... What I want to do is to have the background colour of something like a TextBox to change from (say) White to Yellow to White to Yellow and then back to White in about 1 second or so. This is to create something like a 'flash' (or a Pulse) for when a User clicks on 1 of 4 Radio Buttons (which change the Text in the TextBox). So in other words, to get the...
3
2485
by: MS | last post by:
I need to determine CMYK values from bitmaps. Is there a way in VB or Access to do this? The reason is that I need to determin the relative CMYK values. Example: A square with the bottom half filled with black would have a black value of 50%. The same square with the bottom half filled with red would have values C=0, M=50%, Y=50%, K=0 and so on. At the moment we're putting a small version of the image into a paint
2
6617
by: Scott | last post by:
Is it possible to have a button change colour OnClick ? Thanks.
2
1798
by: Carl Gilbert | last post by:
Hi I am looking to edit an icon at runtime on menu items such as change fill colour. I wish to replicate the features found in most applications where by the coloured bar on a colour picker icon changes colour to the last selected colour. Therefore the user can easily tell which colour will be apllied when
3
2904
by: Mark Ingram | last post by:
Hi, ive got an imagine in a PictureBox, and would like to get the colour of the pixel when the mouse is over the control. From what ive (briefly) seen, there is no way to do this directly in C# and requires you to use GetPixel from the Win API? Is this correct? Any other better ways of doing this? Thanks,
1
2274
by: Robert T | last post by:
Hi I would like to change the title property(the hint displayed when you move over it) of an elements colour/and or text size. Is this possible Can I change the title property's (hint on mouseover) text colour etc Thanks
20
3158
by: Chor Lit | last post by:
Hi, I asked Bjarne Stroustrup about the idea of adding colour standard for C++, and he said that it is very difficult for compiler vendors to change their IDE. But do you think it is possible ? Note that the proposed colour standard is not just merely to ease the eye only as what presently is in C++ compilers, but to aid in syntax disambiguation and other advantages. Here are a few advantages that I can think of:
3
17030
by: Samuel | last post by:
Can anyone advice how to set the background colour of a new Bitmap Thank you, Samuel
6
2705
Robbie
by: Robbie | last post by:
Hi. I've made 2 functions which play around with colours. They convert a 'colour number' (I don't know what the proper name for it is, so I call it this - the Long given back by RGB(), object.BackColor, etc, which represents a value of red, green and blue) into another 'colour number' but this is a greyscale version of it. There are 2 functions - the first one 'decodes' the 'colour number' into the separate R G and B values. The second one...
0
8427
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
8851
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...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
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
7356
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...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.