Ignotus-mago / PixelScanner

Scan 2D pixel maps to 1D arrays derived from space-filling curves.
Other
0 stars 0 forks source link

Methods to apply color channels #3

Open Ignotus-mago opened 1 month ago

Ignotus-mago commented 1 month ago

Much like applyAlpha() method, applyRed, applyGreen, applyBlue, applyHue, applyBrightness, applySaturation. Then call these methods from pullPixelAudio and pushAudioPixel methods. I don't think there will be much of a reduction in speed, and we'll gain clarity by having one method instead of bitwise ops scattered through code. Probably can lose a var assignment or two by calling the methods.

Ignotus-mago commented 1 month ago

I wrote eight "apply" methods: applyBrightness, applyHue, applySaturation, applyRed, applyGreeen, applyBlue, applyAlpha, applyAll. Each method accepts a float value and an int, which should be an audio value and an RGB value. The float is applied in the selected channel and returned as an RGB value.

The code that call the apply methods was simplified, as expected. This may be all we need to do.

Ignotus-mago commented 1 month ago

We have applyChannel(float, int) merhods that have simplified calls. Perhaps further thought is needed for situations where both arguments are RGB int values.