// @(#)root/qt:$Name:  $:$Id: TQtBrush.cxx,v 1.5 2005/07/13 20:10:12 brun Exp $
// Author: Valeri Fine   21/01/2002

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * Copyright (C) 2002 by Valeri Fine.                                    *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


/////////////////////////////////////////////////////////////////////////////////
//
// TQtBrush creates the QBrush Qt object based on the ROOT "TAttFill" attributes 
//
/////////////////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <stdlib.h>

#include "TQtBrush.h"
#include "qbitmap.h"

//
//*-*- data to create fill area interior style
//

static uchar p1_bits[] = {
  (0xaa),(0xaa),(0x55),(0x55),(0xaa),(0xaa),(0x55),(0x55),(0xaa),(0xaa),(0x55),(0x55),
  (0xaa),(0xaa),(0x55),(0x55),(0xaa),(0xaa),(0x55),(0x55),(0xaa),(0xaa),(0x55),(0x55),
  (0xaa),(0xaa),(0x55),(0x55),(0xaa),(0xaa),(0x55),(0x55)};
static uchar p2_bits[] = {
  (0x44),(0x44),(0x11),(0x11),(0x44),(0x44),(0x11),(0x11),(0x44),(0x44),(0x11),(0x11),
  (0x44),(0x44),(0x11),(0x11),(0x44),(0x44),(0x11),(0x11),(0x44),(0x44),(0x11),(0x11),
  (0x44),(0x44),(0x11),(0x11),(0x44),(0x44),(0x11),(0x11)};
static uchar p3_bits[] = {
  (0x00),(0x00),(0x44),(0x44),(0x00),(0x00),(0x11),(0x11),(0x00),(0x00),(0x44),(0x44),
  (0x00),(0x00),(0x11),(0x11),(0x00),(0x00),(0x44),(0x44),(0x00),(0x00),(0x11),(0x11),
  (0x00),(0x00),(0x44),(0x44),(0x00),(0x00),(0x11),(0x11)};
static uchar p4_bits[] = {
  (0x80),(0x80),(0x40),(0x40),(0x20),(0x20),(0x10),(0x10),(0x08),(0x08),(0x04),(0x04),
  (0x02),(0x02),(0x01),(0x01),(0x80),(0x80),(0x40),(0x40),(0x20),(0x20),(0x10),(0x10),
  (0x08),(0x08),(0x04),(0x04),(0x02),(0x02),(0x01),(0x01)};
static uchar p5_bits[] = {
  (0x20),(0x20),(0x40),(0x40),(0x80),(0x80),(0x01),(0x01),(0x02),(0x02),(0x04),(0x04),
  (0x08),(0x08),(0x10),(0x10),(0x20),(0x20),(0x40),(0x40),(0x80),(0x80),(0x01),(0x01),
  (0x02),(0x02),(0x04),(0x04),(0x08),(0x08),(0x10),(0x10)};
static uchar p6_bits[] = {
  (0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),
  (0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),
  (0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44)};
static uchar p7_bits[] = {
  (0x00),(0x00),(0x00),(0x00),(0x00),(0x00),(0xff),(0xff),(0x00),(0x00),(0x00),(0x00),
  (0x00),(0x00),(0xff),(0xff),(0x00),(0x00),(0x00),(0x00),(0x00),(0x00),(0xff),(0xff),
  (0x00),(0x00),(0x00),(0x00),(0x00),(0x00),(0xff),(0xff)};
static uchar p8_bits[] = {
  (0x11),(0x11),(0xb8),(0xb8),(0x7c),(0x7c),(0x3a),(0x3a),(0x11),(0x11),(0xa3),(0xa3),
  (0xc7),(0xc7),(0x8b),(0x8b),(0x11),(0x11),(0xb8),(0xb8),(0x7c),(0x7c),(0x3a),(0x3a),
  (0x11),(0x11),(0xa3),(0xa3),(0xc7),(0xc7),(0x8b),(0x8b)};
static uchar p9_bits[] = {
  (0x10),(0x10),(0x10),(0x10),(0x28),(0x28),(0xc7),(0xc7),(0x01),(0x01),(0x01),(0x01),
  (0x82),(0x82),(0x7c),(0x7c),(0x10),(0x10),(0x10),(0x10),(0x28),(0x28),(0xc7),(0xc7),
  (0x01),(0x01),(0x01),(0x01),(0x82),(0x82),(0x7c),(0x7c)};
static uchar p10_bits[] = {
  (0x10),(0x10),(0x10),(0x10),(0x10),(0x10),(0xff),(0xff),(0x01),(0x01),(0x01),(0x01),
  (0x01),(0x01),(0xff),(0xff),(0x10),(0x10),(0x10),(0x10),(0x10),(0x10),(0xff),(0xff),
  (0x01),(0x01),(0x01),(0x01),(0x01),(0x01),(0xff),(0xff)};
