Krita Source Code Documentation
Loading...
Searching...
No Matches
mutator.mutator Namespace Reference

Classes

class  Mutator
 
class  MutatorDocker
 

Functions

 calculate_mutation (mutationMax, nScale)
 
 clamp (minimum, maximum, input)
 
 sizeMutMax ()
 

Variables

float flowMutMax = 0.3
 
float hueMutMax = 0.125
 
float nFlowMut = 0.1
 
float nHueMut = 0.2
 
float nOpacityMut = 0.1
 
float nRotationMut = 1.0
 
float nSaturationMut = 0.2
 
float nSizeMut = 0.5
 
float nValueMut = 0.1
 
float opacityMutMax = 0.3
 
int rotationMutMax = 180
 
float saturationMutMax = 0.3
 
float valueMutMax = 0.25
 

Detailed Description

Licensed under the MIT License.

Copyright (c) 2018 Eoin O'Neill <eoinoneill1991@gmail.com>
Copyright (c) 2018 Emmet O'Neill <emmetoneill.pdx@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Function Documentation

◆ calculate_mutation()

mutator.mutator.calculate_mutation ( mutationMax,
nScale )
mutationMax <- maximum possible mutation value. 
nScale <- normalized (0.0..1.0) percentage (float). 
Returns a randomized mutation value within range from -mutationMax..mutationMax, scaled by nScale.

Definition at line 130 of file mutator.py.

130def calculate_mutation(mutationMax, nScale):
131 '''
132 mutationMax <- maximum possible mutation value.
133 nScale <- normalized (0.0..1.0) percentage (float).
134 Returns a randomized mutation value within range from -mutationMax..mutationMax, scaled by nScale.
135 '''
136 # return random.uniform(0, math.pi * 2) * mutationMax * nScale # Linear distribution (Evenly random.)
137 return math.sin(random.uniform(0, math.pi * 2)) * mutationMax * nScale # Sine distribution (Randomness biased towards more extreme mutations.)
138
139

◆ clamp()

mutator.mutator.clamp ( minimum,
maximum,
input )
Clamp input to some value between the minimum and maximum values. 
Used to keep values within expected ranges.

Definition at line 140 of file mutator.py.

140def clamp(minimum, maximum, input):
141 '''
142 Clamp input to some value between the minimum and maximum values.
143 Used to keep values within expected ranges.
144 '''
145 return min(maximum, max(input, minimum))
146
147
148#GUI
void clamp(float *r, float *g, float *b)

◆ sizeMutMax()

mutator.mutator.sizeMutMax ( )

Definition at line 53 of file mutator.py.

53def sizeMutMax():
54 #(lowThreshold, highThreshold, scale)
55 return (10, 400, 0.25)

Variable Documentation

◆ flowMutMax

float mutator.mutator.flowMutMax = 0.3

Definition at line 58 of file mutator.py.

◆ hueMutMax

float mutator.mutator.hueMutMax = 0.125

Definition at line 59 of file mutator.py.

◆ nFlowMut

float mutator.mutator.nFlowMut = 0.1

Definition at line 44 of file mutator.py.

◆ nHueMut

float mutator.mutator.nHueMut = 0.2

Definition at line 45 of file mutator.py.

◆ nOpacityMut

float mutator.mutator.nOpacityMut = 0.1

Definition at line 43 of file mutator.py.

◆ nRotationMut

float mutator.mutator.nRotationMut = 1.0

Definition at line 42 of file mutator.py.

◆ nSaturationMut

float mutator.mutator.nSaturationMut = 0.2

Definition at line 46 of file mutator.py.

◆ nSizeMut

float mutator.mutator.nSizeMut = 0.5

Definition at line 41 of file mutator.py.

◆ nValueMut

float mutator.mutator.nValueMut = 0.1

Definition at line 47 of file mutator.py.

◆ opacityMutMax

float mutator.mutator.opacityMutMax = 0.3

Definition at line 57 of file mutator.py.

◆ rotationMutMax

int mutator.mutator.rotationMutMax = 180

Definition at line 56 of file mutator.py.

◆ saturationMutMax

float mutator.mutator.saturationMutMax = 0.3

Definition at line 60 of file mutator.py.

◆ valueMutMax

float mutator.mutator.valueMutMax = 0.25

Definition at line 61 of file mutator.py.