Hello,
Where could aI find a sample code which would show how to use
Marshal.Copy to copy a "graphics image" to pixel based image?
There is a MS (really) quick supportpage for that http://support.microsoft.com/kb/814675/en-us
but it is too approximate for anything.
Cheers! 3 13912
Jerry,
That document refers to using the Scan0 property on the BitmapData
instance returned to you from the call to LockBits.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Jerry Q" <jq****@yahoo.c om> wrote in message
news:dq******** **@nyytiset.pp. htv.fi... Hello,
Where could aI find a sample code which would show how to use Marshal.Copy to copy a "graphics image" to pixel based image?
There is a MS (really) quick supportpage for that http://support.microsoft.com/kb/814675/en-us but it is too approximate for anything.
Cheers!
Yes it does, but there are also lot's of code in Internet that uses those
Classes and objects in manyways. Methods of those classes have also
very complex parameters and many kind of conversions must be made.
It would be more painless to have proper example from Microsoft becuse
their GDI+ classes haven't any kind of support for this operation.
Cheers!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:e7******** ******@TK2MSFTN GP10.phx.gbl... Jerry,
That document refers to using the Scan0 property on the BitmapData instance returned to you from the call to LockBits.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Jerry Q" <jq****@yahoo.c om> wrote in message news:dq******** **@nyytiset.pp. htv.fi... Hello,
Where could aI find a sample code which would show how to use Marshal.Copy to copy a "graphics image" to pixel based image?
There is a MS (really) quick supportpage for that http://support.microsoft.com/kb/814675/en-us but it is too approximate for anything.
Cheers!
Here is an example to fill in, you can also copy out.
Public Shared Sub FillBitmap(ByVa l bmp As Bitmap, ByVal imgArray As Byte())
Dim h As Integer = bmp.Height
Dim bmpDat As Imaging.BitmapD ata
Dim stride As Integer
Try
bmpDat = bmp.LockBits(Ne w Rectangle(0, 0, bmp.Width,
bmp.Height), _
Imaging.ImageLo ckMode.WriteOnl y, bmp.PixelFormat )
stride = bmpDat.Stride
Marshal.Copy(im gArray, 0, bmpDat.Scan0, stride * h)
Catch ex As Exception
Finally
bmp.UnlockBits( bmpDat)
End Try
End Sub
"Jerry Q" wrote: Yes it does, but there are also lot's of code in Internet that uses those Classes and objects in manyways. Methods of those classes have also very complex parameters and many kind of conversions must be made.
It would be more painless to have proper example from Microsoft becuse their GDI+ classes haven't any kind of support for this operation.
Cheers!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl... Jerry,
That document refers to using the Scan0 property on the BitmapData instance returned to you from the call to LockBits.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Jerry Q" <jq****@yahoo.c om> wrote in message news:dq******** **@nyytiset.pp. htv.fi... Hello,
Where could aI find a sample code which would show how to use Marshal.Copy to copy a "graphics image" to pixel based image?
There is a MS (really) quick supportpage for that http://support.microsoft.com/kb/814675/en-us but it is too approximate for anything.
Cheers!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
by: Tom |
last post by:
I think I'm still a little rough on the principle and understanding of
Marshal by value and Marshal by reference after reading various materials.
my understanding of Marshal by value is that the object is copied and passed
by value out of the application domain. So does that mean the ENTIRE server
object is copied to the client side ? thus all calculations are done on the
client side ?
ie. if client/server
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard is proving to be more difficult. These
pictureboxes are bound to an AccessDB. If the user wants to add an image,
they select an image using an OpenFileDialog:
Dim result As DialogResult = Pic_Sel.ShowDialog()
If (result = DialogResult.OK) Then
|
by: Minfu Lu |
last post by:
Is there anybody knows how to copy a form (actually the image of a form) to
clipboard?
Jason
|
by: tsteinke |
last post by:
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.FromHbitmap.
Does anyone know if Bitmap.FromHbitmap actually copies the bits
| |
by: Goran |
last post by:
Hi all!
I need to pass managed String from to C-style APIs. I see I can use
Marshal::StringToXXX functions. Is this the best we have? I understand
this will allocate a new string and create copy of my String. I want to
pass it as constant (LPCWSTR). I don't need allocation and copying,
just the pointer. Can I have it, pretty please?
In normal C++, we usually have conversion operator or a function to get
it from a string class...
|
by: Rainer Queck |
last post by:
Hi NG,
is there a way to copy a buffer pointed to by a IntPtr directly into a two
dimensional byte-array?
I tried this, what obviously doesn't work:
byte image = new byte;
IntPtr p = <hardwareDeviceClass>.GetBufPtr();
|
by: O.B. |
last post by:
When using Marshal to copy data from a byte array to the structure
below, only the first byte of the "other" array is getting copied from
the original byte array. What do I need to specify to get
Marshal.PtrToStructure to copy the all the data into the "other"
array?
unsafe public struct DeadReckoning
{
|
by: yogiam |
last post by:
I have a server listening for connections. Client connects and both start streaming webcam images. This works fine as long as there is only one client connected(running as a Thread). When another client connects, the new thread starts streaming as well. The camera is accessed in a mutual exclusive way by locking which fails some times and I get AccessViolationException. Below is the code executing in the thread.
The scenario is like this :...
|
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...
|
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...
| |
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: 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...
|
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: 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.
| |