Sign in to follow this  
vanattab

Is it possible to disable colorKey when loading an Image?

Recommended Posts

vanattab    194
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
vanattab    194
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:

[CODE]
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)
[/CODE]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this