473,504 Members | 13,746 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 2155
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.Draw 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
5217
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...
11
2446
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...
3
2472
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...
2
6592
by: Scott | last post by:
Is it possible to have a button change colour OnClick ? Thanks.
2
1786
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...
3
2882
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...
1
2273
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...
20
3136
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 ? ...
3
16981
by: Samuel | last post by:
Can anyone advice how to set the background colour of a new Bitmap Thank you, Samuel
6
2700
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(),...
0
7098
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...
0
7298
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,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5610
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,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
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 ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
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...

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.