Jump to content
  • Advertisement
Sign in to follow this  
Fess59

Screen capture SharpDX

This topic is 1723 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


Hello!
 
There is the problem of changing the color depth when I get a shot of the screen with the SharpDX. Normally only works if the selected format A8R8G8B8, for changing the format to A1R5G5B5, comes out with a blank error message:
HRESULT: [0x8876086C], Module: [SharpDX.Direct3D9], ApiCode: [D3DERR_INVALIDCALL/InvalidCall], Message: Unknown
 
?ode C#:


 

var format = SharpDX.Direct3D9.Format.A8B8G8R8;
 
present_paramsS.Windowed = true;
present_paramsS.BackBufferFormat = format;
present_paramsS.SwapEffect = SharpDX.Direct3D9.SwapEffect.Discard;
present_paramsS.BackBufferWidth = Screen.PrimaryScreen.WorkingArea.Width;
present_paramsS.BackBufferHeight = Screen.PrimaryScreen.WorkingArea.Height;
 
dS = new SharpDX.Direct3D9.Device(new SharpDX.Direct3D9.Direct3DEx(),
0,
SharpDX.Direct3D9.DeviceType.Hardware,
IntPtr.Zero,
SharpDX.Direct3D9.CreateFlags.HardwareVertexProcessing,
present_paramsS);
 
sS = SharpDX.Direct3D9.Surface.CreateOffscreenPlain(
dS,
Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
format,
SharpDX.Direct3D9.Pool.Scratch);
 

 
The main objective to minimize the size of the image. Are there any more settings in the initialization that can affect the volume of the resulting screen shot?

Share this post


Link to post
Share on other sites
Advertisement

I don't know about the SharpDX image exporter, but typically those type of functions don't convert the format of the texture for you.  Is it possible for you to do a compression on the image after it is saved on the CPU side?  That would allow for arbitrary format selection, plus you could take as much time as needed for the conversion if you spin off another thread to do the processing for you.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!