Hi.
I use System.Drawing. Bitmap to copy bitmap pixel data.
I use LockBits to retrieve a BitmapData which in turn provides me with the
Scan0 property which i then use to loop the pixel data using a byte *.
I am aware of that internally GDI+ stores RGB as BGR,
therefore i have to manually swap the R and B components of each
pixel.
Since GDI+ internally stores the components in BGR order, there is'nt a
way to copy the entire pixel data directly without looping the pixels, is
it?
Thank you!
MVH Dennis 1 5208
Dennis,
No, it would appear that there isn't. If it was in RGB order, then you
could just copy the block of memory, but that doesn't seem feasable.
You could also try copying the block of memory, and then swapping the
bytes at every 1st and 3rd index (the R and B components). It might be
faster, and require less loop iterations.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:Jf******** **********@news 4.e.nsc.no... Hi.
I use System.Drawing. Bitmap to copy bitmap pixel data. I use LockBits to retrieve a BitmapData which in turn provides me with the Scan0 property which i then use to loop the pixel data using a byte *. I am aware of that internally GDI+ stores RGB as BGR, therefore i have to manually swap the R and B components of each pixel. Since GDI+ internally stores the components in BGR order, there is'nt a way to copy the entire pixel data directly without looping the pixels, is it?
Thank you! MVH Dennis This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Question with BinaryReader |
last post by:
Is someone can give me example?
I want to create Bitmap with pixel data saved in a binary file, the data
file only have red data block and green data block. I have implemented it
with VC6.0, now I want to rewrote it with C#.
My question is
1. using of Bitmap (Int32, Int32, Int32, PixelFormat, IntPtr)
2. how to implement memory copy efficiently in C#
|
by: jty202 |
last post by:
I know alot of people have the problem with indexed pixel format. I hope
someone can show me the solution to this.I am have problem with graphics
with the following code giving the error:
"A Graphics object cannot be created from an image that has an indexed pixel
format."
'My code
|
by: TomHL |
last post by:
hello,
- I have a Bitmap Object named: bmp1
- I already have the numerical values of:red,blue and green colors + I have
the X and Y cordinates.
How do I set the pixel value via safe code on the bmp1 object?
(the pixel location based on the X & Y values and it's color based on the
red,blue and green values the I already have)
|
by: Mad Scientist Jr |
last post by:
I have a bitmap (32 pixels high, 8192 pixels wide) that contains 255
images, each 32 pixels wide, that I would like to chop up into
individual 32x32 bitmap files. Rather than spending hours in Paint or
Photoshop I would like to do this programmatically. My code below
attempts to load in the original bitmap, crop it at the desired
location, and save it to the correct file. I don't think I'm doing this
right, I tried messing with different...
|
by: Vrijbuiter |
last post by:
I want to detect a pixel color number when i move the mouse over de
picturebox.
I think the next line has the color but i don't now how i get it:
System.Drawing.Point pt = new Point() ;
pt.X =151;
pt.Y =195;
this.textBox3.Text =
string.Format("{0}",pictureBox1.Image.Palette.Entries.ToString() ) ;
| |
by: icepick72 |
last post by:
On an academic note, I want to copy a Graphic to an Image (Bitmap).
I have the Graphic object but not the origin image from which it
originates; this is because I'm overriding the PrintDocument class
OnPagePrint method which only provides me an e.Graphic (see code
sample below).
The FCL doesn't seem to natively support Graphic =(Image)Bitmap. I
have tried BitBlt workaround in the source code to copy printer
e.Graphic into the bmp...
|
by: Martijn Mulder |
last post by:
When I zoom in on an image, GDI+ automatically smoothens the edges
between the pixels. I am looking for a way to see the individual pixels
as squares in the enlarged image, like in MSPaint. I searched in vain in
the enumerations System.Drawing.Drawing2D.SmoothingMode and
System.Drawing.Drawing2D.InterpolationMode to find the constant that
does just that. How?
|
by: Martijn Mulder |
last post by:
When I zoom in on an image, GDI+ automatically smoothens the edges
between the pixels. I am looking for a way to see the individual pixels
as squares in the enlarged image, like in MSPaint. I searched in vain in
the enumerations System.Drawing.Drawing2D.SmoothingMode and
System.Drawing.Drawing2D.InterpolationMode to find the constant that
does just that. How?
Some code to illustrate the problem:
using System.Drawing;
|
by: ofiras |
last post by:
Hi,
I made a "Paint" program, but I couldn't find a method to paint 1
pixel using graphic state ("Graphics g =
Graphics.FromHwnd(this.Handle);")
How can I paint 1 pixel?
I guess I can make a Bitmap, change one pixel color and show it, but
I'm sure there is another way of doing it.
Please help,
Ofir.
|
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,...
|
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...
| |
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |