JX Application Framework
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
JImage Class Referenceabstract

#include <JImage.h>

Inheritance diagram for JImage:
[legend]

Classes

class  FileIsNotGIF
 
class  FileIsNotJPEG
 
class  FileIsNotPNG
 
class  FileIsNotXBM
 
class  FileIsNotXPM
 
class  TooManyColors
 
class  UnknownFileType
 

Public Types

enum  FileType {
  kUnknownType ,
  kGIFType ,
  kPNGType ,
  kJPEGType ,
  kXPMType ,
  kXBMType
}
 

Public Member Functions

 JImage (const JCoordinate width, const JCoordinate height, JColorManager *colorManager)
 
virtual ~JImage ()
 
JCoordinate GetWidth () const
 
JCoordinate GetHeight () const
 
JRect GetBounds () const
 
JColorManagerGetColorManager () const
 
virtual JColorID GetColor (const JCoordinate x, const JCoordinate y) const =0
 
virtual void SetColor (const JCoordinate x, const JCoordinate y, const JColorID color)=0
 
virtual bool GetMask (JImageMask **mask) const =0
 
JError WriteGIF (const JString &fileName, const bool compressColorsToFit, const bool interlace=false) const
 
JError WritePNG (const JString &fileName, const bool useTrueColor=true, const bool compressColorsToFit=false, const bool interlace=false) const
 
JError WriteJPEG (const JString &fileName, const bool interlace=false, const int quality=-1) const
 
virtual unsigned long GetSystemColor (const JColorID color) const =0
 
virtual unsigned long GetSystemColor (const JCoordinate x, const JCoordinate y) const =0
 

Static Public Member Functions

static FileType GetFileType (const JString &fileName)
 

Static Public Attributes

static const JUtf8BytekUnknownFileType = "UnknownFileType::JImage"
 
static const JUtf8BytekFileIsNotGIF = "FileIsNotGIF::JImage"
 
static const JUtf8BytekGIFNotAvailable = "GIFNotAvailable::JImage"
 
static const JUtf8BytekFileIsNotPNG = "FileIsNotPNG::JImage"
 
static const JUtf8BytekPNGNotAvailable = "PNGNotAvailable::JImage"
 
static const JUtf8BytekFileIsNotJPEG = "FileIsNotJPEG::JImage"
 
static const JUtf8BytekJPEGNotAvailable = "JPEGNotAvailable::JImage"
 
static const JUtf8BytekFileIsNotXPM = "FileIsNotXPM::JImage"
 
static const JUtf8BytekXPMNotAvailable = "XPMNotAvailable::JImage"
 
static const JUtf8BytekFileIsNotXBM = "FileIsNotXBM::JImage"
 
static const JUtf8BytekTooManyColors = "TooManyColors::JImage"
 

Protected Member Functions

 JImage (const JImage &source)
 
void SetDimensions (const JCoordinate width, const JCoordinate height)
 
JError ReadGIF (const JString &fileName)
 
JError ReadPNG (const JString &fileName)
 
JError ReadJPEG (const JString &fileName)
 
void ReadFromJXPM (const JXPM &pixmap)
 
virtual void SetImageData (const JSize colorCount, const JColorID *colorTable, unsigned short **imageData, const bool hasMask, const unsigned long maskColor)=0
 
virtual void PrepareForImageData ()=0
 
virtual void ImageDataFinished ()=0
 

Static Protected Member Functions

static JError AllocateImageData (const JCoordinate w, const JCoordinate h, unsigned short **data, unsigned short ***cols)
 

Detailed Description

Pure virtual base class to represent an offscreen picture.

Member Enumeration Documentation

◆ FileType

Enumerator
kUnknownType 
kGIFType 
kPNGType 
kJPEGType 
kXPMType 
kXBMType 

Constructor & Destructor Documentation

◆ JImage() [1/2]

JImage::JImage ( const JCoordinate  width,
const JCoordinate  height,
JColorManager colorManager 
)

◆ ~JImage()

JImage::~JImage ( )
virtual

◆ JImage() [2/2]

JImage::JImage ( const JImage source)
protected

Member Function Documentation

◆ AllocateImageData()

JError JImage::AllocateImageData ( const JCoordinate  w,
const JCoordinate  h,
unsigned short **  data,
unsigned short ***  cols 
)
staticprotected

Allocate space for image data of the given width and height. Delete both arrays with "delete []". This data can be passed to SetImageData().

We return an error because it is not unreasonable that the user might request an image larger than will fit in memory.

◆ GetBounds()

JRect JImage::GetBounds ( ) const
inline

◆ GetColor()

