473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Bitmap question?

Hi.
A am having some dificulties, getting pixells of a Bitmap image into a
byte array.
I am developing a control for Microsoft Compact Framework, and i need
to get the pixels of the image in one dimentional byte array, make
some changes and rewrite the bitmap.
I know that I can use Bitmap.LockBits() method but it returns a
BitmapData object, that is not present in Compact Framework class
library.
So if anyone knows other way I will thank him for sharing the
knowledge with me :)
Nov 16 '05 #1
8 1664
> A am having some dificulties, getting pixells of a Bitmap image into a
byte array.
I am developing a control for Microsoft Compact Framework, and i need
to get the pixels of the image in one dimentional byte array, make
some changes and rewrite the bitmap.
I know that I can use Bitmap.LockBits() method but it returns a
BitmapData object, that is not present in Compact Framework class
library.
So if anyone knows other way I will thank him for sharing the
knowledge with me :)


Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as
int's.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #2
> Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as
int's.


Sorry , but it is NOT present.I check that carefully :)
I know that with BitmapData is easy, but I need a managed way of doing this.
And also fast.Fastest possible.
Nov 16 '05 #3
> > Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as int's.
Sorry , but it is NOT present.I check that carefully :)
I know that with BitmapData is easy, but I need a managed way of doing

this. And also fast.Fastest possible.


The BitmapData class can be found in:

System.Drawing.Imaging.BitmapData

be sure to include system.drawing.dll.

see
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1031/cpref/html/frlrfsystemdrawing
imagingbitmapdataclasstopic.htm

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #4
Hi cody
Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as
int's.


Could You give us example ot that property?
I'm sorry. But i cannot find it in a .NET docs. :(

Marcin
Nov 16 '05 #5
> > Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as int's.


Could You give us example ot that property?
I'm sorry. But i cannot find it in a .NET docs. :(


OK I was a bit mistaken, there is no property for converting the bitmapdata
into an array but there is a property to get the address of the first
scannline. the properties name is "Scan0"

You have to enable unsafe code in your project and cast the IntPtr returned
from "Scan0" to byte*.
Then you can use the returned pointer as you would do in C.
(You could also use the Marshal class to copy a managed array into the
location pointed to by IntPtr but that might be slower).

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #6
"cody" <no****************@gmx.net> wrote in message news:<u0**************@TK2MSFTNGP12.phx.gbl>...
Sure the BitmapData class is present in the framework.
This class also has a property which returns you an Array of all Pixels as int's.


Sorry , but it is NOT present.I check that carefully :)
I know that with BitmapData is easy, but I need a managed way of doing

this.
And also fast.Fastest possible.


The BitmapData class can be found in:

System.Drawing.Imaging.BitmapData

be sure to include system.drawing.dll.

see
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1031/cpref/html/frlrfsystemdrawing
imagingbitmapdataclasstopic.htm

Sorry but I think that you didn't understand me.
The BitmapData class is NOT present in the COMPACT FRAMEWORK!
I am developing an application for Pocket PC.
And in the Compact Framework there is no namespace System.Drawing.Imaging
There is only System.Drawing
I hope that this time I explaned it better.
Nov 16 '05 #7
> Sorry but I think that you didn't understand me.
The BitmapData class is NOT present in the COMPACT FRAMEWORK!
I am developing an application for Pocket PC.
And in the Compact Framework there is no namespace System.Drawing.Imaging
There is only System.Drawing
I hope that this time I explaned it better.


In this case you have to use Bitmap.GetPixel. Maybe it is possible with
interop to get the address of the bitmap data but I don't know what
functions your Pocket PC supports.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #8
"cody" <pl*************************@gmx.de> wrote in message news:<uT**************@TK2MSFTNGP09.phx.gbl>...
Sorry but I think that you didn't understand me.
The BitmapData class is NOT present in the COMPACT FRAMEWORK!
I am developing an application for Pocket PC.
And in the Compact Framework there is no namespace System.Drawing.Imaging
There is only System.Drawing
I hope that this time I explaned it better.


In this case you have to use Bitmap.GetPixel. Maybe it is possible with
interop to get the address of the bitmap data but I don't know what
functions your Pocket PC supports.


Yes, I tryed that but it's too slow, and the algoritm is not fast
enough.

Can I write bytes directly in the memory, without using LockBits
method of the Bitmap class.

In fact is there a way writing data directly in memory regardless of
the object, just wherever I need.
:)
Nov 16 '05 #9

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

Similar topics

6
by: charsh | last post by:
Hi, I using the code below to draw a text in a pictureBox1. //Start--------------------------------------------------------------- private void button1_Click(object sender, System.EventArgs e)...
0
by: James Dean | last post by:
Question 1:I have my full image and i only display that when the zoom rate is 1:1......i guess i will set my default display to 1:16.....is it okay to just return a thumbnail of the entire image...
2
by: Michael Murphy | last post by:
At the risk of being publically humiliated, might I ask the following simple question. I have a solution with one project. This project, WindowsApplication1, has one "form" and one "bitmap" (the...
2
by: active | last post by:
I find Bitmap.Save works for WMF files but Bitmap.FromFile does not. If I use FromFile on a WMF file that came with VS I get an exception. If I use it on a WMF file created with Bitmap.Save I...
2
by: Peter Proost | last post by:
Hi group when save a bitmap called saveBmp like this: <<<< saveBmp.Save(filename, ImageFormat.Jpeg) <<<< the bitmap gets saved with it's size propertys, so if I right click the file and...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
0
by: news.microsoft.com | last post by:
Hi guys, This text looks long and complicate but it is not, and I really really need some help here. For the last 24hs I'm trying to resolve this issue (last night I dreamed
14
by: eliss.carmine | last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first time using C# at all so I don't know if this is the "right" way to do it. I've already found out several times the way I was...
8
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
6
by: \Frank\ | last post by:
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one that, for example, comes from the clipboard with CF_BITMAP. I'm guessing that a CompatableBitmap is an array of indices...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.