canvas_imp.h 2.76 KB
/**
 * \file canvas_imp.h
 *
 * \brief ein Prototyp einer Canvas Implementation
 *
 * Die Canvas Implementation dient Hauptsächlich dazu color,
 * light und fogtables passend zum canvas zur verfügung zu stellen.
 * Es werden auch Methoden bereit gestellt, über die man externe
 * Farbdefinitionen (z.B. für jeweils rot, grün und blau
 * Werte zwischen 0 und 255) in das von dem canvas benutzte Farbschema
 * zu convertieren.
 *
 * \author Georg Steffers <georg@steffers.org> [gs]
 *
 * \date 04.12.2003
 *
 * \version ..2002 [gs]: erste funktionierende Implementation
 * \version 22.12.2003 [gs]: <ul><li>
 *                           beginn der Dokumentation via doxygen
 *                           </li><li>
 *                           Light und Fogtables hinzugef&uuml;gt
 *                           </li></ul>
 */

/* 
 * Copyright (C)2003 Georg Steffers
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __canvas_imp_h__
#define __canvas_imp_h__

#define MAX_LIGHT_LEVELS 255
#define NUM_LIGHT_LEVELS (MAX_LIGHT_LEVELS+1)

#define MAX_FOG_LEVELS        255
#define NUM_FOG_LEVELS        (MAX_FOG_LEVELS + 1)

class canvas;
class rasterizer;

class canvas_imp {
    friend class canvas;
    friend class rasterizer;

    protected:
        unsigned ext_max_red;
        unsigned ext_max_green;
        unsigned ext_max_blue;

        virtual void compute_light_table(void)=0;
        virtual void compute_fog_table(void)=0;

    public:
        virtual unsigned long ext_to_native(unsigned red,
                                            unsigned green,
                                            unsigned blue)=0;
        virtual ~canvas_imp() {};

        // virtual void light_to_native(unsigned char* pcolor,
        //                              int intensity)=0;
        // virtual void fog_to_native(unsigned char* pcolor,
        //                            int intensity)=0;

        virtual void set_color(unsigned long col) {};

        virtual void light_native(unsigned long* col, unsigned intense) = 0;

        unsigned char* p_screenbuf;
        char bytes_per_pixel;
};

#endif // __canvas_imp_h__