/********************************************************************************
*                                                                               *
*                           Device Context Tester                               *
*                                                                               *
*********************************************************************************
* Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
*********************************************************************************
* $Id: dctest.cpp,v 1.50 2006/01/22 17:58:59 fox Exp $                          *
********************************************************************************/
#include "fx.h"
#include <string.h>
#include "dippy.h"


/* Generated by reswrap from file double_dash.gif */
const unsigned char double_dash[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x04,0x00,0xf0,0x00,0x00,0x00,0x00,0xff,
  0x00,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x00,0x02,0x17,0x84,
  0x83,0x06,0x18,0xca,0x9e,0x4e,0x84,0x4d,0xd6,0x35,0x9f,0x55,0xbb,0xe3,0xab,0x7d,
  0x9c,0xe8,0x85,0x66,0x54,0x00,0x00,0x3b
  };

/* Generated by reswrap from file onoff_dash.gif */
const unsigned char onoff_dash[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x04,0x00,0xf0,0x00,0x00,0x00,0x00,0xff,
  0xb2,0xc0,0xdc,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x00,0x02,0x17,0x84,
  0x83,0x06,0x18,0xca,0x9e,0x4e,0x84,0x4d,0xd6,0x35,0x9f,0x55,0xbb,0xe3,0xab,0x7d,
  0x9c,0xe8,0x85,0x66,0x54,0x00,0x00,0x3b
  };

/* Generated by reswrap from file solid_line.gif */
const unsigned char solid_line[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x04,0x00,0xf0,0x00,0x00,0x00,0x00,0xff,
  0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x04,0x00,0x00,0x02,0x0a,0x84,
  0x8f,0xa9,0xcb,0xed,0x0f,0xa3,0x9c,0xac,0x00,0x00,0x3b
  };

/* Generated by reswrap from file capbutt.gif */
const unsigned char capbutt[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x0c,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,
  0x0c,0x00,0x00,0x02,0x27,0x84,0x8f,0xa9,0x17,0xb1,0x0f,0x55,0x8b,0x14,0xce,0x27,
  0xb2,0xde,0xbc,0xdf,0xd5,0x85,0xe2,0xa7,0x88,0xe6,0x46,0x26,0xe7,0x9a,0x22,0xeb,
  0xd9,0x1e,0xaf,0x19,0x57,0x54,0x6d,0x5b,0x4e,0xce,0xb7,0x05,0x00,0x3b
  };

/* Generated by reswrap from file capnotlast.gif */
const unsigned char capnotlast[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x0c,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,
  0x0c,0x00,0x00,0x02,0x2b,0x84,0x8f,0xa9,0x17,0xb1,0x0f,0x55,0x8b,0x14,0xce,0x27,
  0xb2,0xde,0x7c,0x9b,0xbb,0x74,0x62,0xf7,0x39,0xd8,0x88,0x0a,0x25,0x94,0xa2,0xeb,
  0xd9,0x92,0x00,0xa8,0xc4,0xe2,0x5b,0xe5,0x8c,0xa9,0xeb,0x74,0x4f,0xf9,0x01,0x0a,
  0x00,0x3b
  };

/* Generated by reswrap from file capproj.gif */
const unsigned char capproj[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x0c,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,
  0x0c,0x00,0x00,0x02,0x2c,0x84,0x8f,0xa9,0x17,0xb1,0x0f,0x55,0x8b,0x14,0xce,0x27,
  0xb2,0xde,0xbc,0x37,0xad,0x74,0xe2,0xf8,0x65,0xe1,0x88,0x6a,0xa5,0x70,0xa6,0xe8,
  0xda,0xba,0x22,0x9c,0xc8,0x6f,0x00,0x56,0x3a,0x70,0xed,0x7b,0xef,0xab,0x00,0x0d,
  0x05,0x00,0x3b
  };

/* Generated by reswrap from file capround.gif */
const unsigned char capround[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x0c,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,
  0x0c,0x00,0x00,0x02,0x2c,0x84,0x8f,0xa9,0x17,0xb1,0x0f,0x55,0x8b,0x14,0xce,0x27,
  0xb2,0xde,0xbc,0x37,0x81,0x75,0xa2,0xf8,0x81,0xca,0x88,0x6e,0xa5,0x89,0xa4,0xee,
  0x7a,0xba,0x68,0xb9,0xc8,0x73,0xc0,0x56,0x3a,0x70,0xed,0x7b,0xef,0xab,0x00,0x0d,
  0x05,0x00,0x3b
  };

/* Generated by reswrap from file jbevel.gif */
const unsigned char jbevel[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x10,0x00,0xf0,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0xff,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x00,0x02,0x30,0x84,
  0x8f,0xa9,0xcb,0xed,0xff,0x82,0x94,0xb0,0x82,0x89,0xad,0xc3,0x5c,0x2f,0x0e,0x7a,
  0x08,0x48,0x8a,0x57,0x67,0x84,0x9a,0x7a,0xb0,0x11,0x9a,0xb8,0x8c,0x3c,0xc2,0x9f,
  0x7d,0x67,0xf9,0x54,0xd1,0x74,0xf3,0xe3,0x79,0x84,0x33,0xd3,0x45,0x51,0x00,0x00,
  0x3b
  };

/* Generated by reswrap from file jmiter.gif */
const unsigned char jmiter[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x10,0x00,0xf0,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0xff,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x00,0x02,0x33,0x84,
  0x8f,0x19,0xc9,0xed,0x18,0xe2,0x9b,0x2f,0x5a,0x8a,0x8f,0xdd,0x99,0xee,0xdf,0x39,
  0xdf,0x18,0x2a,0x23,0x59,0x02,0xa8,0x0a,0x86,0xab,0xf1,0x4e,0x31,0xdc,0xca,0x35,
  0x33,0x43,0x77,0x93,0xb3,0x1c,0x36,0xeb,0xf1,0x76,0xb4,0x45,0xe9,0x52,0x49,0xc1,
  0x18,0x05,0x00,0x3b
  };

/* Generated by reswrap from file jround.gif */
const unsigned char jround[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x20,0x00,0x10,0x00,0xf0,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0xff,0x2c,0x00,0x00,0x00,0x00,0x20,0x00,0x10,0x00,0x00,0x02,0x32,0x84,
  0x8f,0xa9,0xcb,0xed,0x0f,0x83,0x84,0xd4,0xc8,0x3b,0x6b,0xc3,0x5c,0x2f,0x0e,0x7a,
  0x08,0x48,0x8a,0x40,0x68,0x75,0x1a,0x7a,0xb0,0x8f,0xdb,0xaa,0x0e,0x3c,0xca,0x9f,
  0x7d,0x63,0x0c,0x9d,0x5f,0x0a,0xbf,0xc3,0xa5,0x02,0x22,0xdf,0xc6,0x74,0x52,0x14,
  0x00,0x00,0x3b
  };


/* Generated by reswrap from file minifolder.gif */
const unsigned char minifolder[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x80,0x80,0x80,0xc0,0xc0,0xc0,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x3b,0x08,0xba,0xdc,0x1b,0x10,0x3a,0x16,0xc4,0xb0,0x22,0x4c,0x50,0xaf,0xcf,0x91,
  0xc4,0x15,0x64,0x69,0x92,0x01,0x31,0x7e,0xac,0x95,0x8e,0x58,0x7b,0xbd,0x41,0x21,
  0xc7,0x74,0x11,0xef,0xb3,0x5a,0xdf,0x9e,0x1c,0x6f,0x97,0x03,0xba,0x7c,0xa1,0x64,
  0x48,0x05,0x20,0x38,0x9f,0x50,0xe8,0x66,0x4a,0x75,0x24,0x00,0x00,0x3b
  };


// Simple bitmap pattern
#define bitmap_width 64
#define bitmap_height 64
static unsigned char bitmap_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xc0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
   0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x11, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x88, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84,
   0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x81, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x81, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
   0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x01, 0x04, 0x00, 0x00,
   0x00, 0x00, 0x20, 0x80, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80,
   0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x01, 0x20, 0x00, 0x00,
   0x00, 0x00, 0x04, 0x80, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80,
   0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x01, 0x00,
   0x00, 0x80, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x00, 0x40, 0x00, 0x80,
   0x01, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x80, 0x01, 0x00, 0x08, 0x00,
   0x00, 0x10, 0x00, 0x80, 0x01, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x80,
   0x01, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00,
   0x00, 0x02, 0x00, 0x80, 0x01, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02,
   0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10,
   0x08, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x20,
   0x04, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x04,
   0x20, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x80,
   0x01, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x00,
   0x00, 0x01, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x80,
   0x01, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x80, 0x01, 0x00, 0x10, 0x00,
   0x00, 0x08, 0x00, 0x80, 0x01, 0x00, 0x08, 0x00, 0x00, 0x10, 0x00, 0x80,
   0x01, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00,
   0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x80,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0x02, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x04, 0x80,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0x10, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0x80, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x84, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
   };


