//***************************************************************************
//
// Copyright (C) Microsoft Corporation, 1998
//
// FileName:            DXTransP.idl
//
// Created:             11/11/98
//
// Author:              PaulNash
//
// Description:         Holds all PRIVATE (MSINTERNAL) DXTrans IDL code. Used
//                      by all internal DXTrans components and MSINTERNAL
//                      software components if necessary.  This is a SUPERSET
//                      of DXTrans.idl.
//
// 1998/11/11   PaulNash    Created.
// 2000/09/18   mcalkins    Separated out dispatch portion of IDXTFilter and
//                          moved it to dxtrans.idl.
// 2000/10/08   mcalkins    Redefined IDXTFilterCollection.
//
//***************************************************************************

import "dxtrans.idl";

//=== Forward References ====================================================
interface IDXRasterizer;
interface IDXTLabel;
interface IDX2D;
interface IDX2DDebug;
interface IDXTFilter;
interface IDXTFilterController;
interface IDXTFilterCollection;

//=== Interface definitions =================================================

//--- IDXRasterizer ---------------------------------------------
typedef enum DXRASTERFILL
{
    DXRASTER_PEN        = 0,
    DXRASTER_BRUSH      = 1,
    DXRASTER_BACKGROUND = 2
} DXRASTERFILL;

//
//  IDXRasterizer
//
typedef struct DXRASTERSCANINFO
{
    ULONG ulIndex;
    ULONG Row;
    const BYTE * pWeights;
    const DXRUNINFO *pRunInfo;
    ULONG cRunInfo;
} DXRASTERSCANINFO;

typedef struct DXRASTERPOINTINFO
{
    DXOVERSAMPLEDESC    Pixel;
    ULONG               ulIndex;
    BYTE                Weight;
} DXRASTERPOINTINFO;

typedef struct DXRASTERRECTINFO
{
    ULONG   ulIndex;
    RECT    Rect;
    BYTE    Weight;
} DXRASTERRECTINFO;

[
    local,
    uuid(9EA3B635-C37D-11d1-905E-00C04FD9189D),
    pointer_default(unique),
    hidden
]
interface IDXRasterizer : IUnknown
{ 
    HRESULT SetSurface([in] IDXSurface *pDXSurface);
    HRESULT GetSurface([out] IDXSurface ** ppDXSurface);
    HRESULT SetFill([in] ULONG ulIndex, [in] IDXSurface *pSurface, [in] const POINT *ppt, [in] DXSAMPLE FillColor);
    HRESULT GetFill([in] ULONG ulIndex, [out] IDXSurface **ppSurface, [out] POINT *ppt, [out] DXSAMPLE *pFillColor);
    HRESULT BeginRendering( [in]ULONG ulTimeOut );
    HRESULT EndRendering( void );
    HRESULT RenderScan([in] const DXRASTERSCANINFO *pScanInfo);
    HRESULT SetPixel([in] DXRASTERPOINTINFO *pPointInfo);
    HRESULT FillRect([in] const DXRASTERRECTINFO *pRectInfo);
    HRESULT GetBounds([out] DXBNDS *pBounds);
};



//
//--- XFORM structure redefined because it is not in the window .idl
typedef enum DX2DXFORMOPS
{
    DX2DXO_IDENTITY,
    DX2DXO_TRANSLATE,
    DX2DXO_SCALE,
    DX2DXO_SCALE_AND_TRANS,
    DX2DXO_GENERAL,
    DX2DXO_GENERAL_AND_TRANS,
} DX2DXFORMOPS;

typedef struct DX2DXFORM
{
    FLOAT   eM11;
    FLOAT   eM12;
    FLOAT   eM21;
    FLOAT   eM22;
    FLOAT   eDx;
    FLOAT   eDy;
    DX2DXFORMOPS eOp;
} DX2DXFORM, * PDX2DXFORM;

typedef enum DX2DPOLYDRAW
{
    DX2D_WINDING_FILL   = ( 1L << 0 ),     // alternate if not set
    DX2D_NO_FLATTEN     = ( 1L << 1 ),     // does flatten if not set
    DX2D_DO_GRID_FIT    = ( 1L << 2 ),     // no grid fitting performed if not set
    DX2D_IS_RECT        = ( 1L << 3 ),     // treated as generalized shape if not set
    DX2D_STROKE         = ( 1L << 4 ),     // The shape will be stroked
    DX2D_FILL           = ( 1L << 5 ),     // The shape will be filled
    DX2D_UNUSED         = 0xFFFFFFC0
} DX2DPOLYDRAW;

typedef struct DXFPOINT
{
    FLOAT x;
    FLOAT y;
} DXFPOINT;

typedef enum DX2DPEN
{
    DX2D_PEN_DEFAULT                 = ( 0       ),
    DX2D_PEN_WIDTH_IN_DISPLAY_COORDS = ( 1L << 0 ),     // by default; the world-transform
                                                        // applies to the pen-width for
                                                        // geometric lines
    DX2D_PEN_UNUSED         = 0xFFFFFFFE
} DX2DPEN;

typedef struct DXPEN
{
    DXSAMPLE    Color;
    float       Width;                  // 0 = cosmetic
    DWORD       Style;                  // PS_XXX
    IDXSurface* pTexture;
    DXFPOINT    TexturePos;
    DWORD       dwFlags;                // See DX2D_PEN_xxx
} DXPEN;

typedef struct DXBRUSH
{
    DXSAMPLE    Color;
    IDXSurface* pTexture;
    DXFPOINT    TexturePos;
} DXBRUSH;

typedef enum DX2DGRADIENT
{
    DX2DGRAD_DEFAULT            = 0,
    DX2DGRAD_CLIPGRADIENT       = 1,          // Don't render outside offsets for gradient
    DX2DGRAD_UNUSED             = 0xFFFFFFFE
} DX2DGRADIENT;

//--- LOGFONT identifiers
typedef enum DXLOGFONTENUM
{
    DXLF_HEIGHT = 1,
    DXLF_WIDTH = 2,
    DXLF_ESC = 4,
    DXLF_ORIENTATION = 8,
    DXLF_WEIGHT = 16,
    DXLF_ITALIC = 32,
    DXLF_UNDERLINE = 64,
    DXLF_STRIKEOUT = 128,
    DXLF_CHARSET = 256,
    DXLF_OUTPREC = 512,
    DXLF_CLIPPREC = 1024,
    DXLF_QUALITY = 2048,
    DXLF_PITCHANDFAM = 4096,
    DXLF_FACENAME = 8192,
    DXLF_ALL = 0x00003fff
} DXLOGFONTENUM;

/* Logical Font */
#define LF_FACESIZE         32

cpp_quote( "#ifndef _WINGDI_")
typedef struct tagLOGFONTA
{
    LONG      lfHeight;
    LONG      lfWidth;
    LONG      lfEscapement;
    LONG      lfOrientation;
    LONG      lfWeight;
    BYTE      lfItalic;
    BYTE      lfUnderline;
    BYTE      lfStrikeOut;
    BYTE      lfCharSet;
    BYTE      lfOutPrecision;
    BYTE      lfClipPrecision;
    BYTE      lfQuality;
    BYTE      lfPitchAndFamily;
    CHAR      lfFaceName[LF_FACESIZE];
} LOGFONTA;
typedef struct tagLOGFONTW
{
    LONG      lfHeight;
    LONG      lfWidth;
    LONG      lfEscapement;
    LONG      lfOrientation;
    LONG      lfWeight;
    BYTE      lfItalic;
    BYTE      lfUnderline;
    BYTE      lfStrikeOut;
    BYTE      lfCharSet;
    BYTE      lfOutPrecision;
    BYTE      lfClipPrecision;
    BYTE      lfQuality;
    BYTE      lfPitchAndFamily;
    WCHAR     lfFaceName[LF_FACESIZE];
} LOGFONTW;
#ifdef UNICODE
typedef LOGFONTW LOGFONT;
#else
typedef LOGFONTA LOGFONT;
#endif // UNICODE
cpp_quote( "#endif")

