about summary refs log tree commit diff stats
path: root/js/leibovitz/contrast.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/leibovitz/contrast.js')
-rw-r--r--js/leibovitz/contrast.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/js/leibovitz/contrast.js b/js/leibovitz/contrast.js
index 01312ad..c2b1a28 100644
--- a/js/leibovitz/contrast.js
+++ b/js/leibovitz/contrast.js
@@ -1,7 +1,25 @@
 /**
- * Contrast management module implementing contrast adjustment
- * Uses the Observer pattern for state management and effect application
- * Implements linear contrast adjustment algorithm
+ * Contrast management module implementing linear contrast adjustment.
+ * 
+ * Implements contrast adjustment using a linear scaling algorithm.
+ * Provides real-time contrast control with immediate visual feedback.
+ * 
+ * Implements the following design patterns:
+ * - Observer Pattern: state management and effect application
+ * - Factory Pattern: UI initialization
+ * - Strategy Pattern: contrast adjustment algorithm
+ * - Command Pattern: state reset operations
+ * 
+ * Contrast adjustment process:
+ * 1. Calculate contrast factor using formula: (259 * (contrast + 255)) / (255 * (259 - contrast))
+ * 2. Apply linear scaling to each color channel
+ * 3. Maintain color balance while adjusting contrast
+ * 
+ * Features:
+ * - Linear contrast adjustment
+ * - Per-channel processing
+ * - Real-time updates
+ * - Preserves color relationships
  */
 
 const ContrastManager = {
@@ -12,7 +30,6 @@ const ContrastManager = {
 
     /**
      * Initializes the contrast manager and sets up UI controls
-     * Implements the Factory pattern for UI initialization
      */
     init() {
         this._setupEventListeners();
@@ -20,7 +37,6 @@ const ContrastManager = {
 
     /**
      * Sets up event listeners for UI controls
-     * Implements the Observer pattern for state changes
      */
     _setupEventListeners() {
         this._slider = document.getElementById('contrast-slider');
@@ -75,7 +91,6 @@ const ContrastManager = {
 
     /**
      * Resets contrast effect to default state
-     * Implements the Command pattern for state reset
      */
     reset() {
         this._currentContrast = 1.0;