image.H 2.88 KB
/******************************************************************************\  Copyright 1995 The University of North Carolina at Chapel Hill.
  All Rights Reserved.

  Permission to use, copy, modify and distribute this software and its
  documentation for educational, research and non-profit purposes, without
  fee, and without a written agreement is hereby granted, provided that the
  above copyright notice and the following three paragraphs appear in all
  copies.

  IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA
  AT CHAPEL HILL BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
  INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
  OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE
  UNIVERSITY OF NORTH CAROLINA HAS BEEN ADVISED OF THE POSSIBILITY OF
  SUCH DAMAGES.

  THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HERUNDER IS
  ON AN "AS IS" BASIS, AND THE UNIVERSITY OF NORTH CAROLINA HAS NO OBLIGATIONS
  TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

  The author may be contacted via:

  US Mail:             Mike Goslin
                       Department of Computer Science
                       Sitterson Hall, CB #3175
                       University of N. Carolina
                       Chapel Hill, NC 27599-3175

  Phone:               (919)962-1719

  EMail:               goslin@cs.unc.edu

*******************************************************************************/
/*******************************************************************************
* FILENAME:     image.H
* CLASS:        Image 
* DESCRIPTION:
* AUTHOR:       Mike Goslin
* CREATED:      3/29/95 
* REVISIONS:    
*
*******************************************************************************/

#ifndef _IMAGE_HPP_
#define _IMAGE_HPP_

#include <stdio.h>
#include "bead.H"

typedef unsigned char txtrData[3];  // r, g, b

#define IM_BYTE		 	sizeof(unsigned char)	
#define IM_SHORT		sizeof(unsigned short)
#define IM_LONG			sizeof(unsigned long)	
#define IM_FLOAT	 	sizeof(float)	
#define IM_DOUBLE		sizeof(double)	
#define IM_DATA			sizeof(txtrData) 

class Image
{
	txtrData	      **data;
	uint			xsize,
				ysize,
				type,
	 			typePtr;
	void matchPointer(void);
	uint allocate(void);
    public:
	Image(void);
	Image(uint size);
	Image(uint size, uint _type);
	~Image();
 	txtrData& operator()(uint row, uint col);	
//	Image& operator()(uint row, uint col, txtrData value);
//	void operator()(uint row, uint col, txtrData value);
//	Image& set(uint row, uint col, txtrData value);
	void set(uint col, uint row, txtrData value);
//	Image& set(txtrData value);
	void set(txtrData value);
	uint sizex(void) { return (xsize); }
	uint sizey(void) { return (ysize); }
	uint Write(FILE *file);
};

#endif