Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Mar 2013
Offline Last Active Feb 15 2016 07:02 AM

Posts I've Made

In Topic: Problems with MFStartup(MF_VERSION)

10 February 2016 - 05:49 AM

It appears i had the wrong version of Windows Media Feature pack installed.

Downloading this one fixed the problem:


In Topic: Problems with MFStartup(MF_VERSION)

09 February 2016 - 03:31 AM

Ah, this was supposed to go into 'For beginners' :o

In Topic: Problems writing a BMP exporter

19 October 2015 - 07:18 AM

The problem was a simple one, 


file.open(Filename, std::ios::out)


needed to be


file.open(Filename, std::ios::out | std::ios::binary);


since it needs to write the data in binary mode.

In Topic: Problems writing a BMP exporter

19 October 2015 - 01:40 AM

Thank you for your answers. =)





Bitmaps are stored BGR and not RGB.


I do store them that way:

for (auto it = ImageData.begin(); it != ImageData.end(); ++it)
   char red = it->r;
   char green = 0;
   char blue = 0;
   file.write(&blue, sizeof(char));
   file.write(&green, sizeof(char));
   file.write(&red, sizeof(char));




Bitmaps are 4 byte aligned. This means that each horizontal line comes out to a multiple of 4 bytes.

Typically this is called "scanline size". This means that ( y * w + x ) *3 doesn't work.

You will have to find the scanline size by finding the smallest multiple of 4 larger than the width in bytes.

Like for( int scansize = 0; scansize < w_bytes; scansize += 4); will work (but not the best way).

You will need to allocate a buffer of (height * scanline_size) bytes and find the offset for each pixel by ( y * scaline_size + x * bytes_per_pixel).

In other words a generic 2d array wont work unless you can be sure that the scanline size is the same as (width * bytes per pixel).



I thought using a width of 640 would be aligned since:

640 pixels * 3 chars = 1920bytes
1920 bytes % 4 = 0

Isnt this correct? ohmy.png


Edit: If I change to constant values it works, and generates a red picture as expected 


   temp.r = i % 255;


   temp.r = 255;

In Topic: GET request contains addional non wanted data for XML document

13 September 2014 - 06:48 AM

Thank you for the answers. I've uploaded a file here which contains the raw data i receive:




I read your link Endurion and it seems you are correct! I was thinking along these lines in the beginning but when Reading 8000 bytes it landed me in the middle of the XML, however the number was encoded in hexadecimal, which is 32767.


Thank you Glass_Knife and Endurion for your help :)