/* Generated by reswrap from file slate.gif */
const unsigned char slate[]={
  0x47,0x49,0x46,0x38,0x39,0x61,0x30,0x00,0x30,0x00,0xf7,0x00,0x00,0x86,0x86,0x86,
  0x87,0x87,0x87,0x89,0x89,0x89,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8e,
  0x8e,0x8e,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x92,0x93,0x93,
  0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x97,0x98,0x98,0x98,
  0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,
  0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa3,0xa3,
  0xa3,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,
  0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xac,0xac,0xac,0xad,0xad,0xad,0xae,
  0xae,0xae,0xaf,0xaf,0xaf,0xb0,0xb0,0xb0,0xb1,0xb1,0xb1,0xb2,0xb2,0xb2,0xb3,0xb3,
  0xb3,0xb4,0xb4,0xb4,0xb5,0xb5,0xb5,0xb6,0xb6,0xb6,0xb7,0xb7,0xb7,0xb8,0xb8,0xb8,
  0xb9,0xb9,0xb9,0xba,0xba,0xba,0xbb,0xbb,0xbb,0xbc,0xbc,0xbc,0xbd,0xbd,0xbd,0xbe,
  0xbe,0xbe,0xbf,0xbf,0xbf,0xc0,0xc0,0xc0,0xc1,0xc1,0xc1,0xc2,0xc2,0xc2,0xc3,0xc3,
  0xc3,0xc4,0xc4,0xc4,0xc5,0xc5,0xc5,0xc6,0xc6,0xc6,0xc7,0xc7,0xc7,0xc8,0xc8,0xc8,
  0xc9,0xc9,0xc9,0xca,0xca,0xca,0xcb,0xcb,0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,
  0xce,0xce,0xcf,0xcf,0xcf,0xd0,0xd0,0xd0,0xd1,0xd1,0xd1,0xd2,0xd2,0xd2,0xd3,0xd3,
  0xd3,0xd4,0xd4,0xd4,0xd5,0xd5,0xd5,0xd6,0xd6,0xd6,0xd7,0xd7,0xd7,0xd8,0xd8,0xd8,
  0xd9,0xd9,0xd9,0xda,0xda,0xda,0xdb,0xdb,0xdb,0xdc,0xdc,0xdc,0xdd,0xdd,0xdd,0xde,
  0xde,0xde,0xdf,0xdf,0xdf,0xe0,0xe0,0xe0,0xe1,0xe1,0xe1,0xe2,0xe2,0xe2,0xe3,0xe3,
  0xe3,0xe4,0xe4,0xe4,0xe6,0xe6,0xe6,0xe7,0xe7,0xe7,0xe8,0xe8,0xe8,0x37,0xa9,0x04,
  0x02,0x8a,0x00,0x20,0x14,0x00,0x04,0x40,0x00,0x00,0xa4,0x90,0x00,0xfe,0x49,0x00,
  0x10,0x1c,0x00,0x40,0x08,0x37,0xa4,0x08,0x01,0xfe,0xef,0x00,0x10,0xff,0x00,0x40,
  0xbf,0xc9,0x90,0xce,0xeb,0x46,0x84,0x05,0x08,0x04,0x08,0x40,0x40,0x90,0x03,0x90,
  0x49,0x00,0x49,0x1c,0x00,0x1c,0x08,0x00,0x08,0x37,0x08,0x60,0x02,0x50,0x9a,0x20,
  0x1c,0x1c,0x04,0x08,0x08,0x00,0x01,0xb8,0xf1,0x80,0x50,0xff,0x04,0x1c,0xbf,0x40,
  0x08,0x09,0xa4,0xa4,0x00,0xfe,0xfe,0x00,0x10,0x10,0x00,0x40,0x40,0x25,0x04,0x90,
  0x00,0x00,0x49,0x00,0x00,0x1c,0x00,0x00,0x08,0x01,0x90,0x00,0x00,0x49,0x00,0x00,
  0x1c,0x00,0x00,0x08,0x00,0x88,0x28,0x28,0xf1,0xf0,0xef,0xff,0xff,0xff,0x10,0xce,
  0x4e,0x00,0x84,0x1d,0x20,0x04,0x06,0x04,0x40,0x40,0x90,0x90,0x32,0x49,0x49,0x51,
  0x1c,0x1c,0x1c,0x08,0x08,0x08,0xc0,0x60,0xc0,0xf4,0x9a,0xef,0xff,0x1c,0xff,0xbf,
  0x08,0xbf,0x37,0x01,0x0a,0x01,0x80,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x2e,0xa4,
  0xa4,0xfb,0xfe,0xfe,0x08,0x10,0x10,0xcd,0x04,0x04,0x97,0x00,0x00,0x0e,0x00,0x00,
  0x08,0x00,0x00,0x00,0x90,0x0c,0x18,0x48,0x0c,0x00,0xf0,0x00,0x00,0xff,0x00,0x00,
  0xbf,0x00,0xd5,0x34,0xc0,0x81,0x24,0xef,0x04,0x1a,0xff,0x40,0x40,0xbf,0x74,0x90,
  0xc0,0x50,0x49,0xef,0x1c,0x1c,0xff,0x08,0x08,0xbf,0x00,0x60,0x03,0x00,0x9a,0x00,
  0x00,0xc4,0x40,0x00,0x50,0x2d,0x00,0x1c,0x18,0x00,0x08,0x08,0xe6,0xa4,0xf9,0xea,
  0xfe,0xd7,0x05,0x10,0x05,0x08,0x40,0x08,0x00,0x50,0x90,0x00,0x2f,0x49,0x00,0x26,
  0x1c,0x3c,0x7f,0x71,0x02,0xa7,0x00,0x20,0x17,0x20,0x04,0x0c,0x04,0x00,0xa4,0x60,
  0x00,0xfe,0x9a,0x00,0x90,0xd5,0x00,0x46,0x81,0x00,0x08,0x04,0x98,0x03,0x58,0x8c,
  0x00,0x52,0x1d,0x00,0x1c,0x7e,0x08,0x70,0x00,0x50,0xef,0x00,0x1c,0xff,0x00,0x08,
  0xbf,0x37,0x4c,0x04,0x01,0x02,0x00,0x00,0x00,0x00,0x0c,0x00,0x01,0x0a,0x00,0x00,
  0x98,0x04,0xc0,0x8c,0x00,0xef,0x1d,0x00,0xff,0x08,0x00,0xbf,0x30,0xa4,0x03,0x00,
  0xfe,0x00,0x00,0x10,0x00,0x30,0x88,0x0b,0x30,0xcf,0xd5,0x00,0x52,0x81,0x00,0x50,
  0xd0,0x00,0x4f,0x50,0x00,0x1c,0x1c,0xec,0x08,0x90,0xf1,0x50,0xef,0xf0,0x4c,0x04,
  0xf1,0x02,0x00,0xff,0x00,0x00,0xbf,0x00,0x00,0xf4,0x3c,0x50,0xf1,0x7a,0x46,0xff,
  0x19,0x08,0xbf,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0xfe,0x15,
  0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x54,0x68,0x65,
  0x20,0x47,0x49,0x4d,0x50,0x00,0x2c,0x00,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,
  0x08,0xfe,0x00,0x4b,0xcc,0xe0,0xb1,0x23,0x47,0x8f,0x1f,0x3c,0x60,0xbc,0x68,0xb1,
  0x62,0x45,0x8b,0x17,0x31,0x16,0xa6,0x08,0xc1,0x81,0x83,0x08,0x14,0x23,0x52,0xb8,
  0x68,0xc1,0x82,0xc5,0x09,0x10,0x34,0x70,0xdc,0x88,0x21,0xa3,0xc7,0x90,0x21,0x45,
  0x92,0x28,0x31,0x02,0xe4,0x86,0x89,0x0b,0x23,0x60,0x88,0xac,0x81,0x23,0xc7,0x8d,
  0x85,0x2b,0x54,0xac,0x70,0x11,0x63,0x06,0xc7,0x14,0x23,0x3e,0x7c,0x20,0x81,0xc2,
  0xc5,0x0c,0x1b,0x33,0x64,0xc8,0x70,0x71,0xa2,0x85,0x0d,0x1d,0x34,0x64,0xe4,0x10,
  0x52,0x24,0x88,0x90,0x20,0x3f,0x80,0xf4,0x80,0x21,0xe2,0x44,0x0c,0x91,0x34,0x6a,
  0xd4,0xa0,0x81,0x53,0xa7,0x0b,0x19,0x35,0x54,0xa4,0x38,0x31,0x42,0xc4,0x88,0x13,
  0x2b,0x8e,0xda,0x88,0x01,0x23,0xa2,0x0a,0x15,0x36,0x7a,0xe0,0x40,0xcb,0x43,0xc8,
  0x0f,0x1f,0x3a,0x6e,0xe8,0xe0,0x61,0xa3,0x45,0x0c,0x1b,0x3b,0x76,0x88,0xb4,0x51,
  0x43,0x06,0x0c,0x86,0x2c,0xce,0xd2,0x28,0x31,0x22,0x04,0x88,0x10,0x26,0x58,0xd4,
  0x8d,0xca,0x11,0xc6,0xe3,0x16,0x35,0x76,0xe8,0x60,0x2c,0x38,0xeb,0x8e,0xa5,0x24,
  0x61,0xdc,0xc8,0xc1,0xa3,0xc7,0x8e,0x1b,0x36,0x6c,0xdc,0x68,0xfc,0xc2,0x85,0x8b,
  0x17,0x30,0x40,0x78,0xe0,0xd0,0x21,0x04,0x8a,0x17,0x34,0x60,0x38,0x66,0xd1,0xe2,
  0x28,0x8d,0xdb,0x33,0x0c,0xf2,0xd0,0x91,0x63,0x07,0x10,0x1e,0x2f,0x4a,0x98,0x30,
  0x6a,0x13,0x87,0xe8,0x1a,0x33,0x6a,0xe4,0x98,0x39,0x23,0xa2,0x0b,0x0f,0x1d,0x7a,
  0xfe,0x9b,0xd8,0xf9,0xc2,0x21,0x0b,0x14,0x2a,0x62,0x60,0x57,0x01,0x17,0x87,0x90,
  0x21,0x41,0x80,0xd8,0x58,0xde,0x62,0x44,0x09,0x17,0x35,0x74,0x88,0xd5,0x01,0x15,
  0x6d,0x4d,0xfe,0x38,0xd4,0x10,0x91,0x07,0x20,0x94,0xa0,0xd9,0x0b,0x2a,0x90,0xa0,
  0x02,0x0b,0x2b,0xa0,0x90,0xc2,0x0b,0x8e,0xa9,0x50,0x94,0x0e,0x41,0x54,0x58,0x84,
  0x0e,0x3b,0x14,0x86,0xc2,0x0a,0xb8,0x11,0x36,0x1f,0x0f,0xd8,0xcd,0x66,0x5d,0x0f,
  0x3c,0xe0,0x10,0xdc,0x50,0xa0,0xed,0x55,0xc2,0x06,0x31,0xd0,0x30,0x03,0x6e,0x35,
  0xd8,0x70,0x1c,0x7e,0x3e,0xfc,0xa0,0x43,0x0f,0x45,0x0c,0xe1,0x43,0x0d,0x2d,0x18,
  0xe6,0x02,0x0a,0x3a,0xf8,0x54,0x1c,0x63,0x31,0x7c,0x05,0xc4,0x10,0x40,0x8c,0x46,
  0x43,0x10,0xd6,0xf1,0xf0,0xe2,0x0a,0x1d,0x9c,0x30,0xc3,0x0c,0x27,0xa4,0x50,0x13,
  0x0b,0x2a,0xd0,0xf0,0x03,0x7c,0x3e,0xf8,0x70,0xe4,0x10,0x3c,0x2c,0x25,0x9c,0x4c,
  0x73,0x61,0xe9,0x02,0x0d,0x39,0xc0,0x50,0x03,0x0f,0x3f,0xfc,0x55,0xe3,0x0c,0x2a,
  0xc8,0xd4,0x18,0x0a,0x14,0x5c,0x50,0xc2,0x0a,0x26,0x94,0x90,0x02,0x0a,0x20,0xa8,
  0x30,0xc3,0x0f,0x44,0x20,0x99,0x55,0x0f,0x3d,0x04,0x59,0x97,0x0b,0x29,0xd4,0x70,
  0x03,0x0d,0x2a,0x84,0x30,0x42,0x0c,0x3e,0xd0,0x70,0xc3,0x0e,0x3d,0xd4,0x28,0x04,
  0x11,0x37,0x2c,0x68,0x43,0x4d,0x31,0x70,0xd0,0xc0,0x05,0x0a,0xa2,0x20,0x42,0x07,
  0x1b,0xa0,0x50,0x12,0x11,0x44,0x60,0x95,0x64,0x41,0x62,0xd5,0xe0,0x42,0x09,0xfe,
  0x3d,0xc5,0x80,0x82,0x07,0x1f,0xac,0x20,0x18,0x0f,0x35,0xfa,0x40,0x68,0x5f,0x32,
  0x40,0x04,0xc3,0xa6,0x2c,0x44,0x10,0x01,0x07,0xc5,0xad,0x20,0xdd,0x09,0x2f,0x50,
  0x28,0x04,0x10,0x5d,0x12,0x3a,0x5a,0x4d,0x32,0x14,0xe5,0x82,0x47,0x22,0x88,0x50,
  0x82,0x0a,0x38,0xdc,0xd8,0x66,0x89,0x34,0xf0,0x50,0xe4,0x0b,0x27,0xa4,0xc7,0x82,
  0x06,0x0d,0x3c,0x50,0x02,0x6c,0x74,0x15,0x75,0xc3,0x41,0x3e,0x10,0x14,0x5f,0x90,
  0x47,0xcd,0x10,0x19,0x0b,0x7b,0x9e,0x40,0x59,0x08,0x10,0xa1,0xc9,0x03,0x0f,0x37,
  0x24,0xe5,0xc2,0xa6,0x1b,0xc1,0xd0,0xa8,0x03,0x05,0x5c,0xe0,0xc2,0xa2,0x31,0xb4,
  0xa0,0xe6,0x8d,0x24,0xee,0x10,0x5f,0x0e,0xe5,0xdd,0xf6,0xd0,0x46,0x2b,0xa4,0x60,
  0x42,0x5b,0x29,0xa4,0xb0,0xc2,0xaf,0xdc,0x1d,0xdc,0x43,0x73,0x3e,0xd8,0xb0,0x42,
  0x06,0x0b,0x48,0x20,0xd0,0x0c,0x67,0xc6,0xc8,0x5a,0xa5,0x3d,0x00,0x21,0x84,0x0f,
  0x32,0x64,0xdc,0x02,0x4f,0x32,0x24,0x8c,0x42,0x09,0x25,0x84,0x8b,0x42,0x95,0xc0,
  0x8d,0x75,0x03,0x0b,0x2f,0x6c,0x3a,0xc4,0x12,0x43,0xd0,0x70,0x02,0x06,0x16,0x8c,
  0x20,0xc3,0x71,0x39,0x6c,0xc7,0x5a,0x8d,0x3f,0x04,0x61,0x04,0xa6,0x58,0x2a,0xfc,
  0xc2,0x0c,0x64,0x99,0x00,0xc2,0x5b,0x28,0xa0,0x70,0xe0,0x9e,0x2c,0xa8,0x07,0x16,
  0x9a,0x07,0x8d,0x70,0x81,0x05,0x18,0xd4,0xa0,0x84,0x0f,0x45,0x00,0x91,0x98,0x0f,
  0x97,0x12,0x11,0xf5,0x0f,0x36,0x34,0x0a,0x82,0xb5,0x71,0x89,0x04,0x43,0xfe,0x0a,
  0x7a,0x96,0x40,0x82,0xdf,0x0a,0xa2,0xd5,0x5c,0x60,0x4f,0x75,0xf9,0x82,0x08,0x16,
  0x50,0x90,0xc2,0x0f,0x57,0x09,0x71,0x15,0x10,0x41,0x10,0x31,0xb5,0xdc,0x46,0x0b,
  0x65,0x19,0x09,0x2c,0x84,0xc4,0xa8,0xb5,0xd5,0x4a,0xf7,0x9b,0x89,0xd6,0xe5,0xc0,
  0x58,0x93,0x3f,0xb8,0x60,0x01,0x04,0x1a,0xbc,0x70,0x84,0x49,0x49,0x24,0x91,0xa3,
  0xe4,0x48,0x1c,0x01,0x04,0x0d,0x7c,0x12,0x38,0xc2,0x08,0x7f,0x9b,0x90,0x27,0x09,
  0x21,0x5c,0x84,0xdb,0x43,0x34,0x6c,0x4c,0x43,0x54,0x2d,0xe2,0xc0,0x83,0x12,0x34,
  0x50,0xf0,0xc0,0x04,0x25,0x1c,0xe1,0xc3,0x10,0x4a,0x34,0xd1,0xc4,0x4a,0x44,0x20,
  0x61,0x84,0x10,0x39,0xbc,0x2a,0x82,0xa3,0x38,0x53,0xd4,0x01,0x09,0x2b,0x90,0xf0,
  0x96,0x84,0x22,0x80,0x40,0x02,0x09,0x0f,0xd6,0x2c,0x43,0xe1,0x4a,0xcc,0x50,0x81,
  0x04,0x14,0x88,0xe0,0x32,0x55,0x4c,0x4c,0x31,0x05,0xd1,0x43,0x10,0xf1,0x72,0x61,
  0xf6,0x7a,0x70,0x6d,0x0a,0xe5,0x53,0xd0,0x09,0x28,0x82,0x01,0x09,0x94,0x2b,0x69,
  0xe9,0x89,0xd1,0x0d,0x78,0x00,0x39,0x22,0xcc,0x60,0x03,0x75,0x1a,0x01,0x0d,0xaa,
  0x12,0x84,0x24,0x50,0xe1,0x0a,0x4f,0x30,0x42,0x85,0xb4,0xb2,0x17,0x7a,0x6d,0xcd,
  0x04,0x24,0x00,0x41,0x45,0x3a,0xc0,0x81,0x0b,0x4c,0xc0,0x80,0x0a,0x70,0x40,0x05,
  0x4c,0x00,0x9a,0xa6,0xe9,0x00,0x6e,0x42,0xe8,0x81,0x4b,0x26,0x60,0xa7,0x13,0x20,
  0x29,0x08,0x47,0x88,0x42,0x15,0xa6,0xe0,0x84,0x54,0x71,0x0b,0x06,0xfe,0xd3,0x3a,
  0x81,0x08,0x36,0x60,0x81,0x09,0x44,0xe0,0x01,0x0d,0x48,0xe2,0x04,0x32,0xa0,0x01,
  0x0b,0x5c,0x80,0x03,0x45,0xb1,0x41,0xd3,0x58,0xe3,0xb2,0xc1,0xb8,0x20,0x02,0x14,
  0x28,0x01,0x08,0x80,0x70,0xa4,0x23,0x34,0x41,0x0a,0x55,0xb0,0x02,0x12,0xb0,0x17,
  0x83,0x8d,0xcc,0x0c,0x04,0x26,0x40,0xc1,0x07,0x22,0xa0,0x00,0x08,0x60,0x00,0x03,
  0x1d,0xb0,0x8f,0x08,0x84,0xf2,0x81,0x1f,0xa5,0x60,0x06,0x38,0x78,0x11,0x0c,0xfe,
  0x62,0x83,0x12,0x4c,0xe0,0x01,0x18,0x18,0xc1,0x60,0xa4,0xb6,0x84,0x27,0x48,0x81,
  0x0a,0x50,0x40,0xc2,0x0e,0xea,0xd3,0x95,0x16,0x84,0x27,0x03,0x10,0x38,0xc0,0x01,
  0x50,0xc7,0x01,0x0d,0x5c,0xe0,0x02,0x19,0xe0,0x00,0xad,0xf6,0xd4,0x02,0xeb,0x90,
  0xe5,0x4c,0x36,0x49,0x01,0x06,0x26,0x00,0x02,0x17,0x54,0x28,0x08,0x43,0x30,0xc2,
  0x12,0xa0,0xc0,0x43,0x24,0xf0,0x80,0x05,0x1f,0xe0,0xc0,0x08,0x54,0xe0,0x01,0x0d,
  0x54,0xe0,0x01,0x0c,0x70,0xe3,0x07,0x44,0x70,0x81,0x05,0x1c,0x60,0x01,0x13,0xc0,
  0x80,0x06,0xae,0x45,0x83,0x2e,0xd9,0xe0,0x05,0x0b,0x59,0xe0,0x0c,0x4a,0x20,0x82,
  0x17,0xfc,0x20,0x09,0x46,0x80,0xcf,0x10,0x90,0xf0,0x84,0x29,0x3c,0x61,0x09,0x40,
  0xf8,0x8e,0x06,0x44,0xd0,0x02,0x0f,0x64,0xa0,0x02,0x75,0xd2,0x40,0x45,0x3c,0x50,
  0x01,0x04,0x08,0x40,0x00,0x08,0x90,0x00,0x06,0x90,0xa5,0x03,0xad,0x2c,0x2a,0x2a,
  0x39,0xf8,0x81,0x0c,0x6f,0x00,0x84,0xd6,0x1d,0xa1,0x08,0x44,0xfe,0x28,0x82,0x12,
  0x0c,0xe9,0x84,0x26,0x14,0x81,0x06,0x23,0xf0,0x40,0xa2,0x3a,0x60,0x81,0x06,0x2c,
  0x00,0x02,0x14,0x00,0xa7,0x03,0x1c,0xb0,0x00,0x03,0x0c,0x20,0x01,0x16,0x68,0x66,
  0x5e,0xda,0x95,0x98,0xe5,0x50,0xea,0x48,0x45,0x38,0xc2,0x11,0xf2,0x67,0x84,0x24,
  0x2c,0xa1,0x09,0x4f,0x48,0xe4,0x4a,0x70,0x60,0x31,0x18,0xf0,0x20,0x04,0x16,0x48,
  0x00,0x01,0x0e,0xd0,0x80,0x08,0x48,0x40,0x00,0x09,0x80,0x80,0x04,0x22,0xb0,0x4e,
  0xed,0x1c,0x84,0x50,0xa8,0x7c,0x19,0x73,0x70,0xe4,0xba,0xe7,0xfc,0x40,0x9f,0x4e,
  0xe8,0x27,0x13,0xa8,0x32,0x04,0x1d,0x2c,0x84,0x06,0x3d,0xd0,0x00,0x05,0x1c,0xc0,
  0x00,0x07,0x3c,0x80,0xa9,0x06,0x70,0x00,0x06,0x3c,0x30,0x02,0x16,0xb8,0x87,0x71,
  0x2f,0x0b,0x02,0x12,0x92,0x40,0x04,0x1f,0x88,0xc6,0x24,0xd1,0xfc,0x81,0xf1,0x84,
  0x70,0x04,0x25,0x28,0xc1,0x7a,0x71,0xf3,0x81,0x88,0x7a,0x90,0x00,0x06,0x44,0xe0,
  0x02,0x05,0x3c,0x00,0x00,0x82,0xe9,0x01,0x13,0xbc,0x00,0x07,0x40,0xd0,0x60,0xa0,
  0xa4,0xd6,0x04,0xa2,0x75,0xc9,0x4b,0xf9,0x43,0x95,0x75,0xb6,0x54,0x04,0x7c,0x0e,
  0xe1,0x08,0xb1,0x93,0xdb,0xbe,0x7a,0xb0,0x80,0x05,0x34,0x40,0x9d,0xdf,0x84,0x40,
  0x03,0x52,0xa0,0x98,0x1e,0x40,0xa1,0x0a,0x4b,0xf0,0xe8,0x12,0x94,0xc0,0x04,0x26,
  0x10,0xe1,0x69,0x8c,0x4b,0x42,0x13,0x56,0x17,0x3c,0xac,0x1c,0x81,0x0a,0xcf,0x3b,
  0x52,0x12,0x98,0x80,0x84,0xe7,0xf0,0x20,0x01,0x0d,0x58,0xfe,0xe2,0x07,0x32,0x03,
  0xc4,0xa6,0x41,0x68,0x08,0x4e,0x60,0x82,0x13,0xa4,0xc0,0xc3,0xcd,0x6a,0xb0,0x4d,
  0x84,0x22,0x6b,0x51,0xf5,0xb2,0x84,0x8c,0x46,0x41,0x08,0x4c,0x28,0x02,0x12,0x9a,
  0x10,0x05,0x28,0x28,0x21,0x55,0x03,0x40,0x40,0x03,0x20,0x30,0x81,0x0d,0x9c,0x40,
  0x38,0x2f,0x40,0x01,0xf8,0x76,0x50,0xd6,0x28,0x60,0x21,0x0b,0x51,0x48,0xc2,0x56,
  0x91,0xd0,0xa5,0x82,0xf8,0x20,0x50,0x3d,0xb0,0xde,0x14,0x98,0x90,0x04,0x27,0x58,
  0x30,0xa8,0x3a,0xc4,0x42,0x15,0x3c,0x5b,0x00,0xd8,0x46,0xc0,0x02,0x51,0x7a,0xd5,
  0x07,0xea,0x5a,0x4c,0x20,0xfc,0x00,0x0a,0x54,0xa0,0x02,0x13,0x10,0x7b,0x56,0x4a,
  0x05,0x17,0x09,0x48,0x18,0x42,0x67,0xa5,0xf0,0x84,0x26,0x40,0xe1,0x09,0x54,0xa8,
  0x02,0x15,0xa6,0x50,0x05,0x2d,0x68,0xe1,0x09,0x42,0x08,0x80,0x00,0x0c,0xf0,0x00,
  0x0d,0x8c,0x40,0x77,0x41,0x01,0x01,0x0b,0xda,0xb9,0x03,0x1a,0x6c,0xf5,0x08,0x92,
  0x4b,0x82,0xec,0x9c,0x93,0x4f,0xd1,0x16,0xd7,0xa3,0x48,0x70,0xc2,0x14,0x78,0xdb,
  0x04,0x2c,0x5c,0x41,0x0a,0x51,0xb0,0x42,0x16,0x9c,0xe0,0x83,0x99,0x4e,0x40,0x03,
  0xbd,0xeb,0x00,0x26,0x2f,0x50,0x01,0x62,0x55,0x6a,0x3e,0x35,0x02,0x02,0x11,0x8e,
  0x10,0x04,0xc1,0x48,0xed,0x08,0xab,0x4d,0x42,0x2a,0x95,0x10,0x84,0xfa,0x3d,0xa1,
  0x0a,0x4a,0xb0,0x71,0x14,0x0a,0x69,0x05,0x27,0x00,0x21,0x29,0x40,0x04,0xa0,0x52,
  0xa7,0xcb,0x00,0x05,0x6c,0x20,0x2f,0x2e,0xa2,0x50,0xfe,0xfe,0x84,0xa0,0x83,0x88,
  0x20,0x59,0x08,0x48,0x50,0x82,0x46,0xa1,0x50,0xe5,0x27,0x20,0x01,0x0b,0x4f,0xb0,
  0xc2,0x15,0xa2,0x80,0x84,0x25,0x58,0x61,0x0a,0x48,0x70,0x14,0x09,0x3c,0x30,0x01,
  0x05,0x1c,0xc0,0x00,0x45,0xb6,0xc0,0x02,0x2c,0x00,0x83,0xc9,0xb4,0x80,0xbb,0x09,
  0xee,0xc1,0x31,0x43,0xf0,0xa0,0x19,0xec,0xc0,0x08,0x4e,0x78,0x82,0x12,0xac,0x50,
  0x84,0xbe,0x0a,0x41,0x0b,0x12,0xde,0x73,0x59,0xaf,0x90,0x85,0x27,0x38,0x96,0x01,
  0x08,0x18,0x80,0x00,0x08,0x80,0x00,0x0c,0x10,0xf9,0x02,0x26,0x10,0x4c,0xaf,0x72,
  0x80,0x92,0x1f,0x2c,0x2a,0x2d,0x97,0x89,0xc1,0x41,0x8a,0x00,0x05,0x06,0xb3,0x57,
  0xb4,0x54,0xc8,0x82,0x8e,0xb5,0xb0,0x85,0x2e,0x7c,0xa1,0xd4,0x0b,0x30,0x74,0x01,
  0x56,0x9a,0x4b,0x05,0x24,0x2d,0x59,0x5b,0x19,0x0a,0x0b,0xe6,0x43,0xa2,0x4a,0xc5,
  0x20,0x04,0x1b,0x20,0x01,0x70,0x7e,0xc0,0x84,0x06,0x67,0x16,0x09,0x4c,0x90,0xc2,
  0x15,0xf4,0xbc,0xc3,0x2b,0x6c,0x01,0x0b,0x50,0x78,0x40,0x43,0x0b,0x80,0x00,0x07,
  0x4c,0xc0,0x02,0x1a,0x91,0x41,0x76,0x78,0x14,0xc2,0x3b,0xc9,0x40,0x30,0x3b,0x00,
  0x51,0x09,0xc4,0x59,0x55,0x1e,0xf4,0x95,0x09,0xdf,0xde,0xe7,0x14,0x6c,0x3c,0x05,
  0x00,0x6b,0x21,0x0b,0x53,0xd8,0x80,0x09,0x29,0x90,0x01,0x5a,0x7d,0x80,0x3d,0x14,
  0xd1,0x40,0x07,0x3e,0x60,0xbe,0xf3,0xc1,0x85,0x23,0x0e,0x31,0x41,0x08,0x84,0x42,
  0x02,0x1b,0x88,0xf7,0xa3,0xec,0xed,0xb3,0x13,0xb2,0x2c,0x7c,0x05,0x2a,0x60,0xa1,
  0x0b,0x5b,0xa8,0x42,0x65,0x30,0xb3,0x13,0x7a,0x55,0x00,0x03,0x20,0xa8,0x92,0x16,
  0xc3,0xc3,0x81,0x0d,0x70,0xe0,0x03,0xbd,0x0b,0x01,0x5c,0x5e,0xc0,0x82,0xca,0x8c,
  0x98,0xac,0xd2,0xb3,0xde,0xa8,0xb3,0x40,0x74,0x2e,0x78,0x01,0x0b,0x4e,0xa0,0xd5,
  0x08,0xbc,0x86,0xa5,0x01,0xfa,0x66,0x69,0x2c,0x18,0x15,0xfc,0x2e,0xb0,0x81,0xa1,
  0xa4,0x80,0x05,0x35,0x30,0x09,0x10,0x5c,0x65,0x94,0x1a,0xf8,0xa0,0xcf,0x28,0x56,
  0x2e,0x80,0xad,0x80,0x85,0x83,0x3f,0x61,0x08,0x39,0xbb,0xcb,0x09,0x78,0x47,0x69,
  0x11,0x8a,0xc0,0x04,0x22,0xa8,0xb9,0x06,0x66,0xab,0x02,0xc3,0xe0,0xc0,0x07,0x46,
  0xc8,0x7b,0x61,0x83,0x50,0x62,0x12,0xec,0xd1,0xb0,0x29,0x61,0xee,0x14,0xa8,0xf0,
  0x67,0x45,0xe6,0x1b,0x2a,0x2a,0xa8,0x4c,0x57,0x70,0x1e,0x83,0xe5,0xcc,0x00,0x88,
  0x6b,0x72,0x0d,0xeb,0x8c,0x20,0x56,0x1d,0xe8,0xf3,0xcb,0x18,0x88,0xb5,0x55,0x84,
  0x60,0x84,0x7d,0xf2,0x96,0xb7,0x51,0x30,0x82,0x0e,0x02,0x02,0x00,0x3b
  };


#define O FXRGBA(0,0,0,0)
#define R FXRGBA(255,0,0,128)
#define G FXRGBA(0,255,0,128)
#define B FXRGBA(0,0,255,128)

static const FXColor cursordata[]={
  R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,
  R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,
  R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,
  R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,
  R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,
  G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,
  G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,
  G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,
  G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,
  G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,G,
  B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,
  B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,
  B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,
  B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,
  B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,
  O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O
  };

#undef O
#undef B
#undef G
#undef R

const unsigned char copycursor[]={
  0x00,0x00,0x02,0x00,0x02,0x00,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x01,
  0x00,0x00,0x26,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x01,0x00,0x01,0x00,0xb0,0x00,
  0x00,0x00,0x56,0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,
  0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x05,
  0x00,0x00,0x00,0x08,0x80,0x00,0x00,0x10,0x40,0x00,0x00,0x4d,0x90,0x00,0x00,0xa5,
  0x28,0x00,0x01,0x3d,0xe4,0x00,0x02,0x00,0x02,0x00,0x01,0x3d,0xe4,0x00,0x00,0xa5,
  0x28,0x00,0x00,0x4d,0x90,0x00,0x00,0x10,0x40,0x00,0x00,0xc8,0x80,0x00,0x00,0xc5,
  0x00,0x00,0x01,0x82,0x00,0x00,0x01,0x80,0x00,0x00,0x03,0x00,0x00,0x00,0x43,0x00,
  0x00,0x00,0x66,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x7f,0xc0,
  0x00,0x00,0x7f,0x80,0x00,0x00,0x7f,0x00,0x00,0x00,0x7e,0x10,0x00,0x00,0x7c,0x28,
  0x00,0x00,0x78,0x6c,0x00,0x00,0x70,0x82,0x00,0x00,0x60,0x6c,0x00,0x00,0x40,0x28,
  0x00,0x00,0x00,0x10,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xfd,0xff,0xff,0xff,0xf8,
  0xff,0xff,0xff,0xf0,0x7f,0xff,0xff,0xe0,0x3f,0xff,0xff,0xb0,0x6f,0xff,0xff,0x18,
  0xc7,0xff,0xfe,0x00,0x03,0xff,0xfc,0x00,0x01,0xff,0xfe,0x00,0x03,0xff,0xff,0x18,
  0xc7,0xff,0xff,0xb0,0x6f,0xff,0xff,0x20,0x3f,0xff,0xfe,0x10,0x7f,0xff,0xfe,0x18,
  0xff,0xff,0xfc,0x3d,0xff,0xff,0x7c,0x3f,0xff,0xff,0x38,0x7f,0xff,0xff,0x10,0x7f,
  0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x0f,0xff,0xff,0x00,0x1f,
  0xff,0xff,0x00,0x3f,0xff,0xff,0x00,0x7f,0xff,0xff,0x00,0xef,0xff,0xff,0x01,0xc7,
  0xff,0xff,0x03,0x83,0xff,0xff,0x07,0x01,0xff,0xff,0x0f,0x83,0xff,0xff,0x1f,0xc7,
  0xff,0xff,0x3f,0xef,0xff,0xff,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x20,0x00,
  0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0xff,0xff,0xff,0x00,0x07,0x80,0x00,0x00,0x04,0x80,0x00,0x00,0x84,0x80,
  0x00,0x00,0xc9,0x00,0x00,0x00,0xa9,0x00,0x00,0x00,0x92,0x00,0x00,0x00,0x83,0xe0,
  0x00,0x00,0x80,0x40,0x00,0x00,0x80,0x80,0x00,0x00,0x81,0x20,0x00,0x00,0x82,0x50,
  0x00,0x00,0x84,0xd8,0x00,0x00,0x89,0x04,0x00,0x00,0x90,0xd8,0x00,0x00,0xa0,0x50,
  0x00,0x00,0xc0,0x20,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0x78,0x7f,
  0x00,0x00,0x30,0xff,0x00,0x00,0x10,0xff,0x00,0x00,0x01,0xff,0x00,0x00,0x00,0x1f,
  0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0xdf,0x00,0x00,0x01,0x8f,
  0x00,0x00,0x03,0x07,0x00,0x00,0x06,0x03,0x00,0x00,0x0f,0x07,0x00,0x00,0x1f,0x8f,
  0x00,0x00,0x3f,0xdf,0x00,0x00
  };