static uchar p11_bits[] = {
  (0x08),(0x08),(0x49),(0x49),(0x2a),(0x2a),(0x1c),(0x1c),(0x2a),(0x2a),(0x49),(0x49),
  (0x08),(0x08),(0x00),(0x00),(0x80),(0x80),(0x94),(0x94),(0xa2),(0xa2),(0xc1),(0xc1),
  (0xa2),(0xa2),(0x94),(0x94),(0x80),(0x80),(0x00),(0x00)};
static uchar p12_bits[] = {
  (0x1c),(0x1c),(0x22),(0x22),(0x41),(0x41),(0x41),(0x41),(0x41),(0x41),(0x22),(0x22),
  (0x1c),(0x1c),(0x00),(0x00),(0xc1),(0xc1),(0x22),(0x22),(0x14),(0x14),(0x14),(0x14),
  (0x14),(0x14),(0x22),(0x22),(0xc1),(0xc1),(0x00),(0x00)};
static uchar p13_bits[] = {
  (0x01),(0x01),(0x82),(0x82),(0x44),(0x44),(0x28),(0x28),(0x10),(0x10),(0x28),(0x28),
  (0x44),(0x44),(0x82),(0x82),(0x01),(0x01),(0x82),(0x82),(0x44),(0x44),(0x28),(0x28),
  (0x10),(0x10),(0x28),(0x28),(0x44),(0x44),(0x82),(0x82)};
static uchar p14_bits[] = {
  (0xff),(0xff),(0x11),(0x10),(0x11),(0x10),(0x11),(0x10),(0xf1),(0x1f),(0x11),(0x11),
  (0x11),(0x11),(0x11),(0x11),(0xff),(0x11),(0x01),(0x11),(0x01),(0x11),(0x01),(0x11),
  (0xff),(0xff),(0x01),(0x10),(0x01),(0x10),(0x01),(0x10)};
static uchar p15_bits[] = {
  (0x22),(0x22),(0x55),(0x55),(0x22),(0x22),(0x00),(0x00),(0x88),(0x88),(0x55),(0x55),
  (0x88),(0x88),(0x00),(0x00),(0x22),(0x22),(0x55),(0x55),(0x22),(0x22),(0x00),(0x00),
  (0x88),(0x88),(0x55),(0x55),(0x88),(0x88),(0x00),(0x00)};
static uchar p16_bits[] = {
  (0x0e),(0x0e),(0x11),(0x11),(0xe0),(0xe0),(0x00),(0x00),(0x0e),(0x0e),(0x11),(0x11),
  (0xe0),(0xe0),(0x00),(0x00),(0x0e),(0x0e),(0x11),(0x11),(0xe0),(0xe0),(0x00),(0x00),
  (0x0e),(0x0e),(0x11),(0x11),(0xe0),(0xe0),(0x00),(0x00)};
static uchar p17_bits[] = {
  (0x44),(0x44),(0x22),(0x22),(0x11),(0x11),(0x00),(0x00),(0x44),(0x44),(0x22),(0x22),
  (0x11),(0x11),(0x00),(0x00),(0x44),(0x44),(0x22),(0x22),(0x11),(0x11),(0x00),(0x00),
  (0x44),(0x44),(0x22),(0x22),(0x11),(0x11),(0x00),(0x00)};
static uchar p18_bits[] = {
  (0x11),(0x11),(0x22),(0x22),(0x44),(0x44),(0x00),(0x00),(0x11),(0x11),(0x22),(0x22),
  (0x44),(0x44),(0x00),(0x00),(0x11),(0x11),(0x22),(0x22),(0x44),(0x44),(0x00),(0x00),
  (0x11),(0x11),(0x22),(0x22),(0x44),(0x44),(0x00),(0x00)};
static uchar p19_bits[] = {
  (0xe0),(0x03),(0x98),(0x0c),(0x84),(0x10),(0x42),(0x21),(0x42),(0x21),(0x21),(0x42),
  (0x19),(0x4c),(0x07),(0xf0),(0x19),(0x4c),(0x21),(0x42),(0x42),(0x21),(0x42),(0x21),
  (0x84),(0x10),(0x98),(0x0c),(0xe0),(0x03),(0x80),(0x00)};
static uchar p20_bits[] = {
  (0x22),(0x22),(0x11),(0x11),(0x11),(0x11),(0x11),(0x11),(0x22),(0x22),(0x44),(0x44),
  (0x44),(0x44),(0x44),(0x44),(0x22),(0x22),(0x11),(0x11),(0x11),(0x11),(0x11),(0x11),
  (0x22),(0x22),(0x44),(0x44),(0x44),(0x44),(0x44),(0x44)};
