tbx  0.7.3
Public Member Functions | Static Public Member Functions | List of all members
tbx::JPEG Class Reference

Class to load and display JPEG images. More...

#include <jpeg.h>

Inheritance diagram for tbx::JPEG:
tbx::Image

Public Member Functions

 JPEG ()
 Construct an unloaded JPEG image.
 
 JPEG (const JPEG &other)
 Copy constructor.
 
virtual ~JPEG ()
 Destroy image data if loaded.
 
JPEGoperator= (const JPEG &other)
 Assignment operator.
 
virtual void plot (int x, int y) const
 Plot jpeg to screen. More...
 
virtual void plot (const Point &pos) const
 Plot jpeg to screen. More...
 
bool load (const std::string &file_name)
 Load JPEG from file. More...
 
void plot (int x, int y, const ScaleFactors &sf)
 Plot the jpeg with the given scale factors. More...
 
void plot (const BBox &bbox)
 Plot jpeg image in given box. More...
 
void plot (const DrawTransform &dt)
 Plot JPEG using a DrawTransform. More...
 
void dithered (bool dither)
 Set flag to control dithering when plotting. More...
 
bool dithered () const
 Return dithered plot flag. More...
 
void error_defused (bool error_defused)
 Set flag to control error defusion when plotting. More...
 
bool error_defused () const
 Return error defused plot flag. More...
 
bool is_valid () const
 Check if JPEG class contains an image. More...
 
int width () const
 Get the width of image. More...
 
int height () const
 Get the height of image. More...
 
int x_density () const
 Get the horizontal pixel density. More...
 
int y_density () const
 Get the vertical pixel density. More...
 
int extra_workspace () const
 Return the extra memory required to plot this image. More...
 
bool greyscale () const
 Check if image is grey scale. More...
 
bool transform_plot_suppoted () const
 Check is transform plots are supported for this image. More...
 
bool density_simple_ratio () const
 Check if this image has a simple density ratio. More...
 

Static Public Member Functions

static bool IsJPEGFile (const std::string &file_name)
 Check if a file is a JPEG file. More...
 
static bool GetFileInfo (const std::string &file_name, int *width, int *height, int *x_density, int *y_density, int *workspace, bool *greyscale_image, bool *no_transform_plots, bool *pixel_density_is_simple_ratio)
 Get information on a JPEG file. More...
 

Detailed Description

Class to load and display JPEG images.

This class is only supported on RISC OS 3.6 or later

Member Function Documentation

bool tbx::JPEG::density_simple_ratio ( ) const
inline

Check if this image has a simple density ratio.

Returns
true if the image has a simple density ratio
void tbx::JPEG::dithered ( bool  dither)

Set flag to control dithering when plotting.

Parameters
dithertrue to dither image
bool tbx::JPEG::dithered ( ) const
inline

Return dithered plot flag.

Returns
true if dithering is on for plotting
void tbx::JPEG::error_defused ( bool  error_defused)

Set flag to control error defusion when plotting.

Parameters
error_defusedtrue to use error defusion when plotting
bool tbx::JPEG::error_defused ( ) const
inline

Return error defused plot flag.

Returns
true if error defusion is on for plotting
int tbx::JPEG::extra_workspace ( ) const
inline

Return the extra memory required to plot this image.

Returns
number of extra workspace bytes required
bool tbx::JPEG::GetFileInfo ( const std::string &  file_name,
int *  width,
int *  height,
int *  x_density,
int *  y_density,
int *  workspace,
bool *  greyscale_image,
bool *  no_transform_plots,
bool *  pixel_density_is_simple_ratio 
)
static

Get information on a JPEG file.

Pass 0 for any parameters not required

Parameters
file_namename of file to get the information for
widthset to width in pixels
heightset to height in pixels
x_densityset to horizontal pixel density
y_densityset to vertical pixel density
workspaceset to SpriteExtend extra workspace requirement to plot.
greyscale_imageset to true if JPEG is a greyscale image
no_transform_plotsset to true if transform plots are not supported for this image.
pixel_density_is_simple_ratioset to true if pixel density is in dpi.
Returns
true if it is a JPEG file
bool tbx::JPEG::greyscale ( ) const
inline

Check if image is grey scale.

Returns
true if this is a grey scale image
int tbx::JPEG::height ( ) const
inline

Get the height of image.

Returns
height of image in pixels
bool tbx::JPEG::is_valid ( ) const
inline

Check if JPEG class contains an image.

Returns
true if image is valid
bool tbx::JPEG::IsJPEGFile ( const std::string &  file_name)
static

Check if a file is a JPEG file.

Parameters
file_namename of file to check
Returns
true if it is a JPEG file
bool tbx::JPEG::load ( const std::string &  file_name)

Load JPEG from file.

Parameters
file_namename of file to load from
Returns
true if load succeeded
void tbx::JPEG::plot ( int  x,
int  y 
) const
virtual

Plot jpeg to screen.

Parameters
xx coordinate in os units
yy coordinate in os units

Implements tbx::Image.

void tbx::JPEG::plot ( const Point pos) const
virtual

Plot jpeg to screen.

Parameters
pospoint to plot the jpeg in in os units

Reimplemented from tbx::Image.

void tbx::JPEG::plot ( int  x,
int  y,
const ScaleFactors sf 
)

Plot the jpeg with the given scale factors.

Parameters
xx coordinate in os units
yy coordinate in os units
sfScaleFactors to scale image
void tbx::JPEG::plot ( const BBox bbox)

Plot jpeg image in given box.

Parameters
bboxbox to plot image into.
void tbx::JPEG::plot ( const DrawTransform dt)

Plot JPEG using a DrawTransform.

Parameters
dtTransform to use for plot
bool tbx::JPEG::transform_plot_suppoted ( ) const
inline

Check is transform plots are supported for this image.

Returns
true if transform plots are supported
int tbx::JPEG::width ( ) const
inline

Get the width of image.

Returns
width of image in pixels
int tbx::JPEG::x_density ( ) const
inline

Get the horizontal pixel density.

Returns
horizontal pixel density
int tbx::JPEG::y_density ( ) const
inline

Get the vertical pixel density.

Returns
vertical pixel density

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