Enum printpdf::types::plugins::graphics::extgstate::SpotFunction [] [src]

pub enum SpotFunction {
    SimpleDot,
    InvertedSimpleDot,
    DoubleDot,
    InvertedDoubleDot,
    CosineDot,
    Double,
    InvertedDouble,
    Line,
    LineX,
    LineY,
    Round,
    Ellipse,
    EllipseA,
    InvertedEllipseA,
    EllipseB,
    EllipseC,
    InvertedEllipseC,
    Square,
    Cross,
    Rhomboid,
    Diamond,
}

Spot functions, Table 6.1, Page 489 in Pdf Reference v1.7 The code is pseudo code, returning the grey component at (x, y).

Variants

1 - (pow(x, 2) + pow(y, 2))

pow(x, 2) + pow(y, 2) - 1

(sin(360 * x) / 2) + (sin(360 * y) / 2)

- ((sin(360 * x) / 2) + (sin(360 * y) / 2))

(cos(180 * x) / 2) + (cos(180 * y) / 2)

(sin(360 x (x / 2)) / 2) + (sin(360 * y) / 2)

- ((sin(360 x (x / 2)) / 2) + (sin(360 * y) / 2))

- abs(y)

x

y

Be careful when using this code, it's not being tested!
if (abs(x) + abs(y) <= 1 {
    1 - (pow(x, 2) + pow(y, 2))
} else {
    pow((abs(x) - 1), 2) + pow((abs(y) - 1), 2) - 1
}
Be careful when using this code, it's not being tested!
let w = (3 * abs(x)) + (4 * abs(y)) - 3;

if w < 0 {
    1 - ((pow(x, 2) + pow((abs(y) / 0.75), 2)) / 4)
} else if w > 1 {
    pow((pow((1 - abs(x), 2) + (1 - abs(y)) / 0.75), 2) / 4) - 1
} else {
    0.5 - w
}

1 - (pow(x, 2) + 0.9 * pow(y, 2))

pow(x, 2) + 0.9 * pow(y, 2) - 1

1 - sqrt(pow(x, 2) + (5 / 8) * pow(y, 2))

1 - (0.9 * pow(x, 2) + pow(y, 2))

0.9 * pow(x, 2) + pow(y, 2) - 1

- max(abs(x), abs(y))

- min(abs(x), abs(y))

(0.9 * abs(x) + abs(y)) / 2

Be careful when using this code, it's not being tested!
let t = abs(x) + abs(y);
if t <= 0.75 {
    1 - (pow(x, 2) + pow(y, 2))
} else if t < 1.23 {
    1 - (0.85 * abs(x) + abs(y))
} else {
    pow((abs(x) - 1), 2) + pow((abs(y) - 1), 2) - 1
}

Trait Implementations

impl Debug for SpotFunction
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for SpotFunction
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Copy for SpotFunction
[src]

impl Clone for SpotFunction
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more