Advertisement

06.03.2003 at 12:54PM PDT, ID: 20635642
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Blitting a Direct draw surface to another one

Asked by oliverlizotte in Miscellaneous Programming

Tags: , , ,

Hi!

I want to blit a direct draw surface to another in order to change the pixel format from an unknown type (current display settings) to a rgb 24 bits. My goal is to have access to the memory directly using the lock function.

I have two Direct Draw surfaces. The first one is my source surface of unknown type, and the second one is my 24 bits rgb destination.

I've been trying to blit from one to another, but I keep getting either the UNSUPPORTED or the INVALIDPARAM error from the blt function. I guess something most be wrong with my inits or the params. Here are some samples:

When I Blit:
HRESULT hr = m_pDISurface->Blt(0, m_pDDSOffscreen, 0, DDBLT_KEYDEST | DDBLT_WAIT , 0);
if(FAILED(hr))
    AfficherCodeErreur(hr);

When I lock (In case there is something wrong):
ddsd.dwSize = sizeof(ddsd);
// lock the front buffer and grab the surface memory pointer  
hr = m_pDISurface->Lock(0, &ddsd, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, 0);  
if(FAILED(hr))
    AfficherCodeErreur(hr);


Initialisations:
    ::ZeroMemory(&ddsd4, sizeof(ddsd4));
   ddsd4.dwSize = sizeof(ddsd4);    
   ddsd4.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
   ddsd4.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
   ddsd4.dwHeight = ddsd.dwHeight;
   ddsd4.dwWidth  = ddsd.dwWidth;
      
    ddsd4.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
      ddsd4.ddpfPixelFormat.dwFlags = DDPF_RGB;
      ddsd4.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
      ddsd4.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
      ddsd4.ddpfPixelFormat.dwBBitMask = 0x000000FF;
      ddsd4.ddpfPixelFormat.dwRGBAlphaBitMask = 0x00000000;
      ddsd4.ddpfPixelFormat.dwRGBBitCount  = 24;

    hr = m_pDD3->CreateSurface(&ddsd4, &m_pDISurface, NULL);

Thanks a lot!Start Free Trial
[+][-]06.03.2003 at 01:14PM PDT, ID: 8642247

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Programming
Tags: ddblt_keydest, surface, another, one
Sign Up Now!
Solution Provided By: DeanBrown3D
Participating Experts: 2
Solution Grade: B
 
 
[+][-]06.03.2003 at 01:34PM PDT, ID: 8642437

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.13.2003 at 04:09AM PDT, ID: 9352242

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32