/*
 ============================================================================
 xoblite -> an alternative shell based on Blackbox for Windows
 Copyright © 2002-2005 Karl-Henrik Henriksson [qwilk]
 Copyright © 2001-2004 The Blackbox for Windows Development Team
 http://xoblite.net/ - #bb4win on irc.freenode.net
 ============================================================================

  Blackbox for Windows is free software, released under the
  GNU General Public License (GPL version 2 or later), with an extension
  that allows linking of proprietary modules under a controlled interface.
  What this means is that plugins etc. are allowed to be released
  under any license the author wishes. Please note, however, that the
  original Blackbox gradient math code used in Blackbox for Windows
  is available under the BSD license.

  http://www.fsf.org/licenses/gpl.html
  http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
  http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5

  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.

  For additional license information, please read the included license.html

 ============================================================================
*/

#ifndef __BIMAGE_H 
#define __BIMAGE_H 

#include "BBApi.h" 
#include <windows.h> 

//===========================================================================

class BImage
{
public:
    BImage();
    ~BImage();

        void CreateBorder(HDC hdc, RECT rect, COLORREF borderColour, int borderWidth);
        void CreateGradientByRect(HDC hdc, RECT rect, int type, COLORREF colour1, COLORREF colour2, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth);

        //====================

private:

        void CreateBuffer(HDC hdc, RECT rect, COLORREF colour1, COLORREF colour2);
        void DestroyBuffer();
        void PaintGradient(int type, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth);

        void bevel1(bool sunken);
        void bevel2(bool sunken);
        void lightenpixel(unsigned int count);
        void darkenpixel(unsigned int count);

        void dgradient(void);
        void hgradient(void);
        void vgradient(void);
        void pgradient(void);
        void rgradient(void);
        void egradient(void);
        void pcgradient(void);
        void cdgradient(void);

        //====================

        unsigned int width;
        unsigned int height;

        HDC buf;
        HBITMAP bufbmp;
        HBITMAP oldbuf;

        PBYTE pixels;

        BYTE from_red;
        BYTE from_green;
        BYTE from_blue;
        BYTE to_red;
        BYTE to_green;
        BYTE to_blue;

        unsigned char* red;
        unsigned char* green;
        unsigned char* blue;
        unsigned int* xtable;
        unsigned int* ytable;

        bool interlaced;
        bool sunken;

        //====================

        BYTE r, g, b, rr ,gg ,bb;
};

//===========================================================================

static unsigned long bsqrt(unsigned long x);
unsigned long getSqrt(unsigned int x);

//===========================================================================

#endif /* __BIMAGE_H */ 





syntax highlighting by

w e b c p p
web c plus plus