This function can be used to scale a buffer of raw pixels to a destination raw pixel
buffer. Note that this function does not accept Hollywood bitmaps, but expects you to pass
raw pixel buffers only. This makes it possible to use hw_RawScale()
in lots of
different contexts. If you want to use hw_RawScale()
on Hollywood bitmaps, you need
to lock those bitmaps first using hw_LockBitMap() and then
pass the raw pixel buffer pointer obtained by hw_LockBitMap()
to hw_RawScale()
.
You have to pass source and destination pixel buffer pointers as well as a pointer
to a struct hwRawScaleCtrl
to this function. struct hwRawScaleCtrl
looks like this:
| struct hwRawScaleCtrl
{
int SrcX; // [in]
int SrcY; // [in]
int DstX; // [in]
int DstY; // [in]
int SrcWidth; // [in]
int SrcHeight; // [in]
int DstWidth; // [in]
int DstHeight; // [in]
int PixFmt; // [in]
int SrcModulo; // [in]
int DstModulo; // [in]
};
|
Here's an explanation of the individual structure members:
SrcX:
-
Contains the x position in the source buffer that marks the start offset
for the scale operation. This is relative to the upper-left corner of the source buffer.
SrcY:
-
Contains the y position in the source buffer that marks the start offset
for the scale operation. This is relative to the upper-left corner of the source buffer.
DstX:
-
Contains the destination x position relative to the upper-left corner.
DstY:
-
Contains the destination y position relative to the upper-left corner.
SrcWidth:
-
Contains the number of columns to scale.
SrcHeight:
-
Contains the number of rows to scale.
DstWidth:
-
Contains the destination scale width.
DstHeight:
-
Contains the destination scale height.
PixFmt:
-
Contains the pixel format used by the source and destination pixel buffers. Both
buffers must use the same pixel format. See Pixel format information for details.
SrcModulo:
-
This must be set to the number of pixels per row in the source buffer. This can be more
than the actual image width in case there are padding pixels.
DstModulo:
-
This must be set to the number of pixels per row in the destination buffer. This can be more
than the actual destination image width in case there are padding pixels.
The flags
parameter can be used to specify further parameters for the scaling
operation. The following flags are currently supported:
HWRSCFLAGS_INTERPOLATE:
-
Use interpolated scaling. This is slower but will look much better. When used
with a pixel format that uses alpha channel transparency, the alpha channel
pixels will also be interpolated.
Note that this function does not do any clipping. You must make sure that the destination
raw pixel buffer is large enough.