- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.gdiobject.Palette Class Reference

The smjg.libs.sdwf.gdiobject.Palette class represents a colour palette. More...

Inheritance diagram for smjg.libs.sdwf.gdiobject.Palette:

List of all members.

## Public Types
typedef nearestColour | nearestColor
## Public Member Functions
| this (PaletteEntry[] entries)
| Constructs a new palette.
| this (RGBColour[] entries)
| Constructs a new palette.
| this (HPALETTE h, bool autoDelete=false)
| Constructs a Palette wrapper around a pre-existing API palette object.
RGBColour | nearestColour (RGBColour c)
| Finds the nearest colour in this palette to the specified colour.
uint | nearestIndex (RGBColour c)
| Finds the index of nearest colour in this palette to the specified colour.
Palette | dup ()
| Creates an exact copy of the palette.
uint | length ()
| The number of entries in this palette.
HANDLE | clipboardDataHandle (CLIPBOARD_FORMAT format, bool clearAutoDelete=true)
| Data handle to this object for placing on the clipboard.
Operators
PaletteEntry | opIndex (uint index)
| Gets the entry at the given position in the palette.
PaletteEntry | opIndexAssign (PaletteEntry entry, uint index)
| Sets an entry in the palette.
PaletteEntry | opIndexAssign (RGBColour entry, uint index)
| Sets an entry in the palette.
PaletteEntry[] | opSlice ()
| Returns an array of all the entries in the palette.
PaletteEntry[] | opSlice (uint begin, uint end)
| Returns a range of entries in the palette.
PaletteEntry[] | opSliceAssign (PaletteEntry[] entries)
| Sets all entries in the palette.
PaletteEntry[] | opSliceAssign (PaletteEntry[] entries, uint begin, uint end)
| Sets a range of entries in the palette.

## Detailed Description

The smjg.libs.sdwf.gdiobject.Palette class represents a colour palette.

Since:
  0.3

Status:
  created mainly to support CLIPBOARD_FORMAT.PALETTE. Only minimally tested!

## Member Typedef Documentation

typedef nearestColour smjg.libs.sdwf.gdiobject.Palette.nearestColor

## Constructor & Destructor Documentation

smjg.libs.sdwf.gdiobject.Palette.this | ( | PaletteEntry[] | entries | ) |

Constructs a new palette.

Parameters:

  | entries | the entries that make up the palette.

Status:
  done

smjg.libs.sdwf.gdiobject.Palette.this | ( | RGBColour[] | entries | ) |

Constructs a new palette.

Parameters:

  | entries | the colours that make up the palette.

Status:
  test

smjg.libs.sdwf.gdiobject.Palette.this | ( | HPALETTE | h,
|  | bool | autoDelete = `false` |
| ) |  |  |

Constructs a Palette wrapper around a pre-existing API palette object.

Parameters:

  | h | handle of the palette to wrap.
  | autoDelete | (since 0.5) whether the Windows handle should be automatically deleted when the SDWF object is garbage collected.

Status:
  done

## Member Function Documentation

RGBColour smjg.libs.sdwf.gdiobject.Palette.nearestColour | ( | RGBColour | c | ) |

Finds the nearest colour in this palette to the specified colour.

Parameters:

  | c | colour to be matched.

Returns:
  the nearest colour that is present in the palette.

Status:
  test

uint smjg.libs.sdwf.gdiobject.Palette.nearestIndex | ( | RGBColour | c | ) |

Finds the index of nearest colour in this palette to the specified colour.

Parameters:

  | c | colour to be matched.

Returns:
  the index in the palette of the nearest colour.

Status:
  test

Palette smjg.libs.sdwf.gdiobject.Palette.dup | ( |  | ) |

Creates an exact copy of the palette.

Returns:
  a copy of the palette.

Status:
  done

uint smjg.libs.sdwf.gdiobject.Palette.length | ( |  | ) |

The number of entries in this palette.

HANDLE smjg.libs.sdwf.gdiobject.Palette.clipboardDataHandle | ( | CLIPBOARD_FORMAT | format,
|  | bool | clearAutoDelete = `true` |
| ) |  |  |

Data handle to this object for placing on the clipboard.

Status:
  done

PaletteEntry smjg.libs.sdwf.gdiobject.Palette.opIndex | ( | uint | index | ) |

Gets the entry at the given position in the palette.

(Implementation of `this[i]`.)

Status:
  test

PaletteEntry smjg.libs.sdwf.gdiobject.Palette.opIndexAssign | ( | PaletteEntry | entry,
|  | uint | index |
| ) |  |  |

Sets an entry in the palette.

(Implementation of `this[i] = entry`.)

Parameters:

  | entry | entry to place at this position.
  | index | index to set.

Returns:
  the assigned palette entry.

Status:
  test

PaletteEntry smjg.libs.sdwf.gdiobject.Palette.opIndexAssign | ( | RGBColour | entry,
|  | uint | index |
| ) |  |  |

Sets an entry in the palette.

(Implementation of `this[i] = entry`.)

This method is syntactic sugar for opIndexAssign(PaletteEntry, uint) to set by an RGBColour.

Parameters:

  | entry | colour to place at this position.
  | index | index to set.

Returns:
  the assigned palette entry.

Status:
  test

PaletteEntry [] smjg.libs.sdwf.gdiobject.Palette.opSlice | ( |  | ) |

Returns an array of all the entries in the palette.

Status:
  done

PaletteEntry [] smjg.libs.sdwf.gdiobject.Palette.opSlice | ( | uint | begin,
|  | uint | end |
| ) |  |  |

Returns a range of entries in the palette.

(Implementation of `this[begin..end]`.)

Parameters:

  | begin | index of first entry to retrieve.
  | end | index one beyond the last entry to retrieve.

Returns:
  an array of the entries in the requested range.

Status:
  test

PaletteEntry [] smjg.libs.sdwf.gdiobject.Palette.opSliceAssign | ( | PaletteEntry[] | entries | ) |

Sets all entries in the palette.

(Implementation of `this[] = entries`.)

Parameters:

  | entries | array of entries to place in the palette.

Returns:
  an array of the entries in the requested range.

Status:
  test

PaletteEntry [] smjg.libs.sdwf.gdiobject.Palette.opSliceAssign | ( | PaletteEntry[] | entries,
|  | uint | begin,
|  | uint | end |
| ) |  |  |

Sets a range of entries in the palette.

(Implementation of `this[begin..end] = entries`.)

Parameters:

  | entries | array of entries to place in the palette.
  | begin | index of first entry to set.
  | end | index one beyond the last entry to set.

Returns:
  an array of entries to put into the palette.

Status:
  test

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

- gdiobject.d