//////////////////////////////////////
// START of File: CO1_CBMP.HPP
//////////////////////////////////////

#ifndef CO1_CBMP_HPP            // Avoid multiple includes...
#define CO1_CBMP_HPP    TRUE    // ...holds to a terminal #endif below...

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994, 1995, 1996, 1997 by DPC Technology.
// All rights reserved.
//
// See files "cf_copyr.txt" and "cf_licen.txt" for details of
// copyright and license specifications, and contact information.
//
//===================================================================

//
// Master Header File Listing:
//
// #include    <cf_api/co1_cbmp.hpp>
// Chart Framework "3D (Projected) Bitmap" object.
//

//--------------------------------------------------------------------
// Include Chart Framework class or ID defs/headers this file needs.
// Paths are relative to the IDE's (global) include path: ~/cfrz
//--------------------------------------------------------------------
class       cf_String;
#include    <cf_api/c0_dystr.hpp>

class       bf_Color;
#include    <cf_api/b0_color.hpp>

class       cf_2DRect;
class       cf_2DPoint;
#include    <cf_api/c0_dimen.hpp>

class       bf_Pen;
class       bf_Display;
#include    <cf_api/b0_dspla.hpp>

class       bf_2DBitmap;
class       bf_2DBitmapDisplay;
#include    <cf_api/b0_dsbmp.hpp>

class       cf_Kernel;
#include    <cf_api/c1_kernl.hpp>

class       cf_Virt3DObj;
#include    <cf_api/c1_vobj.hpp>

class       cf_3DPoint;
#include    <cf_api/co1_poin.hpp>

//
// Declare a Chart Framework "cf_3DBitmap" zApp class.
//
// Class cf_3DBitmap abstracts a geometrically transformable
// bitmap, and its associated display..
//
class CF_EXPORT   cf_3DBitmap

        : public cf_Virt3DObj

{

public:

    cf_3DBitmap( cf_Kernel  *p_cf_kUseThisKernel );

    virtual 	~cf_3DBitmap();	// virtual d-tor is critical for
    										// derived objects in framework

    void        setKernel( cf_Kernel *p_cf_kUseThisKernel );

    void        setBitmap( bf_2DBitmap *p_bf_2dbmpSource );

    BOOL        isFileSet();

    char*       sourceFileName();

    void        sourceFileName( const char *a_cFileNameString );

    void        draw3D( bf_Display *p_bf_dspOutputDisplay );

private:

    // ===================================================
    // Declare some PRIVATE member methods for this class:
    // ===================================================
    void    calcProjectedCornerPoints( bf_Display *p_bf_dspOutputDisplay );


    void    calcProjectedDeltaValuesAndIncrements();

    void    projectHorzBitmapLineTo(    cf_2DPoint  cf_2dpBitmapPointOne,
                                        cf_2DPoint  cf_2dpBitmapPointTwo,
                                        cf_2DPoint cf_2dpProjectedPointOne,
                                        cf_2DPoint cf_2dpProjectedPointTwo,
                                        bf_Display *p_bf_dspOutputDisplay );


    cf_Kernel           *p_cf_kChartBitmapKernel;

    cf_String           cf_strChartBitmapFile;
                        //
                        // Source file name to read to instantiate
                        // the bitmap and bitmap display vars below.
                        //

    bf_2DBitmap         *p_bf_bmpSourceBitmap;

    bf_2DBitmapDisplay  *p_bf_bdspBitmapBits;

    int                 iSourceWidth,
                        iSourceHeight;
                        //
                        // Original dimensions of the SOURCE bitmap.
                        //

    int             ipictChartBitmapWidth,
                    ipictChartBitmapHeight;
                    //
                    // We may stretch the dimensions of the
                    // pictChartBitmap bitmap even more if the view
                    // angle or the perspective are extreme.
                    //

    cf_2DRect       cf_2drCurrentDirtyRect;
                    //
                    // We'll need to determine the current area that
                    // needs to  be drawn, especially for print
                    // (i.e. banding) context drawing...
                    //

    cf_2DPoint  a_cf_2dpLeftWall[ 5 ];
                //
                // The SCREEN coords of the cf_3DBitmap, as
                // calculated by the calcProjectedCornerPoints() member
                // function (below), will be placed here for convenience.
                //
                // Note that we have 5 vertices, (we repeat the initial
                // vertex), so that we can use this array to render
                // either a polygon, OR a closed polyline.
                //

    int     iLeftEdgeDeltaY,
            iRightEdgeDeltaY,
            iLeftEdgeDeltaX,
            iRightEdgeDeltaX,
            iTopEdgeDeltaX,
            iBottomEdgeDeltaX;
            //
            // These "Delta" values are used to increment error-
            // accumulation vars in a midpoint formula line-draw
            // derived routine within the member function draw3D().
            //

    cf_2DPoint  cf_2dpYIncrement,
                cf_2dpLeftXIncrement,
                cf_2dpRightXIncrement;


};  //
    // End of cf_3DBitmap declaration.
    //

#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: CO1_CBMP.HPP
//////////////////////////////////////