//--- IDXTLabel -------------------------------------------------
//
// This is the v-table only label transform interface
[
    uuid(C0C17F0E-AE41-11d1-9A3B-0000F8756A10),
    pointer_default(unique),
    hidden
]
interface IDXTLabel : IUnknown
{
    HRESULT SetFontHandle([in] HFONT hFont);
    HRESULT GetFontHandle([out] HFONT *phFont);
    HRESULT SetTextString([in] LPCWSTR pString);
    HRESULT GetTextString([out] LPWSTR *ppString);
    HRESULT GetFillColor([out] DXSAMPLE *pVal);
    HRESULT SetFillColor([in] DXSAMPLE newVal);
    HRESULT GetBackgroundColor([out] DXSAMPLE *pVal);
    HRESULT SetBackgroundColor([in] DXSAMPLE newVal);
    HRESULT GetTexturePosition( [out]long *px, [out]long *py);
    HRESULT SetTexturePosition( [in]long x, [in]long y);
    HRESULT GetMatrix([out] PDX2DXFORM pXform);
    HRESULT SetMatrix([in] const PDX2DXFORM pXform);
    HRESULT SetLogfont([in] const LOGFONT *plf, [in]DWORD dwFlags);
    HRESULT GetLogfont([out] LOGFONT *plf, [in]DWORD dwFlags);
    HRESULT ExecuteWithRasterizer([in] IDXRasterizer *pRasterizer, [in]const DXBNDS *pClipBnds,
                                  [in] const DXVEC *pPlacement);
    HRESULT GetBaselineOffset([out] long *px, [out] long *py, [out] long *pdx, [out] long *pdy);
};

//--- IDX2D -----------------------------------

[
    local,
    uuid(03BB2457-A279-11d1-81C6-0000F87557DB),
    pointer_default(unique),
    hidden
]
interface IDX2DDebug : IUnknown
{
    HRESULT SetDC( HDC   hDC );
    HRESULT GetDC( HDC* phDC );
};

[
    local,
    uuid(9EFD02A9-A996-11d1-81C9-0000F87557DB),
    pointer_default(unique),
    hidden
]
interface IDX2D : IUnknown
{
    //--- Setup
    HRESULT SetTransformFactory( IDXTransformFactory * pTransFact );
    HRESULT GetTransformFactory( IDXTransformFactory** ppTransFact );
    HRESULT SetSurface( IUnknown* pSurface );
    HRESULT GetSurface( REFIID riid, void** ppSurface );

    //--- Attributes
    HRESULT SetClipRect( RECT* pClipRect );
    HRESULT GetClipRect( RECT* pClipRect );
    HRESULT SetWorldTransform( const DX2DXFORM* pXform );
    HRESULT GetWorldTransform( DX2DXFORM* pXform );
    HRESULT SetPen( const DXPEN* pPen );
    HRESULT GetPen( DXPEN* pPen );
    HRESULT SetBrush( const DXBRUSH* pBrush );
    HRESULT GetBrush( DXBRUSH* pBrush );
    HRESULT SetBackgroundBrush( const DXBRUSH* pBrush );
    HRESULT GetBackgroundBrush( DXBRUSH* pBrush );
    HRESULT SetFont( HFONT hFont );
    HRESULT GetFont( HFONT* phFont );

    //--- Blitting
    HRESULT Blt( IUnknown* punkSrc, const RECT* pSrcRect, const POINT* pDest );

    //--- Drawing functions
    HRESULT AAPolyDraw( const DXFPOINT* pPos, const BYTE* pTypes, ULONG ulCount,
                        ULONG SubSampRes, DWORD dwFlags );
    HRESULT AAText( DXFPOINT Pos, LPWSTR pString, ULONG ulCount, DWORD dwFlags );