/*******************************************************************************/

// Device context demo application
// When complete, this demo should show off aspects of the FXDC API, such as:
// -> points
// -> lines (with various line styles, end caps and join styles)
// -> rectangles (filled and unfilled)
// -> arcs (filled and unfilled)
// -> polygons (filled and unfilled)
// -> fill patterns and built-in stipple patterns
// -> various blitting modes
// -> drawing images, icons and bitmaps
// -> clipping
// -> and so much more...

class DCTestWindow : public FXMainWindow {
  FXDECLARE(DCTestWindow)
private:
  DCTestWindow(){}
  DCTestWindow(const DCTestWindow&);
  DCTestWindow& operator=(const DCTestWindow&);

protected:

  // Drawing parameters
  FXFunction         function;        // BLIT function
  FXLineStyle	     lineStyle;       // Line style
  FXCapStyle	     capStyle;        // Cap style
  FXJoinStyle	     joinStyle;       // Join style
  FXFillStyle        fillStyle;       // Filling style
  FXFillRule         fillRule;        // Polygon fill rule
  FXColor            forecolor;       // Foreground color
  FXColor            backcolor;       // Background color
  FXColor            erasecolor;      // Canvas erased color
  FXStipplePattern   stipple;         // Stipple pattern
  FXImage	    *birdImage;       // Test image
  FXImage	    *textureImage;    // Texture image
  FXFont            *testFont;        // Test font
  FXFont            *testFontAngle;   // Test font at angle
  FXBitmap          *bitmap;          // Test bitmap
  FXint              ang1;            // Arc angle 1
  FXint              ang2;            // Arc angle 2
  FXint              cornerw;         // Corner width
  FXint              cornerh;         // Corner height

