473,804 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does Bitmap.FromHbit map Copy Memory?

I am in the process of creating a System.Drawing. Bitmap from a block of
memory containing a DIB Bitmap. I can think of about a half dozen ways
to do this. For perfomance reasons I don't want to be copying the
enitre bitmap around more than I have to.

Right now I am considering a Pinvoke call to CreateDIBitmap then
passing that handle to
Bitmap.FromHbit map.

Does anyone know if Bitmap.FromHbit map actually copies the bits
interally or if it simply sets up some sort of internal handle to the
existing bitmap.

Thanks.

Nov 23 '05 #1
1 5002
The documentation is clear. Gdiplus uses the existing handle.

You are responsible for both the gdi bitmap handle and the gdiplus
bitmap created with this handle.

You must not use DeleteObject on this handle until you have disposed
of the gdiplus bitmap object created with that handle.

Here is the reference to the documentation:
http://msdn.microsoft.com/library/de...52hbm_hpal.asp
<ts******@gmail .com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I am in the process of creating a System.Drawing. Bitmap from a block of
memory containing a DIB Bitmap. I can think of about a half dozen ways
to do this. For perfomance reasons I don't want to be copying the
enitre bitmap around more than I have to.

Right now I am considering a Pinvoke call to CreateDIBitmap then
passing that handle to
Bitmap.FromHbit map.

Does anyone know if Bitmap.FromHbit map actually copies the bits
interally or if it simply sets up some sort of internal handle to the
existing bitmap.

Thanks.

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
575
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#
1
5208
by: Dennis Myrén | last post by:
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...
1
2770
by: wavemill | last post by:
Hello! I would like copy my control in a bitmap and after in a jpeg. I have an error of gdi! This is my code System.IntPtr intPtr = this.RichTextBox.Handle; System.Drawing.Image img = Bitmap.FromHbitmap(intPtr); img.Save(@"Mypath\test.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
2
16047
by: Bruce D | last post by:
I'm having a problem saving my bitmap in my MySQL database. Apparently it's too big...but it shouldn't be. Here's what I got: Dim bmpDocument As Bitmap = Bitmap.FromHbitmap(hDibCopy) ' get image from scanner Dim bmpResize As New Bitmap(bmpDocument, 680, 880) mySQLManager.InsertDBImage(elmImageIndex, intNextDocument, bmpResize) Public Function InsertDBImage(ByVal ImageElement As XmlElement, _ ByVal
0
3959
by: Jørn Jensen | last post by:
Hey! I have an issue with creating bitmap from an IntPtr. The IntPtr is created from a Twain scanner, which seem to work perfectly in it's original state (the app is originally written by somebody else). It's when I add the I get an error. Extracts of my code and the error statement from the Visual Studio Debug bellow: Select Case cmd Case TwainCommand.CloseRequest EndingScan()
2
7780
by: cosminb | last post by:
I have a native function which returns an image in the form of a BYTE* lpDIB array. How do I convert it to a Bitmap, so that I can work with it properly in C#? Thanks in advance, Cosmin
0
1231
by: cody | last post by:
So I am trying to save a bunch of screen captures, and I am having problems. The bitmaps appear to be saving correctly, since once I run the program I get a bunch of 5MB files in the bin/Debug folder, however whenever I try to open them I get an error saying file not found. The code is posted below, any help is greatly appreciated. namespace pictures { public partial class Form1 : Form {
19
2438
by: active | last post by:
The ColorPalette class has no constructor so how does one use it? I define a variable by: Dim cp as ColorPalette but don't know how assign an object to the variable. Thanks in advance
20
7019
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If lData.GetDataPresent(DataFormats.Bitmap) Then Dim lPictureBox As New PictureBox
0
9716
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
9595
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
10354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
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
10101
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
6870
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();...
0
5536
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...
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
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.