convert image to array of bytes or InPtr

  • Thread starter Thread starter Ricardo Furtado
  • Start date Start date
R

Ricardo Furtado

I'm using OpenGL in Visual Basic .net 2005 and i need to use the following
function

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer to an
image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?

My thanks in advanced

Ricardo Furtado
 
Ricardo Furtado said:
I'm using OpenGL in Visual Basic .net 2005 and i need to use the
following function

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer
to an image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?

Have a look at the Bitmap's LockBits function. The Scan0 property of the
returned object might be what you're looking for. I don't know if the
function expects any header.


Armin
 
Back
Top