    //--- Gradient functions
    HRESULT SetRadialGradientBrush( 
            [in, size_is(ulCount)] double* rgdblOffsets, 
            [in, size_is(ulCount*3)] double* rgdblColors, 
            [in] ULONG ulCount, 
            [in] double dblOpacity, 
            [in] DX2DXFORM *pXform, 
            [in] DWORD dwFlags );

    HRESULT SetLinearGradientBrush( 
            [in, size_is(ulCount)] double* rgdblOffsets, 
            [in, size_is(ulCount*3)] double* rgdblColors, 
            [in] ULONG ulCount, 
            [in] double dblOpacity, 
            [in] DX2DXFORM *pXform, 
            [in] DWORD dwFlags );

}


//+-----------------------------------------------------------------------------
//
//  IDXTFilterCollection Interface
//
//  Overview:
//      Extended gradient.
//
//------------------------------------------------------------------------------

    [
        uuid(d0ef2a80-61dc-11d2-b2eb-00a0c936b212),
        helpstring("IDXGradient2 Interface"),
        pointer_default(unique)
    ]
    interface IDXGradient2 : IDXGradient
    {
        HRESULT SetRadialGradient( 
                [in, size_is(ulCount)] double* rgdblOffsets, 
                [in, size_is(ulCount*3)] double* rgdblColors, 
                [in] ULONG ulCount, 
                [in] double dblOpacity, 
                [in] DX2DXFORM *pXform, 
                [in] DWORD dwFlags );

        HRESULT SetLinearGradient( 
                [in, size_is(ulCount)] double* rgdblOffsets, 
                [in, size_is(ulCount*3)] double* rgdblColors, 
                [in] ULONG ulCount, 
                [in] double dblOpacity, 
                [in] DX2DXFORM *pXform, 
                [in] DWORD dwFlags );
    };


//+-----------------------------------------------------------------------------
//
//  DXTFILTERCAPS enum
//
//------------------------------------------------------------------------------

    typedef enum DXTFILTERCAPS
    {
        DXTFILTERCAPS_IDXSURFACE    = (1L << 0),
        DXTFILTERCAPS_IDXEFFECT     = (1L << 1),
        DXTFILTERCAPS_INPUT1REQ     = (1L << 2),
        DXTFILTERCAPS_INPUT2REQ     = (1L << 3),
        DXTFILTERCAPS_INPUT1OPT     = (1L << 4),
        DXTFILTERCAPS_INPUT2OPT     = (1L << 5),
        DXTFILTERCAPS_PRIV_MATRIX   = (1L << 6),
        DXTFILTERCAPS_MAX           = (1L << 7)
    } DXTFILTERCAPS;

	
//+-----------------------------------------------------------------------------
//
//  IDXTFilterBehavior Interface
//
//------------------------------------------------------------------------------

    typedef void * HFILTER;

    typedef enum DXT_FILTER_TYPE_FLAGS {

        DXTFTF_INVALID      = 0,

        // Modifier Flags (bits  0..15 available)

        DXTFTF_CSS          = (1L <<  0),
        DXTFTF_PRIVATE      = (1L <<  1),
        DXTFTF_ALLMODIFIERS = (DXTFTF_CSS | DXTFTF_PRIVATE),

        // Type Flags     (bits 16..31 available)
        // One and only one required.

        DXTFTF_SURFACE      = (1L << 16),
        DXTFTF_ZEROINPUT    = (1L << 17),
        DXTFTF_FILTER       = (1L << 18),
        DXTFTF_ALLTYPES     = (  DXTFTF_SURFACE | DXTFTF_ZEROINPUT 
                               | DXTFTF_FILTER)

    } DXT_FILTER_TYPE_FLAGS;

    [
        object,
        uuid(14D7DDDD-ACA2-4E45-9504-3808ABEB4F92),
        helpstring("IDXTFilterBehavior Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTFilterBehavior : IUnknown
    {
        HRESULT Initialize(IDXTransformFactory * pDXTransformFactory);
        HRESULT GetFilterCollection(IDXTFilterCollection ** ppDXTFilterCollection);
        HRESULT LockFilterChainForEdit(DWORD * pdwKey);
        HRESULT AddFilterFromBSTR(const BSTR        bstrFilterString,
                                  const DWORD       dwFlags,
                                  DWORD * const     pdwFilterType,
                                  HFILTER * const   phFilter);
        HRESULT DestroyFilter(HFILTER hFilter);
        HRESULT UnlockFilterChain(DWORD dwKey);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTFilterBehaviorSite Interface
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(909B23C2-9018-499f-A86D-4E7DA937E931),
        helpstring("IDXTFilterBehaviorSite Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTFilterBehaviorSite : IUnknown
    {
        HRESULT InvalidateElement(BOOL fInvalidateSize);
        HRESULT InvalidateFilterChain();
        HRESULT ExecuteFilterChain();
        HRESULT FireOnFilterChangeEvent();
        HRESULT OnFilterChangeStatus(DXTFILTER_STATUS eStatusOld, DXTFILTER_STATUS eStatusNew);
        void    OnFatalError(HRESULT hrFatalError);
        HRESULT GetTimer(void **ppvTimer);
        HRESULT EnsureView();
    };


//+-----------------------------------------------------------------------------
//
//  IDXTFilterCollection Interface
//
//------------------------------------------------------------------------------

    [ 
        object,
        uuid(22B07B33-8BFB-49d4-9B90-0938370C9019),
        helpstring("IDXTFilterCollection Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTFilterCollection : IUnknown
    {
        HRESULT Init(const IDXTFilterBehavior * pDXTFilterBehavior);
        HRESULT AddFilter(const BSTR        bstrFilterString,
                          const DWORD       dwFlags,
                          DWORD * const     pdwFilterType,
                          HFILTER * const   phFilter);
        HRESULT RemoveFilter(const HFILTER hFilter);
        HRESULT RemoveFilters(const DWORD dwFlags);
        HRESULT GetFilterController(const HFILTER hFilter,
                                    IDXTFilterController ** const ppDXTFilterController);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTFilter Interface
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(6187E5A2-A445-4608-8FC0-BE7A6C8DB386),
        helpstring("IDXTFilter Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTFilter : IUnknown
    {
        HRESULT Initialize([in] IDXTransform *           pDXTransform, 
                           [in] IDXSurfaceFactory *      pDXSurfaceFactory,
                           [in] IDXTFilterBehaviorSite * pDXTFilterBehaviorSite,
                           [in] DWORD                    dwFilterCaps,
                           [in] BOOL                     fUsesOldStyleFilterName);
        HRESULT SetInputSurface([in] IDXSurface * pDXSurface);
        HRESULT SetOutputSurface([in] IDXSurface * pDXSurface);
        HRESULT GetOutputSurface([out] IDXSurface ** ppDXSurface);
        HRESULT MapBoundsIn2Out([in] DXBNDS * pbndsIn, 
                                [in, out] DXBNDS * pbndsOut,
                                [in] BOOL fResetOutputSize);
        HRESULT MapBoundsOut2In([in] DXBNDS * pbndsOut,
                                [in, out] DXBNDS * pbndsIn);
        HRESULT Execute([in] DXBNDS * pbndsPortion,
                        [in] DXVEC * pvecPlacement,
                        [in] BOOL fFireFilterChange);
        HRESULT SetMiscFlags([in] DWORD dwMiscFlags);
        HRESULT HitTest([in] const DXVEC * pvecOut,
                        [in, out] BOOL * pfInactiveInputHit,
                        [in, out] DXVEC * pvecIn);
        HRESULT Detach();
        BOOL    IsEnabled();
        void    HardDisable(HRESULT hrHardDisable);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTFilterController Interface
//
//  This interface was created so that external objects could controll the 
//  filter object without using the dispatch interface.  It provides enhanced
//  functionality, especially for our implementation of the SMIL Transitions
//  specification.
//
//------------------------------------------------------------------------------

    typedef enum DXT_QUICK_APPLY_TYPE
    {
        DXTQAT_TransitionIn = 0,
        DXTQAT_TransitionOut,
        DXTQAT_TransitionFromElement,
        DXTQAT_TransitionToElement
    } DXT_QUICK_APPLY_TYPE;

    [
        object,
        uuid(5CF315F2-273D-47B6-B9ED-F75DC3B0150B),
        helpstring("IDXTFilterController Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTFilterController : IUnknown
    {
        HRESULT SetProgress(float flProgress);
        HRESULT SetEnabled(BOOL fEnabled);
        HRESULT SetFilterControlsVisibility(BOOL fFilterControlsVisibility);
        HRESULT QuickApply(DXT_QUICK_APPLY_TYPE dxtqat, IUnknown * punkInput);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTRedirectFilterInit Interface
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(D1A57094-21F7-4e6c-93E5-F5F77F748293),
        helpstring("IDXTRedirectFilterInit Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTRedirectFilterInit : IUnknown
    {
        HRESULT SetHTMLPaintSite(void * pvHTMLPaintSite);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTClipOrigin Interface
//
//  This interface is implemented by DXTransforms that provide the functionality
//  of IE5.0 filters and transitions.  If an "old name" is used and this
//  interface is supported, the filter behavior will call GetClipOrigin to find
//  the point on the output of the transform best correlates to the origin of 
//  the clipped output of the filter.
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(EE1663D8-0988-4C48-9FD6-DB4450885668),
        helpstring("IDXTClipOrigin Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTClipOrigin : IUnknown
    {
        HRESULT GetClipOrigin(DXVEC * pvecClipOrigin);
    };


//=== CoClass definitions =================================================

    // NOTE: helpstring below is exactly the same as the name given in
    //       DXTRANS.IDL.  This is because DXTRANS.DLL actually links to
    //       DXTRANSP -- the private version. However, we don't want the
    //       helpstring to *tell* people that there's a private version, so
    //       we make it look like the other one. Nevermind that there are
    //       actually extra things in the private typelib.
[
    uuid(527A4DA4-7F2C-11d2-B12D-0000F81F5995),
    version(1.0),
    helpstring("Microsoft DirectX Transform 1.0 Type Library")
]
library DXTRANSPLib
{
    importlib("stdole2.tlb");
    importlib("dxtrans.tlb");


    ///////////////////////////////
    // Label CoClass
    ///////////////////////////////
    [
	uuid(54702535-2606-11D1-999C-0000F8756A10),
        hidden
    ]
    coclass DXTLabel
    {
        [default] interface IDXTLabel;
    };


    ///////////////////////////////
    // DXRasterizer CoClass
    ///////////////////////////////
    [
	uuid(8652CE55-9E80-11D1-9053-00C04FD9189D),
	helpstring("DXRasterizer Class")
    ]
    coclass DXRasterizer
    {
        [default] interface IDXRasterizer;
    };


    ///////////////////////////////
    // DX2D CoClass
    ///////////////////////////////
    [
	uuid(473AA80B-4577-11D1-81A8-0000F87557DB),
        hidden
    ]
    coclass DX2D
    {
        [default] interface IDX2D;
    };


    ///////////////////////////////
    // DXTFilterBehavior CoClass
    ///////////////////////////////
    [
        uuid(649EEC1E-B579-4E8C-BB3B-4997F8426536),
        helpstring("DXTFilterBehavior Class")
    ]
    coclass DXTFilterBehavior
    {
        [default] interface IDXTFilterBehavior;
    };


    ///////////////////////////////
    // DXTFilterFactory CoClass
    ///////////////////////////////
    [
        uuid(81397204-F51A-4571-8D7B-DC030521AABD),
        helpstring("DXTFilterFactory Class")
    ]
    coclass DXTFilterFactory
    {
        [default] interface IUnknown;
    };


    ///////////////////////////////
    // DXTFilterCollection CoClass
    ///////////////////////////////
    [
        uuid(A7EE7F34-3BD1-427f-9231-F941E9B7E1FE),
        helpstring("DXTFilterCollection Class")
    ]
    coclass DXTFilterCollection
    {
        [default] interface IDispatch;
    };
};

