⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmpdata.h

📁 WDK 自带的xpsdrv filter之 color
💻 H
📖 第 1 页 / 共 2 页
字号:

    None

--*/
inline VOID
ConvertCopy(
    __out WORD& dst,
    __in  BYTE  src
    )
{
    dst = (src << 8) | src;
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts WORD to WORD

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out WORD& dst,
    __in  WORD  src
    )
{
    dst = src;
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts FLOAT to WORD

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out WORD& dst,
    __in  FLOAT src
    )
{
    if (src < 0.0f)
    {
        dst = 0x0000;
    }
    else if (src > 1.0f)
    {
        dst = 0xFFFF;
    }
    else
    {
        dst = static_cast<WORD>(src * kMaxWordAsFloat);
    }
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts S2DOT13FIXED to WORD

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out WORD&        dst,
    __in  S2DOT13FIXED src
    )
{
    if (src.val & kS2Dot13Neg)
    {
        dst = 0x0000;
    }
    else if (src.val > kS2Dot13One)
    {
        dst = 0xFFFF;
    }
    else
    {
        dst = static_cast<BYTE>(MulDiv(src.val, 0xFFFF, kS2Dot13One));
    }
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts BYTE to FLOAT

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out FLOAT& dst,
    __in  BYTE   src
    )
{
    dst = src/kMaxByteAsFloat;
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts WORD to FLOAT

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out FLOAT& dst,
    __in  WORD   src
    )
{
    dst = src/kMaxWordAsFloat;
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts FLOAT to FLOAT

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out FLOAT& dst,
    __in  FLOAT  src
    )
{
    dst = src;
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts S2DOT13FIXED to FLOAT

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out FLOAT&       dst,
    __in  S2DOT13FIXED src
    )
{
    if (src.val & kS2Dot13Neg)
    {
        dst = -static_cast<FLOAT>(src.val^kS2Dot13Neg)/kS2Dot13One;
    }
    else
    {
        dst = static_cast<FLOAT>(src.val)/kS2Dot13One;
    }
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts BYTE to S2DOT13FIXED

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out S2DOT13FIXED& dst,
    __in  BYTE          src
    )
{
    dst.val = static_cast<WORD>(MulDiv(kS2Dot13One, src, 0xFF));
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts WORD to S2DOT13FIXED

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out S2DOT13FIXED& dst,
    __in  WORD          src
    )
{
    dst.val = static_cast<WORD>(MulDiv(kS2Dot13One, src, 0xFFFF));
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts FLOAT to S2DOT13FIXED

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out S2DOT13FIXED& dst,
    __in  FLOAT         src
    )
{
    if (src < -4.0f)
    {
        dst.val = kS2Dot13Min;
    }
    else if (src > 4.0f)
    {
        dst.val = kS2Dot13Max;
    }
    else
    {
        dst.val = static_cast<WORD>(src * kS2Dot13One);
    }
}

/*++

Routine Name:

    ConvertCopy

Routine Description:

    Inline function that converts a src channel data type to a destination
    of another type. This overload converts S2DOT13FIXED to S2DOT13FIXED

Arguments:

    dst - Destination value to be set
    src - Source value

Return Value:

    None

--*/
inline VOID
ConvertCopy(
    __out S2DOT13FIXED& dst,
    __in  S2DOT13FIXED  src
    )
{
    dst = src;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -