473,320 Members | 2,145 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,320 software developers and data experts.

Bitmap to surface...

ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function

Jun 27 '08 #1
7 2085
No ideas?

"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@microsof t.com...
ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function
Jun 27 '08 #2
This is XNA ? The bitmap is valid and have an appropriate size ???

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : eu**************@TK2MSFTNGP04.phx.gbl...
No ideas?

"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@microsof t.com...
>ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function
Jun 27 '08 #3
I'm referencing DirectX in VB2008 DOTNET, not using XNA. The Bitmap is the
appropriate size. I'm stumped as to what is going on. If I don't try to
draw anything, I get my nice blue screen. So I am assuimg everything up to
that point is ok.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:B4**********************************@microsof t.com...
This is XNA ? The bitmap is valid and have an appropriate size ???

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : eu**************@TK2MSFTNGP04.phx.gbl...
>No ideas?

"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@microso ft.com...
>>ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function
Jun 27 '08 #4
I would rather recommend using XNA. The IDE is C# based (it includes some
design processing for asset resources) but the Framework itself should be
usable from VB.NET.
Try perhaps http://www.thezbuffer.com/articles/470.aspx could help
especially if you are really in an exploration phase...

DirectX Managed is for 1.1 and won't be updated... I would switch to xna...
--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : 67**********************************@microsoft.com...
I'm referencing DirectX in VB2008 DOTNET, not using XNA. The Bitmap is
the appropriate size. I'm stumped as to what is going on. If I don't try
to draw anything, I get my nice blue screen. So I am assuimg everything
up to that point is ok.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:B4**********************************@microsof t.com...
>This is XNA ? The bitmap is valid and have an appropriate size ???

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : eu**************@TK2MSFTNGP04.phx.gbl...
>>No ideas?

"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@micros oft.com...
ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function

Jun 27 '08 #5
If I use XNA don't my customers then have to download and install XNA,
directx is basicly on every machine and since I am only going to be using
really basic operations (NO 3D what so ever) is XNA still the best choice?
"Patrice" <http://www.chez.com/scribe/wrote in message
news:71**********************************@microsof t.com...
>I would rather recommend using XNA. The IDE is C# based (it includes some
design processing for asset resources) but the Framework itself should be
usable from VB.NET.
Try perhaps http://www.thezbuffer.com/articles/470.aspx could help
especially if you are really in an exploration phase...

DirectX Managed is for 1.1 and won't be updated... I would switch to
xna...
--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : 67**********************************@microsoft.com...
>I'm referencing DirectX in VB2008 DOTNET, not using XNA. The Bitmap is
the appropriate size. I'm stumped as to what is going on. If I don't
try to draw anything, I get my nice blue screen. So I am assuimg
everything up to that point is ok.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:B4**********************************@microso ft.com...
>>This is XNA ? The bitmap is valid and have an appropriate size ???

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : eu**************@TK2MSFTNGP04.phx.gbl...
No ideas?

"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@micro soft.com...
ok...
>
This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?
>
Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function
>

Jun 27 '08 #6
If I remember MDX is installed for the latest DX releases but I believe it
had to be explicitely installed for the first releases in which it appeared.
So MDX is perhaps not always installed on older installs. The choice is
yours anyway but I wanted to make sure you knows about XNA...

Getting back to the original question, I gave this a quick try with a 32x32
red 24 bit depth bitmap file and it worked fine. What if you try "Scrath"
instead of "Default" for the pool.

What are the characteristics for your bitmap ? Is the size a power of 2 ? Is
the width/height quite low. If not what if you try a 32x32 bitmap ?

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : A9**********************************@microsoft.com...
If I use XNA don't my customers then have to download and install XNA,
directx is basicly on every machine and since I am only going to be using
really basic operations (NO 3D what so ever) is XNA still the best choice?
"Patrice" <http://www.chez.com/scribe/wrote in message
news:71**********************************@microsof t.com...
>>I would rather recommend using XNA. The IDE is C# based (it includes some
design processing for asset resources) but the Framework itself should be
usable from VB.NET.
Try perhaps http://www.thezbuffer.com/articles/470.aspx could help
especially if you are really in an exploration phase...

DirectX Managed is for 1.1 and won't be updated... I would switch to
xna...
--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : 67**********************************@microsoft.com...
>>I'm referencing DirectX in VB2008 DOTNET, not using XNA. The Bitmap is
the appropriate size. I'm stumped as to what is going on. If I don't
try to draw anything, I get my nice blue screen. So I am assuimg
everything up to that point is ok.
"Patrice" <http://www.chez.com/scribe/wrote in message
news:B4**********************************@micros oft.com...
This is XNA ? The bitmap is valid and have an appropriate size ???

--
Patrice

"Jameson" <mr********@gmail.coma écrit dans le message de groupe de
discussion : eu**************@TK2MSFTNGP04.phx.gbl...
No ideas?
>
"Jameson" <mr********@gmail.comwrote in message
news:49**********************************@micr osoft.com...
>ok...
>>
>This isn't working, and I dont know why, when I pass the resulting
>surface to StretchRectangle I get the awsome "error in application"
>haha... anyway. Is this not the right way (using .Net 3.5 runtime
>and
>the latest DirectX Dev Kit form March) to turn a bitmap into a
>surface?
>>
>Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
> Dim image As Direct3D.Surface
> image = New Direct3D.Surface(device, img,
>Direct3D.Pool.Default)
> Return image
> End Function
>>
>

Jun 27 '08 #7
Jameson wrote:
The Bitmap is
the appropriate size. I'm stumped as to what is going on. If I don't
try to draw anything, I get my nice blue screen. So I am assuimg
everything up to that point is ok.
What's the pixel format of the bitmap? I guess that the method won't
convert the pixel format, so it should probably be 24 bit or 32 bit.

--
Göran Andersson
_____
http://www.guffa.com
Jun 27 '08 #8

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

Similar topics

1
by: flyaflya | last post by:
I want to join some surfaces to a new big surface with alpha cannel, I want the new surface has same pixels(inclue r,g,b and alpha value) as the pixels on the source surfaces. my code as follow:...
3
by: Mathieu | last post by:
Hi ! How may I concert Graphics to Bitmap or Save Graphics to file... // Dim g as Graphics // g = pictureBox1.CreateGraphics // g.Save ???? I Just want to Save g (Graphics) in file C:\g.bmp
3
by: mark | last post by:
I want plot points on a cartesian surface with single pixels. I have been unable to find a graphics member which draws points. (Is there one?) I would like to create a bitmap one element wide and...
0
by: Duracel | last post by:
Hi, I've got a routine that fetches a bitmap from a COM server and converts it into a .NET format bitmap. The original DIB surface is 24 bit. When blitting this bitmap to a window, the speed...
3
by: NickP | last post by:
Hi there, I have a usercontrol that inherits from Windows.Forms.Button. In the OnCreateControl method I set the style of the control so that it supports transparent backcolor and set the...
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...
2
by: Smokey Grindel | last post by:
when I do this code Dim HIcon As IntPtr = bmp.GetHicon to convert a Bitmap which is just a 16x16 image I pulled from a resource originally as an icon (16x16x32bit) then converted into a bitmap to...
2
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, if i have a Graphics object or Bitmap object how do i get it to display on my web page? thanks, rodchar
0
by: Jameson | last post by:
ok... This isn't working, and I dont know why, when I pass the resulting surface to StretchRectangle I get the awsome "error in application" haha... anyway. Is this not the right way (using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.