  // Widgets
  FXCanvas          *linesCanvas;
  FXCanvas          *shapesCanvas;
  FXCanvas          *imagesCanvas;
  FXSpinner         *lineWidthSpinner;
  FXColorWell       *backWell;
  FXColorWell       *foreWell;
  FXColorWell       *eraseWell;
  FXPopup           *pop;
  FXMenuPane        *filemenu;
  FXDataTarget       ang1_target;
  FXDataTarget       ang2_target;
  FXDataTarget       cornerw_target;
  FXDataTarget       cornerh_target;

  // Icons
  FXIcon            *lssolid;
  FXIcon            *lsonoffdash;
  FXIcon            *lsdoubledash;
  FXIcon            *cscapnotlast;
  FXIcon            *cscapbutt;
  FXIcon            *cscapround;
  FXIcon            *cscapproj;
  FXIcon            *jsmiter;
  FXIcon            *jsround;
  FXIcon            *jsbevel;

  // Cursor
  FXCursor          *alphacursor;
  FXCursor          *gifcursor;
  FXCursor          *curcursor;

public:

  // Draw page
  void drawPage(FXDC& dc,FXint w,FXint h);

public:
  long onPaintLines(FXObject*,FXSelector,void*);
  long onPaintShapes(FXObject*,FXSelector,void*);
  long onPaintImages(FXObject*,FXSelector,void*);
  long onLineWidth(FXObject*,FXSelector,void*);
  long onCmdFunction(FXObject*,FXSelector,void*);
  long onUpdFunction(FXObject*,FXSelector,void*);
  long onCmdLineStyle(FXObject*,FXSelector,void*);
  long onUpdLineStyle(FXObject*,FXSelector,void*);
  long onCmdCapStyle(FXObject*,FXSelector,void*);
  long onUpdCapStyle(FXObject*,FXSelector,void*);
  long onCmdJoinStyle(FXObject*,FXSelector,void*);
  long onUpdJoinStyle(FXObject*,FXSelector,void*);
  long onCmdEraseColor(FXObject*,FXSelector,void*);
  long onUpdEraseColor(FXObject*,FXSelector,void*);
  long onCmdForeColor(FXObject*,FXSelector,void*);
  long onUpdForeColor(FXObject*,FXSelector,void*);
  long onCmdBackColor(FXObject*,FXSelector,void*);
  long onUpdBackColor(FXObject*,FXSelector,void*);
  long onCmdFont(FXObject*,FXSelector,void*);
  long onCmdStipple(FXObject*,FXSelector,void*);
  long onCmdFillStyle(FXObject*,FXSelector,void*);
  long onUpdFillStyle(FXObject*,FXSelector,void*);
  long onCmdPrint(FXObject*,FXSelector,void*);
  long onCmdRedraw(FXObject*,FXSelector,void*);
public:
  enum{
    ID_LINES=FXMainWindow::ID_LAST,
    ID_SHAPES,
    ID_IMAGES,
    ID_LINE_WIDTH,
    ID_CLR,
    ID_SRC_AND_DST,
    ID_SRC_AND_NOT_DST,
    ID_SRC,
    ID_NOT_SRC_AND_DST,
    ID_DST,
    ID_SRC_XOR_DST,
    ID_SRC_OR_DST,
    ID_NOT_SRC_AND_NOT_DST,
    ID_NOT_SRC_XOR_DST,
    ID_NOT_DST,
    ID_SRC_OR_NOT_DST,
    ID_NOT_SRC,
    ID_NOT_SRC_OR_DST,
    ID_NOT_SRC_OR_NOT_DST,
    ID_SET,
    ID_LINE_SOLID,
    ID_LINE_ONOFF_DASH,
    ID_LINE_DOUBLE_DASH,
    ID_CAP_NOT_LAST,
    ID_CAP_BUTT,
    ID_CAP_ROUND,
    ID_CAP_PROJECTING,
    ID_JOIN_MITER,
    ID_JOIN_ROUND,
    ID_JOIN_BEVEL,
    ID_ERASE_COLOR,
    ID_FORE_COLOR,
    ID_BACK_COLOR,
    ID_FONT,
    ID_STIPPLE_0,
    ID_STIPPLE_NONE=ID_STIPPLE_0,
    ID_STIPPLE_BLACK=ID_STIPPLE_0,
    ID_STIPPLE_1,
    ID_STIPPLE_2,
    ID_STIPPLE_3,
    ID_STIPPLE_4,
    ID_STIPPLE_5,
    ID_STIPPLE_6,
    ID_STIPPLE_7,
    ID_STIPPLE_8,
    ID_STIPPLE_GRAY=ID_STIPPLE_8,
    ID_STIPPLE_9,
    ID_STIPPLE_10,
    ID_STIPPLE_11,
    ID_STIPPLE_12,
    ID_STIPPLE_13,
    ID_STIPPLE_14,
    ID_STIPPLE_15,
    ID_STIPPLE_16,
    ID_STIPPLE_WHITE=ID_STIPPLE_16,
    ID_STIPPLE_HORZ,
    ID_STIPPLE_VERT,
    ID_STIPPLE_CROSS,
    ID_STIPPLE_DIAG,
    ID_STIPPLE_REVDIAG,
    ID_STIPPLE_CROSSDIAG,
    ID_FILL_SOLID,
    ID_FILL_TILED,
    ID_FILL_STIPPLED,
    ID_FILL_OPAQUESTIPPLED,
    ID_PRINT,
    ID_REDRAW,
    ID_LAST
    };
public:
  DCTestWindow(FXApp *app);
  virtual void create();
  virtual void detach();
  virtual ~DCTestWindow();
  };


/*******************************************************************************/

// Message map
FXDEFMAP(DCTestWindow) DCTestWindowMap[]={
  FXMAPFUNC(SEL_PAINT,    DCTestWindow::ID_LINES,                                           DCTestWindow::onPaintLines),
  FXMAPFUNC(SEL_PAINT,    DCTestWindow::ID_SHAPES,                                          DCTestWindow::onPaintShapes),
  FXMAPFUNC(SEL_PAINT,    DCTestWindow::ID_IMAGES,                                          DCTestWindow::onPaintImages),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_FONT,                                            DCTestWindow::onCmdFont),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_PRINT,                                           DCTestWindow::onCmdPrint),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_ERASE_COLOR,                                     DCTestWindow::onCmdEraseColor),
  FXMAPFUNC(SEL_CHANGED,  DCTestWindow::ID_ERASE_COLOR,                                     DCTestWindow::onCmdEraseColor),
  FXMAPFUNC(SEL_UPDATE,   DCTestWindow::ID_ERASE_COLOR,                                     DCTestWindow::onUpdEraseColor),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_FORE_COLOR,                                      DCTestWindow::onCmdForeColor),
  FXMAPFUNC(SEL_CHANGED,  DCTestWindow::ID_FORE_COLOR,                                      DCTestWindow::onCmdForeColor),
  FXMAPFUNC(SEL_UPDATE,   DCTestWindow::ID_FORE_COLOR,                                      DCTestWindow::onUpdForeColor),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_BACK_COLOR,                                      DCTestWindow::onCmdBackColor),
  FXMAPFUNC(SEL_CHANGED,  DCTestWindow::ID_BACK_COLOR,                                      DCTestWindow::onCmdBackColor),
  FXMAPFUNC(SEL_UPDATE,   DCTestWindow::ID_BACK_COLOR,                                      DCTestWindow::onUpdBackColor),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_LINE_WIDTH,                                      DCTestWindow::onLineWidth),
  FXMAPFUNC(SEL_CHANGED,  DCTestWindow::ID_REDRAW,                                          DCTestWindow::onCmdRedraw),
  FXMAPFUNC(SEL_COMMAND,  DCTestWindow::ID_REDRAW,                                          DCTestWindow::onCmdRedraw),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_CLR,          DCTestWindow::ID_SET,              DCTestWindow::onCmdFunction),
  FXMAPFUNCS(SEL_UPDATE,  DCTestWindow::ID_CLR,          DCTestWindow::ID_SET,              DCTestWindow::onUpdFunction),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_LINE_SOLID,   DCTestWindow::ID_LINE_DOUBLE_DASH, DCTestWindow::onCmdLineStyle),
  FXMAPFUNCS(SEL_UPDATE,  DCTestWindow::ID_LINE_SOLID,   DCTestWindow::ID_LINE_DOUBLE_DASH, DCTestWindow::onUpdLineStyle),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_CAP_NOT_LAST, DCTestWindow::ID_CAP_PROJECTING,   DCTestWindow::onCmdCapStyle),
  FXMAPFUNCS(SEL_UPDATE,  DCTestWindow::ID_CAP_NOT_LAST, DCTestWindow::ID_CAP_PROJECTING,   DCTestWindow::onUpdCapStyle),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_JOIN_MITER,   DCTestWindow::ID_JOIN_BEVEL,       DCTestWindow::onCmdJoinStyle),
  FXMAPFUNCS(SEL_UPDATE,  DCTestWindow::ID_JOIN_MITER,   DCTestWindow::ID_JOIN_BEVEL,       DCTestWindow::onUpdJoinStyle),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_STIPPLE_0,    DCTestWindow::ID_STIPPLE_CROSSDIAG,DCTestWindow::onCmdStipple),
  FXMAPFUNCS(SEL_COMMAND, DCTestWindow::ID_FILL_SOLID,DCTestWindow::ID_FILL_OPAQUESTIPPLED, DCTestWindow::onCmdFillStyle),
  FXMAPFUNCS(SEL_UPDATE,  DCTestWindow::ID_FILL_SOLID,DCTestWindow::ID_FILL_OPAQUESTIPPLED, DCTestWindow::onUpdFillStyle),
  };


// Object implementation
FXIMPLEMENT(DCTestWindow,FXMainWindow,DCTestWindowMap,ARRAYNUMBER(DCTestWindowMap))


/*******************************************************************************/