static uchar p21_bits[] = {
  (0xf1),(0xf1),(0x10),(0x10),(0x10),(0x10),(0x10),(0x10),(0x1f),(0x1f),(0x01),(0x01),
  (0x01),(0x01),(0x01),(0x01),(0xf1),(0xf1),(0x10),(0x10),(0x10),(0x10),(0x10),(0x10),
  (0x1f),(0x1f),(0x01),(0x01),(0x01),(0x01),(0x01),(0x01)};
static uchar p22_bits[] = {
  (0x8f),(0x8f),(0x08),(0x08),(0x08),(0x08),(0x08),(0x08),(0xf8),(0xf8),(0x80),(0x80),
  (0x80),(0x80),(0x80),(0x80),(0x8f),(0x8f),(0x08),(0x08),(0x08),(0x08),(0x08),(0x08),
  (0xf8),(0xf8),(0x80),(0x80),(0x80),(0x80),(0x80),(0x80)};
static uchar p23_bits[] = {
  (0xAA),(0xAA),(0x55),(0x55),(0x6a),(0x6a),(0x74),(0x74),(0x78),(0x78),(0x74),(0x74),
  (0x6a),(0x6a),(0x55),(0x55),(0xAA),(0xAA),(0x55),(0x55),(0x6a),(0x6a),(0x74),(0x74),
  (0x78),(0x78),(0x74),(0x74),(0x6a),(0x6a),(0x55),(0x55)};
static uchar p24_bits[] = {
  (0x80),(0x00),(0xc0),(0x00),(0xea),(0xa8),(0xd5),(0x54),(0xea),(0xa8),(0xd5),(0x54),
  (0xeb),(0xe8),(0xd5),(0xd4),(0xe8),(0xe8),(0xd4),(0xd4),(0xa8),(0xe8),(0x54),(0xd5),
  (0xa8),(0xea),(0x54),(0xd5),(0xfc),(0xff),(0xfe),(0xff)};
static uchar p25_bits[] = {
  (0x80),(0x00),(0xc0),(0x00),(0xe0),(0x00),(0xf0),(0x00),(0xff),(0xf0),(0xff),(0xf0),
  (0xfb),(0xf0),(0xf9),(0xf0),(0xf8),(0xf0),(0xf8),(0x70),(0xf8),(0x30),(0xff),(0xf0),
  (0xff),(0xf8),(0xff),(0xfc),(0xff),(0xfe),(0xff),(0xff)};


static uchar *patter_bits[]= { p1_bits, p2_bits,   p3_bits,  p4_bits,  p5_bits,
                               p6_bits, p7_bits,   p8_bits,  p9_bits, p10_bits,
                              p11_bits, p12_bits, p13_bits, p14_bits, p15_bits,
                              p16_bits, p17_bits, p18_bits, p19_bits, p20_bits,
                              p21_bits, p22_bits, p23_bits, p24_bits, p25_bits};

ClassImp(TQtBrush)
//______________________________________________________________________________
 TQtBrush::TQtBrush(): QBrush(),fStyle(0),fFasi(0) {}
//______________________________________________________________________________
 void TQtBrush::SetColor(QColor &color)
{
  fBackground = color;
  setColor(fBackground);
}

//______________________________________________________________________________
 void TQtBrush::SetStyle(int style, int fasi)
{
//*-*-*-*-*-*-*-*-*-*-*Set fill area style index*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*                  =========================
//*-*  style   : fill area interior style hollow or solid
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
  fStyle =  style;
  fFasi  =  fasi;

  switch( style ) {

  case 0:
    setStyle(Qt::NoBrush);                          // hollow
    break;
  case 1:                                           // solid
    setStyle(Qt::SolidPattern);
    break;

  case 3:                                           // pattern
    if (fasi > 0 && fasi < 26 ) {
      QBitmap bm(16,16,patter_bits[fasi-1],TRUE);
      setPixmap(bm);
    }  else {
      QBitmap bm(16,16,p2_bits,TRUE);
      setPixmap(bm);
    }
    break;
  case 2:                                           // hatch
      switch (fasi)
        {
          case 1: setStyle(Qt::BDiagPattern);
                  break;
          case 2: setStyle(Qt::CrossPattern);
                  break;
          case 3: setStyle(Qt::DiagCrossPattern);
                  break;
          case 4: setStyle(Qt::FDiagPattern);
                  break;
          case 5: setStyle(Qt::HorPattern);
                  break;
          case 6: setStyle(Qt::VerPattern );
                  break;
         default: setStyle(Qt::FDiagPattern);
                  break;
        }
      break;

 default:                                          // solid  - default
   setStyle(Qt::SolidPattern);
      break;
 }
}


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.