Thread: Recording data from StretchBlt to disk

  1. #1
    Math wizard
    Join Date
    Dec 2006

    Recording data from StretchBlt to disk

    Disregard my previous thread. It appears that the problem I'm having is completely different. When I use StretchBlt to scale an image down, why is the buffer containing the output always black? How do I read the data? Even though I can see everything fine in my game engine, when I try looking at the data in the buffers right after all the drawing is finished, the only value I see is zero, pointing to a black image. Yet, the image, as I'm seeing it in the game engine is not black, it's vivid and detailed without very little black in sight.

    My question is, how do I read the data contained in buffers, for recording screenshots and the like to disk? Why do I only see 0's for the data in the buffers even though the scene is rich and vibrant in color?

    // globals
    unsigned char Buffer[2359296]
    unsigned char DebugTest;
    // other stuff and initialization
    // within a function - draw the bright test image
    AlphaBlend(BufferHandle, 0, 0, 1024, 768, ImageToDraw, 0, 0, 1024,768, BlendMode);
    DebugTest = Buffer[262144]; // outputs 0 when it should be 204
    This sample is the rough idea. Why is DebugTest in this case reporting zero when the value should be 204? This explains why fwrite is writing all-black images. Any ideas on what's going on?
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You want us to guess, based on ONE line of code which does NOT use the buffer you're trying to inspect?

    /closes eyes
    /opens eyes
    Nope, sorry, don't have a clue.

    I'm guessing you mean this post
    Using StretchBlt to automate repeated scaling
    Last edited by Salem; 03-14-2011 at 01:56 AM.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Saving binary tree data to disk
    By balazsbotond in forum C++ Programming
    Replies: 9
    Last Post: 12-09-2007, 09:46 AM
  2. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  3. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 09:53 AM
  4. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  5. C diamonds and perls :)
    By Carlos in forum A Brief History of
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM

Tags for this Thread