// Make some windows
DCTestWindow::DCTestWindow(FXApp *app):FXMainWindow(app,"Device Context Test",NULL,NULL,DECOR_ALL,0,0,900,820){

  // Preferred line attributes
  lineStyle=LINE_SOLID;
  capStyle=CAP_BUTT;
  joinStyle=JOIN_MITER;

  // Tooltip
  new FXToolTip(getApp());

  // Alpha cursor
  alphacursor=new FXCursor(getApp(),cursordata,16,16,8,8);

  // GIF cursor
  gifcursor=new FXGIFCursor(getApp(),minifolder,8,8);

  // CUR cursor
  curcursor=new FXCURCursor(getApp(),copycursor);

  // Menubar
  FXMenuBar *menubar=new FXMenuBar(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X);

  // Separator
  new FXHorizontalSeparator(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|SEPARATOR_GROOVE);

  // Contents
  FXHorizontalFrame *contents=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH);

  // Controls on right
  FXVerticalFrame *controls=new FXVerticalFrame(contents,LAYOUT_RIGHT|LAYOUT_FILL_Y);

  // Block for blit modes
  new FXLabel(controls,"BLIT Function:",NULL,LAYOUT_LEFT);
  FXMatrix *blitgrid=new FXMatrix(controls,4,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, 0,0,0,0, 2,2,2,2, 0,0);

  // One button for each mode
  new FXButton(blitgrid,"Clear\tBLT_CLR",NULL,this,ID_CLR,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"And\tBLT_SRC_AND_DST",NULL,this,ID_SRC_AND_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"AndRev\tBLT_SRC_AND_NOT_DST",NULL,this,ID_SRC_AND_NOT_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Copy\tBLT_SRC",NULL,this,ID_SRC,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  new FXButton(blitgrid,"AndInv\tBLT_NOT_SRC_AND_DST",NULL,this,ID_NOT_SRC_AND_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"NoOp\tBLT_DST",NULL,this,ID_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Xor\tBLT_SRC_XOR_DST",NULL,this,ID_SRC_XOR_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Or\tBLT_SRC_OR_DST",NULL,this,ID_SRC_OR_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  new FXButton(blitgrid,"Nor\tBLT_NOT_SRC_AND_NOT_DST",NULL,this,ID_NOT_SRC_AND_NOT_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Equiv\tBLT_NOT_SRC_XOR_DST",NULL,this,ID_NOT_SRC_XOR_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Invert\tBLT_NOT_DST",NULL,this,ID_NOT_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"OrRev\tBLT_SRC_OR_NOT_DST",NULL,this,ID_SRC_OR_NOT_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  new FXButton(blitgrid,"CopyInv\tBLT_NOT_SRC",NULL,this,ID_NOT_SRC,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"OrInv\tBLT_NOT_SRC_OR_DST",NULL,this,ID_NOT_SRC_OR_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Nand\tBLT_NOT_SRC_OR_NOT_DST",NULL,this,ID_NOT_SRC_OR_NOT_DST,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(blitgrid,"Set\tBLT_SET",NULL,this,ID_SET,BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  lssolid=new FXGIFIcon(getApp(),solid_line,0,IMAGE_OPAQUE);
  lsonoffdash=new FXGIFIcon(getApp(),onoff_dash,FXRGB(0xb2,0xc0,0xdc),IMAGE_ALPHACOLOR);
  lsdoubledash=new FXGIFIcon(getApp(),double_dash,0,IMAGE_OPAQUE);

  // Line Dash Style
  new FXLabel(controls,"Line Style:",NULL,LAYOUT_LEFT);
  FXMatrix *linestyle=new FXMatrix(controls,3,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(linestyle,"\tLINE_SOLID",lssolid,this,ID_LINE_SOLID,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(linestyle,"\tLINE_ONOFF_DASH",lsonoffdash,this,ID_LINE_ONOFF_DASH,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(linestyle,"\tLINE_DOUBLE_DASH",lsdoubledash,this,ID_LINE_DOUBLE_DASH,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  cscapnotlast=new FXGIFIcon(getApp(),capnotlast);
  cscapbutt=new FXGIFIcon(getApp(),capbutt);
  cscapround=new FXGIFIcon(getApp(),capround);
  cscapproj=new FXGIFIcon(getApp(),capproj);

  // Line Cap Style
  new FXLabel(controls,"Cap Style:",NULL,LAYOUT_LEFT);
  FXMatrix *capstyle=new FXMatrix(controls,4,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(capstyle,"\tCAP_NOT_LAST",cscapnotlast,this,ID_CAP_NOT_LAST,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(capstyle,"\tCAP_BUTT",cscapbutt,this,ID_CAP_BUTT,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(capstyle,"\tCAP_ROUND",cscapround,this,ID_CAP_ROUND,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(capstyle,"\tCAP_PROJECTING",cscapproj,this,ID_CAP_PROJECTING,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  jsmiter=new FXGIFIcon(getApp(),jmiter);
  jsround=new FXGIFIcon(getApp(),jround);
  jsbevel=new FXGIFIcon(getApp(),jbevel);

  // Line Join Style
  new FXLabel(controls,"Join Style:",NULL,LAYOUT_LEFT);
  FXMatrix *joinstyle=new FXMatrix(controls,3,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(joinstyle,"\tJOIN_MITER",jsmiter,this,ID_JOIN_MITER,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(joinstyle,"\tJOIN_ROUND",jsround,this,ID_JOIN_ROUND,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(joinstyle,"\tJOIN_BEVEL",jsbevel,this,ID_JOIN_BEVEL,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  // Colors
  new FXLabel(controls,"Colors:",NULL,LAYOUT_LEFT);
  FXMatrix *pairs=new FXMatrix(controls,2,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 5,5);

  // Back Color
  new FXLabel(pairs, "Back Color:");
  backWell=new FXColorWell(pairs,FXRGB(0,0,255),this,ID_BACK_COLOR,FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);

  // Fore Color
  new FXLabel(pairs, "Fore Color:");
  foreWell=new FXColorWell(pairs,FXRGB(255,0,0),this,ID_FORE_COLOR,FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);

  // Erase Color
  new FXLabel(pairs, "Erase Color:");
  eraseWell=new FXColorWell(pairs,FXRGB(255,255,255),this,ID_ERASE_COLOR,FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);

  // Line weight
  FXMatrix *linew=new FXMatrix(controls,2,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXLabel(linew, "Line Width:");
  lineWidthSpinner=new FXSpinner(linew,4,this,ID_LINE_WIDTH,SPIN_NORMAL|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN);
  lineWidthSpinner->setRange(1,255);
  lineWidthSpinner->setValue(1);

  // Stipple
  FXMatrix *stip=new FXMatrix(controls,2,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXLabel(stip, "Stipples:");
  pop=new FXPopup(this);
  new FXOption(pop,"NONE\tSTIPPLE_NONE",NULL,this,ID_STIPPLE_NONE,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"BLACK\tSTIPPLE_BLACK",NULL,this,ID_STIPPLE_BLACK,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"GRAY\tSTIPPLE_GRAY",NULL,this,ID_STIPPLE_GRAY,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"WHITE\tSTIPPLE_WHITE",NULL,this,ID_STIPPLE_WHITE,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"0\tSTIPPLE_0",NULL,this,ID_STIPPLE_0,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"1\tSTIPPLE_1",NULL,this,ID_STIPPLE_1,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"2\tSTIPPLE_2",NULL,this,ID_STIPPLE_2,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"3\tSTIPPLE_3",NULL,this,ID_STIPPLE_3,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"4\tSTIPPLE_4",NULL,this,ID_STIPPLE_4,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"5\tSTIPPLE_5",NULL,this,ID_STIPPLE_5,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"6\tSTIPPLE_6",NULL,this,ID_STIPPLE_6,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"7\tSTIPPLE_7",NULL,this,ID_STIPPLE_7,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"8\tSTIPPLE_8",NULL,this,ID_STIPPLE_8,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"9\tSTIPPLE_9",NULL,this,ID_STIPPLE_9,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"10\tSTIPPLE_10",NULL,this,ID_STIPPLE_10,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"11\tSTIPPLE_11",NULL,this,ID_STIPPLE_11,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"12\tSTIPPLE_12",NULL,this,ID_STIPPLE_12,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"13\tSTIPPLE_13",NULL,this,ID_STIPPLE_13,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"14\tSTIPPLE_14",NULL,this,ID_STIPPLE_14,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"15\tSTIPPLE_15",NULL,this,ID_STIPPLE_15,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"16\tSTIPPLE_16",NULL,this,ID_STIPPLE_16,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"HORZ\tSTIPPLE_HORZ",NULL,this,ID_STIPPLE_HORZ,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"VERT\tSTIPPLE_VERT",NULL,this,ID_STIPPLE_VERT,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"CROSS\tSTIPPLE_CROSS",NULL,this,ID_STIPPLE_CROSS,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"DIAG\tSTIPPLE_DIAG",NULL,this,ID_STIPPLE_DIAG,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"REVDIAG\tSTIPPLE_REVDIAG",NULL,this,ID_STIPPLE_REVDIAG,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOption(pop,"CROSSDIAG\tSTIPPLE_CROSSDIAG",NULL,this,ID_STIPPLE_CROSSDIAG,JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
  new FXOptionMenu(stip,pop,LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|JUSTIFY_HZ_APART|ICON_AFTER_TEXT);

  // Fill Style
  new FXLabel(controls,"Fill Style:",NULL,LAYOUT_LEFT);
  FXMatrix *fillstyle=new FXMatrix(controls,2,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(fillstyle,"FILL_SOLID",NULL,this,ID_FILL_SOLID,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(fillstyle,"FILL_TILED",NULL,this,ID_FILL_TILED,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(fillstyle,"FILL_STIPPLED",NULL,this,ID_FILL_STIPPLED,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);
  new FXButton(fillstyle,"FILL_OPAQUESTIPPLED",NULL,this,ID_FILL_OPAQUESTIPPLED,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN);

  // Angles for arcs
  new FXLabel(controls,"Arc angles:",NULL,LAYOUT_LEFT);
  FXMatrix *arcangles=new FXMatrix(controls,3,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 4,4);

  new FXLabel(arcangles,"Ang1:",NULL,LAYOUT_LEFT);
  new FXTextField(arcangles,4,&ang1_target,FXDataTarget::ID_VALUE,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXSlider* sang1=new FXSlider(arcangles,&ang1_target,FXDataTarget::ID_VALUE,LAYOUT_CENTER_Y|LAYOUT_FILL_X|SLIDER_INSIDE_BAR|LAYOUT_FILL_COLUMN);
  sang1->setRange(-360,360);

  new FXLabel(arcangles,"Ang2:",NULL,LAYOUT_LEFT);
  new FXTextField(arcangles,4,&ang2_target,FXDataTarget::ID_VALUE,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXSlider* sang2=new FXSlider(arcangles,&ang2_target,FXDataTarget::ID_VALUE,LAYOUT_CENTER_Y|LAYOUT_FILL_X|SLIDER_INSIDE_BAR|LAYOUT_FILL_COLUMN);
  sang2->setRange(-360,360);

  // Radii for rounded rectangles
  new FXLabel(controls,"Radii:",NULL,LAYOUT_LEFT);
  FXMatrix *radii=new FXMatrix(controls,3,FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X, 0,0,0,0, 2,2,2,2, 4,4);

  new FXLabel(radii,"Crnw:",NULL,LAYOUT_LEFT);
  new FXTextField(radii,4,&cornerw_target,FXDataTarget::ID_VALUE,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXSlider* scornw=new FXSlider(radii,&cornerw_target,FXDataTarget::ID_VALUE,LAYOUT_CENTER_Y|LAYOUT_FILL_X|SLIDER_INSIDE_BAR|LAYOUT_FILL_COLUMN);
  scornw->setRange(0,100);

  new FXLabel(radii,"Crnh:",NULL,LAYOUT_LEFT);
  new FXTextField(radii,4,&cornerh_target,FXDataTarget::ID_VALUE,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXSlider* scornh=new FXSlider(radii,&cornerh_target,FXDataTarget::ID_VALUE,LAYOUT_CENTER_Y|LAYOUT_FILL_X|SLIDER_INSIDE_BAR|LAYOUT_FILL_COLUMN);
  scornh->setRange(0,100);

  // Font
  FXHorizontalFrame *fonts=new FXHorizontalFrame(controls,FRAME_RIDGE|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(fonts,"Font Dialog...\tChange the text font",NULL,this,ID_FONT,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // Printing
  FXHorizontalFrame *printer=new FXHorizontalFrame(controls,FRAME_RIDGE|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(printer,"Print Dialog...\tPrint it out",NULL,this,ID_PRINT,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // Quit
  FXHorizontalFrame *quitter=new FXHorizontalFrame(controls,FRAME_RIDGE|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, 0,0,0,0, 2,2,2,2, 0,0);
  new FXButton(quitter,"Bye Bye!",NULL,getApp(),FXApp::ID_QUIT,BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y);


  // Switcher
  FXTabBook *tabbook=new FXTabBook(contents,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT);

  // First page shows various line styles
  new FXTabItem(tabbook,"&Lines",NULL);
  FXPacker *linesPage=new FXPacker(tabbook,FRAME_THICK|FRAME_RAISED);


  FXHorizontalFrame* frame=new FXHorizontalFrame(linesPage,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
  linesCanvas=new FXCanvas(frame,this,ID_LINES,LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // Set special cursor
  linesCanvas->setDefaultCursor(alphacursor);
  linesCanvas->setDragCursor(alphacursor);

  // Second page shows different shapes
  new FXTabItem(tabbook,"&Shapes",NULL);
  FXPacker *shapesPage=new FXPacker(tabbook,FRAME_THICK|FRAME_RAISED);
  frame=new FXHorizontalFrame(shapesPage,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
  shapesCanvas=new FXCanvas(frame,this,ID_SHAPES,LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // Set special cursor
  shapesCanvas->setDefaultCursor(gifcursor);
  shapesCanvas->setDragCursor(gifcursor);

  // Third page shows images
  new FXTabItem(tabbook,"&Images",NULL);
  FXPacker *imagesPage=new FXPacker(tabbook,FRAME_THICK|FRAME_RAISED);
  frame=new FXHorizontalFrame(imagesPage,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
  imagesCanvas=new FXCanvas(frame,this,ID_IMAGES,LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // Set special cursor
  imagesCanvas->setDefaultCursor(curcursor);
  imagesCanvas->setDragCursor(curcursor);

  // File Menu
  filemenu=new FXMenuPane(this);
  new FXMenuCommand(filemenu,"&Print...\tCtl-P",NULL,this,ID_PRINT);
  new FXMenuCommand(filemenu,"&Font...\tCtl-F",NULL,this,ID_FONT);
  new FXMenuCommand(filemenu,"&Quit\tCtl-Q",NULL,getApp(),FXApp::ID_QUIT);
  new FXMenuTitle(menubar,"&File",NULL,filemenu);

  birdImage=new FXGIFImage(getApp(),dippy);
  textureImage=new FXGIFImage(getApp(),slate);
  bitmap=new FXBitmap(getApp(),bitmap_bits,0,bitmap_width,bitmap_height);

  function=BLT_SRC;
  lineStyle=LINE_SOLID;
  capStyle=CAP_BUTT;
  joinStyle=JOIN_MITER;
  fillStyle=FILL_SOLID;
  fillRule=RULE_EVEN_ODD;
  stipple=STIPPLE_NONE;
  forecolor=FXRGB(255,0,0);
  backcolor=FXRGB(0,0,255);
  erasecolor=FXRGB(255,255,255);
  ang1=0;
  ang2=90;
  testFont=new FXFont(getApp(),"helvetica",20,FXFont::Normal,FXFont::Straight,FONTENCODING_DEFAULT,FXFont::NonExpanded,FXFont::Scalable|FXFont::Rotatable);
  testFontAngle=new FXFont(getApp(),"helvetica",20,FXFont::Normal,FXFont::Straight,FONTENCODING_DEFAULT,FXFont::NonExpanded,FXFont::Scalable|FXFont::Rotatable);
  testFontAngle->setAngle(90*64);
//  testFontAngle->setAngle(45*64);
  ang1_target.connect(ang1);
  ang1_target.setTarget(this);
  ang1_target.setSelector(ID_REDRAW);
  ang2_target.connect(ang2);
  ang2_target.setTarget(this);
  ang2_target.setSelector(ID_REDRAW);

  cornerw=10;
  cornerh=10;

  cornerw_target.connect(cornerw);
  cornerw_target.setTarget(this);
  cornerw_target.setSelector(ID_REDRAW);
  cornerh_target.connect(cornerh);
  cornerh_target.setTarget(this);
  cornerh_target.setSelector(ID_REDRAW);

  }


// Clean up
DCTestWindow::~DCTestWindow(){
  delete testFont;
  delete testFontAngle;
  delete birdImage;
  delete textureImage;
  delete bitmap;
  delete filemenu;
  delete pop;
  delete lssolid;
  delete lsonoffdash;
  delete lsdoubledash;
  delete cscapnotlast;
  delete cscapbutt;
  delete cscapround;
  delete cscapproj;
  delete jsmiter;
  delete jsround;
  delete jsbevel;
  delete alphacursor;
  delete gifcursor;
  delete curcursor;
  }


// Create
void DCTestWindow::create(){
  FXMainWindow::create();
  birdImage->create();
  textureImage->create();
  testFont->create();
  testFontAngle->create();
  bitmap->create();
  alphacursor->create();
  gifcursor->create();
  curcursor->create();
  show(PLACEMENT_SCREEN);
  }


// Detach
void DCTestWindow::detach(){
  FXMainWindow::detach();
  birdImage->detach();
  textureImage->detach();
  testFont->detach();
  testFontAngle->detach();
  bitmap->detach();
  }


// Changed RasterOp function
long DCTestWindow::onCmdFunction(FXObject*,FXSelector sel,void*){
  function=(FXFunction)(BLT_CLR+FXSELID(sel)-ID_CLR);
  linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
  return 1;
  }

// Update RasterOp function
long DCTestWindow::onUpdFunction(FXObject* sender,FXSelector sel,void*){
  FXFunction ff=(FXFunction)(BLT_CLR+FXSELID(sel)-ID_CLR);
  if(ff==function)
    sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
  else
    sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
  return 1;
  }


// Changed Line Style
long DCTestWindow::onCmdLineStyle(FXObject*,FXSelector sel,void*){
  lineStyle=(FXLineStyle)(LINE_SOLID+FXSELID(sel)-ID_LINE_SOLID);
  linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
  return 1;
  }

// Update Line Style
long DCTestWindow::onUpdLineStyle(FXObject* sender,FXSelector sel,void*){
  FXLineStyle ff=(FXLineStyle)(LINE_SOLID+FXSELID(sel)-ID_LINE_SOLID);
  if(ff==lineStyle)
    sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
  else
    sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
  return 1;
  }


// Changed Cap Style
long DCTestWindow::onCmdCapStyle(FXObject*,FXSelector sel,void*){
  capStyle=(FXCapStyle)(CAP_NOT_LAST+FXSELID(sel)-ID_CAP_NOT_LAST);
  linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
  return 1;
  }

// Update Cap Style
long DCTestWindow::onUpdCapStyle(FXObject* sender,FXSelector sel,void*){
  FXCapStyle ff=(FXCapStyle)(CAP_NOT_LAST+FXSELID(sel)-ID_CAP_NOT_LAST);
  if(ff==capStyle)
    sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
  else
    sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
  return 1;
  }

// Changed Join Style
long DCTestWindow::onCmdJoinStyle(FXObject*,FXSelector sel,void*){
  joinStyle=(FXJoinStyle)(JOIN_MITER+FXSELID(sel)-ID_JOIN_MITER);
  linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
  return 1;
  }

// Update Join Style
long DCTestWindow::onUpdJoinStyle(FXObject* sender,FXSelector sel,void*){
  FXJoinStyle ff=(FXJoinStyle)(JOIN_MITER+FXSELID(sel)-ID_JOIN_MITER);
  if(ff==joinStyle)
    sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
  else
    sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
  return 1;
  }


// Erase Color
long DCTestWindow::onCmdEraseColor(FXObject*,FXSelector,void* ptr){
  erasecolor=(FXColor)(FXuval)ptr;
  linesCanvas->update();
  shapesCanvas->update();
  imagesCanvas->update();
  return 1;
  }

// Update Erase Color
long DCTestWindow::onUpdEraseColor(FXObject* sender,FXSelector,void*){
  sender->handle(this,FXSEL(SEL_COMMAND,ID_SETVALUE),(void*)(FXuval)erasecolor);
  return 1;
  }


// Foreground Color
long DCTestWindow::onCmdForeColor(FXObject*,FXSelector,void* ptr){
  forecolor=(FXColor)(FXuval)ptr;
  linesCanvas->update();
  shapesCanvas->update();
  imagesCanvas->update();
  return 1;
  }


// Update Foreground Color
long DCTestWindow::onUpdForeColor(FXObject* sender,FXSelector,void*){
  sender->handle(this,FXSEL(SEL_COMMAND,ID_SETVALUE),(void*)(FXuval)forecolor);
  return 1;
  }

// Back Color
long DCTestWindow::onCmdBackColor(FXObject*,FXSelector,void* ptr){
  backcolor=(FXColor)(FXuval)ptr;
  linesCanvas->update();
  shapesCanvas->update();
  imagesCanvas->update();
  return 1;
  }


// Update Back Color
long DCTestWindow::onUpdBackColor(FXObject* sender,FXSelector,void*){
  sender->handle(this,FXSEL(SEL_COMMAND,ID_SETVALUE),(void*)(FXuval)backcolor);
  return 1;
  }


// Change font
long DCTestWindow::onCmdFont(FXObject*,FXSelector,void*){
  FXFontDialog fontdlg(this,"Change Font",DECOR_BORDER|DECOR_TITLE);
  FXFontDesc fontdesc;
  testFont->getFontDesc(fontdesc);
  fontdlg.setFontSelection(fontdesc);
  if(fontdlg.execute()){
    fontdlg.getFontSelection(fontdesc);
    delete testFont;
    delete testFontAngle;
    testFont=new FXFont(getApp(),fontdesc);
    testFont->create();
    testFontAngle=new FXFont(getApp(),fontdesc);
    testFontAngle->setAngle(90*64);
    testFontAngle->create();
    linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
    }
  return 1;
  }


// User changes the line width
long DCTestWindow::onLineWidth(FXObject*,FXSelector,void*){
  linesCanvas->update();
  return 1;
  }


// Change stipple
long DCTestWindow::onCmdStipple(FXObject*,FXSelector sel,void*){
  stipple=(FXStipplePattern)(STIPPLE_NONE+FXSELID(sel)-ID_STIPPLE_0);
  linesCanvas->update();
  shapesCanvas->update();
  return 1;
  }


// Changed Fill Style
long DCTestWindow::onCmdFillStyle(FXObject*,FXSelector sel,void*){
  fillStyle=(FXFillStyle)(FILL_SOLID+FXSELID(sel)-ID_FILL_SOLID);
  linesCanvas->update();
  shapesCanvas->update();
  return 1;
  }

// Update Fill Style
long DCTestWindow::onUpdFillStyle(FXObject* sender,FXSelector sel,void*){
  FXFillStyle ff=(FXFillStyle)(FILL_SOLID+FXSELID(sel)-ID_FILL_SOLID);
  if(ff==fillStyle)
    sender->handle(this,FXSEL(SEL_COMMAND,ID_CHECK),NULL);
  else
    sender->handle(this,FXSEL(SEL_COMMAND,ID_UNCHECK),NULL);
  return 1;
  }


// Redraw
long DCTestWindow::onCmdRedraw(FXObject*,FXSelector,void*){
  linesCanvas->update(0,0,linesCanvas->getWidth(),linesCanvas->getHeight());
  return 1;
  }


// Repaint the lines page
long DCTestWindow::onPaintLines(FXObject *sender,FXSelector,void *ptr){
  FXCanvas *canvas=(FXCanvas*) sender;
  FXEvent *ev=(FXEvent*)ptr;
  FXDCWindow dc(canvas,ev);
  drawPage(dc,canvas->getWidth(),canvas->getHeight());
  return 1;
  }


// Repaint the shapes page
long DCTestWindow::onPaintShapes(FXObject *sender,FXSelector,void *ptr){
  FXCanvas *canvas=(FXCanvas*)sender;
  FXEvent *ev=(FXEvent*)ptr;
  FXDCWindow dc(canvas,ev);
  dc.setForeground(eraseWell->getRGBA());
  dc.fillRectangle(0,0,canvas->getWidth(),canvas->getHeight());

  dc.setForeground(foreWell->getRGBA());
  dc.setBackground(backWell->getRGBA());
  dc.drawRectangle(5,5,50,50);
  dc.fillRectangle(60,5,50,50);

  dc.setForeground(foreWell->getRGBA());
  dc.setBackground(backWell->getRGBA());
  dc.drawArc(5,60,50,50,0,64*90);
  dc.fillArc(60,60,50,50,64*90,64*180);

  dc.setForeground(foreWell->getRGBA());
  dc.setBackground(backWell->getRGBA());
  dc.drawBitmap(bitmap,115,5);

  FXPoint poly_letter[10];

  // Letter 'F'
  poly_letter[0].x=0;  poly_letter[0].y=0;
  poly_letter[1].x=45; poly_letter[1].y=0;
  poly_letter[2].x=45; poly_letter[2].y=15;
  poly_letter[3].x=15; poly_letter[3].y=15;
  poly_letter[4].x=15; poly_letter[4].y=30;
  poly_letter[5].x=30; poly_letter[5].y=30;
  poly_letter[6].x=30; poly_letter[6].y=45;
  poly_letter[7].x=15; poly_letter[7].y=45;
  poly_letter[8].x=15; poly_letter[8].y=75;
  poly_letter[9].x=0;  poly_letter[9].y=75;

  // Region for F
  FXRegion letter_F(poly_letter,10);

  // Letter O outside
  poly_letter[0].x=15; poly_letter[0].y=0;
  poly_letter[1].x=30; poly_letter[1].y=0;
  poly_letter[2].x=45; poly_letter[2].y=15;
  poly_letter[3].x=45; poly_letter[3].y=60;
  poly_letter[4].x=30; poly_letter[4].y=75;
  poly_letter[5].x=15; poly_letter[5].y=75;
  poly_letter[6].x=0;  poly_letter[6].y=60;
  poly_letter[7].x=0;  poly_letter[7].y=15;

  // Region for outer O
  FXRegion letter_O(poly_letter,8);

  // Letter O inside
  poly_letter[0].x=22; poly_letter[0].y=15;
  poly_letter[1].x=30; poly_letter[1].y=22;
  poly_letter[2].x=30; poly_letter[2].y=53;
  poly_letter[3].x=22; poly_letter[3].y=60;
  poly_letter[4].x=15; poly_letter[4].y=53;
  poly_letter[5].x=15; poly_letter[5].y=22;

  // Substract inner O
  letter_O -= FXRegion(poly_letter,6);

  // Letter X left slant
  poly_letter[0].x=0;  poly_letter[0].y=0;
  poly_letter[1].x=15; poly_letter[1].y=0;
  poly_letter[2].x=45; poly_letter[2].y=75;
  poly_letter[3].x=30; poly_letter[3].y=75;

  // Region for X
  FXRegion letter_X(poly_letter,4);

  // Letter X right slant
  poly_letter[0].x=0;  poly_letter[0].y=75;
  poly_letter[1].x=15; poly_letter[1].y=75;
  poly_letter[2].x=45; poly_letter[2].y=0;
  poly_letter[3].x=30; poly_letter[3].y=0;

  // Add slants together
  letter_X += FXRegion(poly_letter,4);

  // Make the word "FOX"
  FXRegion word_FOX=letter_F.offset(100,100)+letter_O.offset(150,100)+letter_X.offset(200,100);

  // Set foreground and background
  dc.setForeground(foreWell->getRGBA());
  dc.setBackground(backWell->getRGBA());

  // Set stipple and fill
  dc.setStipple(stipple);
  dc.setFillStyle(fillStyle);
  dc.setTile(textureImage);

  // Set region for clip
  dc.setClipRegion(word_FOX);

  // Get region bounds
  FXRectangle rect=word_FOX.bounds();

  // Draw through region
  dc.fillRectangles(&rect,1);

  return 1;
  }


// Repaint the images page
long DCTestWindow::onPaintImages(FXObject *sender,FXSelector,void *ptr){
  FXCanvas *canvas=(FXCanvas*)sender;
  FXEvent *ev=(FXEvent*)ptr;
  FXDCWindow dc(canvas,ev);
  dc.setForeground(eraseWell->getRGBA());
  dc.fillRectangle(0,0,canvas->getWidth(),canvas->getHeight());
  dc.drawImage(birdImage,0,0);
  return 1;
  }


// This is the WYSIWYG routine, it takes a DC and renders
// into it; it does not know if the DC is a printer or screen.
void DCTestWindow::drawPage(FXDC& dc,FXint w,FXint h){

  dc.setForeground(erasecolor);
  dc.fillRectangle(0,0,w,h);

  dc.setForeground(forecolor);
  dc.setBackground(backcolor);

  dc.setLineStyle(lineStyle);
  dc.setLineCap(capStyle);
  dc.setLineJoin(joinStyle);
  dc.setFunction(function);

  dc.setStipple(stipple);
  dc.setFillStyle(fillStyle);
  dc.setLineWidth(lineWidthSpinner->getValue());
  dc.setTile(textureImage);

  // Here's a single line
  dc.drawLine(20,200,w-20,200);

  // Here are some connected lines (to show join styles)
  FXPoint points[6];
  points[0].x=10;              points[0].y=3*h/4;
  points[1].x=points[0].x+w/6; points[1].y=h/2;
  points[2].x=points[1].x+w/6; points[2].y=points[0].y;
  points[3].x=points[2].x+w/6; points[3].y=points[1].y;
  points[4].x=points[3].x+w/6; points[4].y=points[0].y;
  points[5].x=points[4].x+w/6; points[5].y=points[1].y;
  dc.drawLines(points,6);

  FXString string="Font: "+testFont->getName()+"  Size: "+FXStringVal(testFont->getSize()/10);
  dc.setFont(testFont);
  dc.setForeground(forecolor);
  dc.setBackground(backcolor);
  dc.drawText(30,h-70,string.text(),string.length());
  dc.drawImageText(30,h-30,string.text(),string.length());

  dc.setFont(testFontAngle);
  dc.drawText(30,h-90,string.text(),string.length());
  dc.drawImageText(70,h-90,string.text(),string.length());


  dc.setForeground(forecolor);
  dc.setBackground(backcolor);
  dc.drawRectangle(20,20,200,100);
  dc.fillRectangle(300,20,200,100);

  dc.drawArc(20,120,100,100,64*ang1,64*ang2);
  dc.fillArc(200,120,100,100,64*ang1,64*ang2);
  dc.fillChord(400,120,100,100,64*ang1,64*ang2);

  dc.drawRoundRectangle(300,230,100,60, cornerw,cornerh);

  dc.fillRoundRectangle(420,230,100,60, cornerw,cornerh);

  FXPoint poly[5];
  poly[0].x=50;          poly[0].y=230;
  poly[1].x=poly[0].x+40; poly[1].y=poly[0].y+20;
  poly[2].x=poly[0].x+30; poly[2].y=poly[0].y+60;
  poly[3].x=poly[0].x-30; poly[3].y=poly[0].y+60;
  poly[4].x=poly[0].x-40; poly[4].y=poly[0].y+20;
  dc.fillPolygon(poly,5);

  poly[0].x=150;          poly[0].y=230;
  poly[1].x=poly[0].x+30; poly[1].y=poly[0].y+60;
  poly[2].x=poly[0].x-40; poly[2].y=poly[0].y+20;
  poly[3].x=poly[0].x+40; poly[3].y=poly[0].y+20;
  poly[4].x=poly[0].x-30; poly[4].y=poly[0].y+60;
  dc.fillComplexPolygon(poly,5);

  poly[0].x=250;          poly[0].y=230;
  poly[1].x=poly[0].x+30; poly[1].y=poly[0].y+60;
  poly[2].x=poly[0].x-40; poly[2].y=poly[0].y+20;
  poly[3].x=poly[0].x+40; poly[3].y=poly[0].y+20;
  poly[4].x=poly[0].x-30; poly[4].y=poly[0].y+60;
  dc.setFillRule(RULE_WINDING);
  dc.fillComplexPolygon(poly,5);

  FXPoint concave[4];
  concave[0].x=w-100; concave[0].y=h-100;
  concave[1].x=concave[0].x+40; concave[1].y=concave[0].y-20;
  concave[2].x=concave[0].x;    concave[2].y=concave[0].y+40;
  concave[3].x=concave[0].x-40; concave[3].y=concave[0].y-20;
  dc.fillConcavePolygon(concave,4);

  dc.drawEllipse(50,500,100,60);
  dc.fillEllipse(250,500,100,60);

  // Draw a pale blue dot :-)
  dc.setForeground(FXRGB(128,128,255));
  dc.drawPoint(w-20,h-20);
  }


// Print the text
long DCTestWindow::onCmdPrint(FXObject*,FXSelector,void*){
  FXPrintDialog dlg(this,"Print Graphics");
  FXPrinter printer;
  if(dlg.execute()){
    dlg.getPrinter(printer);
    FXTRACE((100,"Printer = %s\n",printer.name.text()));
    FXDCPrint pdc(getApp());
    if(!pdc.beginPrint(printer)){
      FXMessageBox::error(this,MBOX_OK,"Printer Error","Unable to print");
      return 1;
      }
    pdc.beginPage(1);
    drawPage(pdc,500,500);
    pdc.endPage();
    pdc.endPrint();
    }
  return 1;
  }

/*******************************************************************************/


// Start the whole thing
int main(int argc,char *argv[]){

  // Make application
  FXApp application("DCTest","FoxTest");

  // Open display
  application.init(argc,argv);

  // Make the main window
  new DCTestWindow(&application);

  // Create app
  application.create();

  // Go
  return application.run();
  }


