Handmade Hero»Forums»Code
3 posts
StretchDIBits performing weirdly (?)
Ok first of all, this project is awesome, I learned about it couple weeks back and am trying to follow the archived videos from beginning. I have passed the bitmap displaying, but something is wrong with StretchDIBits. I am getting this window window image . See those horizontal lines? those appear in Casey's machine only when he reshapes the window, but in my case they are always there. I got this from the beginning and didn't worry and kept following videos (am in day 11 now). I assumed it was something not to worry about, but not so sure anymore.

I did some experimenting. If I open the window in 1280*720 dimension (equal to buffer) the lines disappear and become smooth. But in other dimensions the lines appear even when I am doing nothing with the window. So, I am guessing it's the fault of StretchDIBits. But I am a complete beginner, so I am asking for advice here, is this a issue? if so what can I do? I've adhered to Casey's code. just changed some variable names mostly.
Mārtiņš Možeiko
2559 posts / 2 projects
StretchDIBits performing weirdly (?)
It's expected. When StetchDIBits resizes bitmap it uses very simple algorithm, so the image you get will not look good. If you want to get nice looking image adjust arguments so image is not resized (destination width and height should be equal to source width and height).
3 posts
StretchDIBits performing weirdly (?)
well yeah I expected that what bugs me is, in Casey's case the gradient is smooth when he isn't reshaping the window i.e. when the window is just sitting there. But in my case the lines are always there.
3 posts
StretchDIBits performing weirdly (?)
Sorry, found realized what's happening now, when the window is larger than the buffer, there wil be no such lines, in Casey's machine the window always opens in dimensions larger than the buffer, so his window appeared smooth, but in my machine the initial dimensions are smaller than 1280*720 , so I always get the lines.