Sign in to follow this  

Is it possible to disable colorKey when loading an Image?

This topic is 1937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to get the MDX9 Surface.FromBitmap() functionality with SlimDX. I think I need to use the SlimDX.DX9.Surface.FromFile() method but all of the overloads of that method take a colorKey argument. What do I do if I want to render all of the colors?

Share this post

Link to post
Share on other sites
Also I am getting a D3DXERR_INVALIDDATA exception when I call the Surface.FromFile( ) method. I know that the path to the file is correct.

[source lang="vb"] Public Overridable Sub CreateDeviceResources()
Dim str As String = Application.StartupPath & "\phoriaRing.bmp"
test = Surface.CreateOffscreenPlain(device, 150, 150, Format.A8R8G8B8, Pool.Default)
Surface.FromFile(test, str, Filter.Default, 8)
End Sub[/source]

I tried enabling the debug runtime but its not much help:

Direct3D9: (INFO) :======================= Hal HWVP device selected
Direct3D9: (INFO) :HalDevice Driver Style b
Direct3D9: :Subclassing window 000d04ba
Direct3D9: :StartExclusiveMode
Direct3D9: (INFO) :Using FF to VS converter
Direct3D9: (INFO) :Using FF to PS converter
Direct3D9: (INFO) :Enabling multi-processor optimizations
Direct3D9: (INFO) :DDI threading started
D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 5.80233e-315f, not 5.51222e-315f. This is ok.
A first chance exception of type 'SlimDX.Direct3D9.Direct3D9Exception' occurred in SlimDX.dll
An unhandled exception of type 'SlimDX.Direct3D9.Direct3D9Exception' occurred in SlimDX.dll
Additional information: D3DXERR_INVALIDDATA: Invalid data (-2005529767)

Ok I managed to get the Surface.FromFileInStream() working but I have to know the Size of the image and everything in advance. What if I don't know the size of the image. I guess I could load the File in a Image object and then record the information and then do a FromFileInStream but that seems like poor efficiency. There has to be a better way. Edited by vanattab

Share this post

Link to post
Share on other sites
Sign in to follow this