# \CAsciiArt

Create an ASCII version of an image.

## Summary

Methods
Properties
Constants
__construct()
addCharacterSet()
setOptions()
createFromFile()
luminanceAreaAverage()
getLuminance()
luminance2character()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$characterSet
$characters
$charCount
$scale
$luminanceStrategy
N/A

File
  CAsciiArt.php
Package
  Default
Class hierarchy
  \CAsciiArt

## Tags

None found

## Properties

### $characterSet

    $characterSet :

Character set to use.

#### Type

#

## Tags

None found

### $characters

    $characters :

Current character set.

#### Type

#

## Tags

None found

### $charCount

    $charCount :

Length of current character set.

#### Type

#

## Tags

None found

### $scale

    $scale :

Scale of the area to swap to a character.

#### Type

#

## Tags

None found

### $luminanceStrategy

    $luminanceStrategy :

Strategy to calculate luminance.

#### Type

#

## Tags

None found

## Methods

### __construct()

    __construct()

Constructor which sets default options.

#

## Tags

None found

### addCharacterSet()

    addCharacterSet(string  $key, string  $value) : $this

Add a custom character set.

#### Parameters

string | $key | for the character set.
string | $value | for the character set.

#### Returns

$this

#

## Tags

None found

### setOptions()

    setOptions(array  $options = array()) : $this

Set options for processing, defaults are available.

#### Parameters

array | $options | to use as default settings.

#### Returns

$this

#

## Tags

None found

### createFromFile()

    createFromFile(string  $filename) : string

Create an Ascii image from an image file.

#### Parameters

string | $filename | of the image to use.

#### Returns

string —

$ascii with the ASCII image.

#

## Tags

None found

### luminanceAreaAverage()

    luminanceAreaAverage(string  $img, integer  $x1, integer  $y1, integer  $x2, integer  $y2) : integer

Get the luminance from a region of an image using average color value.

#### Parameters

string | $img | the image.
integer | $x1 | the area to get pixels from.
integer | $y1 | the area to get pixels from.
integer | $x2 | the area to get pixels from.
integer | $y2 | the area to get pixels from.

#### Returns

integer —

$luminance with a value between 0 and 100.

#

## Tags

None found

### getLuminance()

    getLuminance(integer  $red, integer  $green, integer  $blue) : float

Calculate luminance value with different strategies.

#### Parameters

integer | $red | The color red.
integer | $green | The color green.
integer | $blue | The color blue.

#### Returns

float —

$luminance with a value between 0 and 1.

#

## Tags

None found

### luminance2character()

    luminance2character(  $luminance) : string

Translate the luminance value to a character.

#### Parameters

| $luminance |

#### Returns

string —

with the ascii character.

#

## Tags

None found

### CAsciiArt.php