See detailed reqs.
## Deliverables
Hello,
Hopefully the title is self-explanatory: the aim is to produce a .cpp/.h pair (MSVC10) which declare and define a single function SmoothSB() which is a re-implementation of the win32 StretchBlt() GDI function with SRCCOPY passed as blt type.
(Note there is no need nor desire to support any other type of blt except for SRCCOPY and the StretchBlt() parameter which is usually used to indicate the type of blt can and should be omitted.
In addition you should also assume the following:
0a. Both source and destination HDCs passed to SmoothSB() will only ever have DIB-section HBITMAP objects selected into them, both 32 bits-per-pixel.
0b. The HDCs passed for source and destination may be the same object, i.e. it needs to be possible to blt from one part of an HDC to another.
0c. The project using the module will always have a file named "stdafx.h" that you should include before anything so that WINVER is defined correctly for instance.
A further 'pre-consideration' is as follows:
0d. Do not include any error checking at all - none - except for _DEBUG builds by including <assert.h> and calling assert() with _DEBUG-only tests. If you use any auto/stack vars for this, enclose in an #ifdef _DEBUG...#endif block.
Requirements:
1. Your SmoothSB() must cope with both up- and downwards scaling using the {x0, y0, cx0, cy0, x1, y1, cx1, cy1} params (all 32-bit signed ints) to determine any 'scale factor' either -ve or +ve as StretchBlt() does.
2. MOST IMPORTANT: The result of calling SmoothSB() must apply some kind of smoothing algorithm, anti-aliasing or ortherwise, as appropriate so that in all cases the result does not have any recognisable side-effects of stretching the source image.
2a. I am open to comments and suggestions as to how this might be accomplished. Note that the primary concern is that actual images, background colour/gradient and any simple shapes/lines look their best. Text should be made to look as good as possible but it is likely I will where possible re-draw any text anyway using an appropriately-scaled HFONT.
3. The function needs to be as fast as possible so where you might need to use random values for instance, don't call rand() or any other RNG function, pre-generate a suitable set of values and store them in a static array.
3a. Use similar approaches for anything else, including considerations such as loop unwinding (or just not including unnecessary loops in the first place).
4. Finally, the header file should only declare SmoothSB() and not contain any other definitions or declarations or pre-processor stuff. Keep all private data private by defining it as static in the .cpp
4a. (Obviously it's up to you if you use one or more classes in your implementation or some other approach. The key thing is that it should exist with file scope within your .cpp only.)
Also, should be obvious but call your .cpp/.h [login to view URL] and SmoothSB.h respectively.
That's it. Many thanks.
* * *This broadcast message was sent to all bidders on Saturday Jul 21, 2012 6:41:14 AM:
Note my reason for including the asm category is that provided you provide equivalent x64 bytecode, you can use inline asm (MSVC2010) OR simply use both x86- and x64 versions of the same machine-level bytecode, should there be a useful opportunity to gain a performance improvement by doing so.