class PRealColour: public PColour

A class representing a colour specification that is representable on a specific PCanvas.

Inheritance:


Public Methods

[more] PRealColour ( PCanvas & canvas, const PColour & colour )
Create a colour as close to the specified colour that is representable on the specified canvas.
[more]virtual PObject* Clone () const
Create a new copy of the real colour.
[more]virtual void SetRed (BYTE r)
Set the red component of the colour.
[more]virtual void SetGreen (BYTE g)
Set the green component of the colour.
[more]virtual void SetBlue (BYTE b)
Set the blue component of the colour.
[more]virtual void SetAlpha (BYTE a)
Set the alpha channel component of the colour.

Public

[more] Overrides from class PObject
[more] Overrides from class PColour


Inherited from PColour:

Public Classes

oenum StandardColours

Public Methods

ovirtual Comparison Compare( const PObject & obj ) const
ovirtual PINDEX HashFunction() const
oPString GetDescription() const
oBYTE GetRed() const
oBYTE GetGreen() const
oBYTE GetBlue() const
oBYTE GetAlpha() const
oBYTE operator[]( PINDEX component ) const
olong GetDistance( const PColour & other ) const

Public

New functions for class

o Component indexes for \Ref{operator[]} access method.

Protected Fields

oBYTE component[NumComponents]


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions

Miscellaneous functions


Documentation

A class representing a colour specification that is representable on a specific PCanvas.

A canvas is always associated with a particular device. This may be the screen as in PInteractorCanvas or a printer as in PPrinterCanvas. A particular device will only be able to render certain colours, eg a screen device may be able to display full 32 bit colours or only 8 bit palettised colours. A printer would typically only be able to render 2 colours, black and white.

Thus when a user wishes to render a light shade of pastel pink, as defined by the RGB values in the PColour object, the device, eg a dot matrix colour printer, may only be able to render solid red. The creation of a PRealColour from the canvas and PColour will yield the RGB values 255, 0, and 0 respectively.

A further purpose of a realised colour is to reserve a particular RGB value for use in a palettised device. For example, if an 8 bit screen is used which provides 256 simultaneous colours, the realisation of a colour that is not currently in the palette for the screen, will add a new colour to the palette. If the colour was alreadyt in the palette then a reference count for it is incremented. That specific RGB colour is then reserved until all the relised colours that reference it are destroyed.

Note that the above reservation does not occur if an explicit palette is provided by the user, ie an instance of PPalette is created and attached to the device via the PCanvas::SetPalette() function.

o PRealColour( PCanvas & canvas, const PColour & colour )
Create a colour as close to the specified colour that is representable on the specified canvas.
Parameters:
canvas - Canvas to realise colour for.
colour - Colour specification to realise.

o Overrides from class PObject

ovirtual PObject* Clone() const
Create a new copy of the real colour. Note that it is the responsibility of the caller to delete the new object.

Returns:
new colour object on heap.

o Overrides from class PColour

ovirtual void SetRed(BYTE r)
Set the red component of the colour.

This is not allowed on a real colour and always asserts.

ovirtual void SetGreen(BYTE g)
Set the green component of the colour.

This is not allowed on a real colour and always asserts.

ovirtual void SetBlue(BYTE b)
Set the blue component of the colour.

This is not allowed on a real colour and always asserts.

ovirtual void SetAlpha(BYTE a)
Set the alpha channel component of the colour.

This is not allowed on a real colour and always asserts.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.