Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members

# ptc::Copy Class Reference

Routines for copying and converting pixel data. More...

List of all members.

## Public Members

- Copy ()
- ~Copy ()
- void request (const Format &source,const Format &destination)
- void palette (const Palette &source,const Palette &destination)
- void copy (const void *source_pixels,int source_x,int source_y,int source_width,int source_height,int source_pitch, void *destination_pixels,int destination_x,int destination_y,int destination_width,int destination_height,int destination_pitch)
- bool option (const char option[])

## Detailed Description

Routines for copying and converting pixel data.

This class is an interface to low level pixel copying and conversion routines.

Before using the copy class take a look at the high level Surface::copy(), Surface::load() and Surface::save() functions.

Typically the only time the copy class is required is when you are managing your own pixel buffers.

## Member Function Documentation

### ptc::Copy::Copy ()

Default constructor.

### ptc::Copy::~Copy ()

Destructor.

### void ptc::Copy::request (const Format & source, const Format & destination)

Request a copy routine for the specified pixel formats source and destination.

Parameters:
  source - the source pixel format.
  destination - the destination pixel format.

Exceptions:
  Error - An Error exception is thrown on failure.

### void ptc::Copy::palette (const Palette & source, const Palette & destination)

Set the source and destination palettes for indexed color conversion.

If neither pixel arrays are indexed color then pass blank palettes:

                // set blank copy palettes
                copy.palette(Palette(),Palette());

Parameters:
  source - the source palette.
  destination - the destination palette.

Exceptions:
  Error - An Error exception is thrown on failure.

### void ptc::Copy::copy (const void * source_pixels, int source_x, int source_y, int source_width, int source_height, int source_pitch, void * destination_pixels, int destination_x, int destination_y, int destination_width, int destination_height, int destination_pitch)

Copy an area of the source pixel array source_pixels to an area of the destination pixel array destination_pixels.

source_width, source_height, destination_width and destination_height must all be positive integers.

source_pitch and destination_pitch may be any value, even negative.

Warning:
  You must first call Copy::request() to initialize the pixel formats and Copy::palette() to initialize palettes.

Parameters:
  source_pixels - the source pixel array.
  source_x - the x coordinate of the top-left corner of the source area.
  source_y - the y coordinate of the top-left corner of the source area.
  source_width - the width of the source area in pixels.
  source_height - the height of the source area in pixels.
  source_pitch - the pitch of the source pixel array in bytes.
  destination_pixels - the destination pixel array.
  destination_x - the x coordinate of the top-left corner of the destination area.
  destination_y - the y coordinate of the top-left corner of the destination area.
  destination_width - the width of the destination area in pixels.
  destination_height - the height of the destination area in pixels.
  destination_pitch - the pitch of the destination pixel array in bytes.

Exceptions:
  Error - An Error exception is thrown on failure.

### bool ptc::Copy::option (const char option[])

Passes an implementation specific option string to the copy object.

Returns:
  true if the option string is recognized, false otherwise.

Exceptions:
  Error - An Error exception is thrown on failure.

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

- ptc.h