Click to See Complete Forum and Search --> : How does DirectDraw Blit() Scale Down?
pmh4514
April 26th, 2004, 03:00 PM
By what method does DirectX 8.1 use to scale down bitmap data when Blt() is called to push a bitmap into a smaller rectangle than its source? My code is working just fine, I only ask because my customer wants to know "well, how is this being scaled down" (i.e. pixels thrown away? average? interpolation? I need to know exactly what Blt() is doing. Any links, answers or requests for further detail from me are appreciated!
Thanks
Paul
Marc G
April 27th, 2004, 10:28 AM
That depends on how you setup DirectX to do filtering. DirectX can use bilinear, trilinear, ... filtering.
See IDirect3DDevice9::SetSamplerState .
pmh4514
April 27th, 2004, 10:44 AM
Interesting.. I'm looking through the MSDN library, is SetSamplerState() a valid DirectX 8.1 method? It doesn't appear to be.. Nor do I find any call to that method or interface in my code (err, I should say, the code I'm now tasked with taking over.)
In the absence of that.. what's performing the scale? All the MSDN info points to "automatically / arbitrarilly scaled" but there must be documentation somewhere..
thanks
-Paul
Marc G
April 27th, 2004, 11:15 AM
SetSamplerState is from DirectX9.
I think it is called SetTextureStageState on DirectX8. Scaling depends on the filtering setting you use. For example bilinear or trilinear filtering. You can find definition of these on the web.
pmh4514
April 27th, 2004, 11:32 AM
I must be misunderstanding something here.. DirectDraw is being used. DirectX version is 8.1. Scaling is happening. SetTextureStageState() is never called anywhere within the code, nor is D3d8.h (the file the method is declared in according to MSDN) included anywhere in the project.
does this simply mean it's defaulting to something?
Marc G
April 27th, 2004, 12:17 PM
Oops, my mistake, apparently my mind was somewhere else when I wrote that previous replies....
Apparently you cannot change the filtering of DirectDraw. Blt() will do some hardware filtering on some graphics cards and will do no filtering on other cards.
See http://groups.google.be/groups?hl=nl&lr=&ie=UTF-8&oe=UTF-8&threadm=81p8jv%24mec%241%40newsg4.svr.pol.co.uk&rnum=1&prev=/groups%3Fq%3Ddirectdraw%2Bfiltering%26hl%3Dnl%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D81p8jv%2524mec%25241%2540newsg4.svr.pol.co.uk%26rnum%3D1
So it's difficult to tell what kind of filtering is happening. It depends on the card.
pmh4514
April 27th, 2004, 01:15 PM
interesting.. I wonder how I can find out how my card's vendor implements Blt() in their abstraction layer. So you state:
Blt() will do some hardware filtering on some graphics cards and will do no filtering on other cards.
Ok, assuming the video card does no filtering - what does this mean? I do have a 1000x1000 image being displayed in 250x250 worth of screen space, if the card itself is doing no filtering, the pixels are simply resized? That doesn't seem right..
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.