virtual JColorID JImage::GetColor ( const JCoordinate  x,
const JCoordinate  y 
) const
pure virtual

Implemented in JXImage.

◆ GetColorManager()

JColorManager * JImage::GetColorManager ( ) const
inline

◆ GetFileType()

JImage::FileType JImage::GetFileType ( const JString fileName)
static

Returns the type of image stored in the file.

We do not deal with compressed files because most image formats are already inherently compressed.

◆ GetHeight()

JCoordinate JImage::GetHeight ( ) const
inline

◆ GetMask()

virtual bool JImage::GetMask ( JImageMask **  mask) const
pure virtual

Implemented in JXImage.

◆ GetSystemColor() [1/2]

virtual unsigned long JImage::GetSystemColor ( const JColorID  color) const
pure virtual

Implemented in JXImage.

◆ GetSystemColor() [2/2]

virtual unsigned long JImage::GetSystemColor ( const JCoordinate  x,
const JCoordinate  y 
) const
pure virtual

Implemented in JXImage.

◆ GetWidth()

JCoordinate JImage::GetWidth ( ) const
inline

◆ ImageDataFinished()

virtual void JImage::ImageDataFinished ( )
protectedpure virtual

Implemented in JXImage.

◆ PrepareForImageData()

virtual void JImage::PrepareForImageData ( )
protectedpure virtual

Implemented in JXImage.

◆ ReadFromJXPM()

void JImage::ReadFromJXPM ( const JXPM pixmap)
protected

This only works for XPM's with up to 255 colors. This shouldn't be a problem, because even with that many, you shouldn't be using XPM's.

Color approximation is controlled by the settings in the colorManager object.

◆ ReadGIF()

JError JImage::ReadGIF ( const JString fileName)
protected

◆ ReadJPEG()

JError JImage::ReadJPEG ( const JString fileName)
protected

◆ ReadPNG()

JError JImage::ReadPNG ( const JString fileName)
protected

◆ SetColor()

virtual void JImage::SetColor ( const JCoordinate  x,
const JCoordinate  y,
const JColorID  color 
)
pure virtual

Implemented in JXImage.

◆ SetDimensions()

void JImage::SetDimensions ( const JCoordinate  width,
const JCoordinate  height 
)
inlineprotected

◆ SetImageData()

virtual void JImage::SetImageData ( const JSize  colorCount,
const JColorID colorTable,
unsigned short **  imageData,
const bool  hasMask,
const unsigned long  maskColor 
)
protectedpure virtual

Implemented in JXImage.

◆ WriteGIF()

JError JImage::WriteGIF ( const JString fileName,
const bool  compressColorsToFit,
const bool  interlace = false 
) const

◆ WriteJPEG()

JError JImage::WriteJPEG ( const JString fileName,
const bool  interlace = false,
const int  quality = -1 
) const

◆ WritePNG()

JError JImage::WritePNG ( const JString fileName,
const bool  useTrueColor = true,
const bool  compressColorsToFit = false,
const bool  interlace = false 
) const

Member Data Documentation

◆ kFileIsNotGIF

const JUtf8Byte * JImage::kFileIsNotGIF = "FileIsNotGIF::JImage"
static

◆ kFileIsNotJPEG

const JUtf8Byte * JImage::kFileIsNotJPEG = "FileIsNotJPEG::JImage"
static

◆ kFileIsNotPNG

const JUtf8Byte * JImage::kFileIsNotPNG = "FileIsNotPNG::JImage"
static

◆ kFileIsNotXBM

const JUtf8Byte * JImage::kFileIsNotXBM = "FileIsNotXBM::JImage"
static

◆ kFileIsNotXPM

const JUtf8Byte * JImage::kFileIsNotXPM = "FileIsNotXPM::JImage"
static

◆ kGIFNotAvailable

const JUtf8Byte * JImage::kGIFNotAvailable = "GIFNotAvailable::JImage"
static

◆ kJPEGNotAvailable

const JUtf8Byte * JImage::kJPEGNotAvailable = "JPEGNotAvailable::JImage"
static

◆ kPNGNotAvailable

const JUtf8Byte * JImage::kPNGNotAvailable = "PNGNotAvailable::JImage"
static

◆ kTooManyColors

const JUtf8Byte * JImage::kTooManyColors = "TooManyColors::JImage"
static

◆ kUnknownFileType

const JUtf8Byte * JImage::kUnknownFileType = "UnknownFileType::JImage"
static

◆ kXPMNotAvailable

const JUtf8Byte * JImage::kXPMNotAvailable = "XPMNotAvailable::JImage"
static

The documentation for this class was generated from the following files: