Recording data from StretchBlt to disk

This is a discussion on Recording data from StretchBlt to disk within the Windows Programming forums, part of the Platform Specific Boards category; Disregard my previous thread. It appears that the problem I'm having is completely different. When I use StretchBlt to scale ...

  1. #1
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582

    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?

    Code:
    // 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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    You want us to guess, based on ONE line of code which does NOT use the buffer you're trying to inspect?

    /closes eyes
    /aummmmmmmmmmmmm
    /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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 08: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, 08:53 AM
  4. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 07:04 PM
  5. C diamonds and perls :)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21