Muvicado HD
Loading...
Searching...
No Matches
Utility Class Reference

Namespace-style class for color math, randomization, and note helpers. More...

#include <Utility.h>

Inheritance diagram for Utility:
Collaboration diagram for Utility:

Class Methods

(NSString *) + stringFromNote:
 Formats a MIDI note number as a string like [C3].
(NSColor *) + colorForNote:
 Deterministic color mapping for a given MIDI note.
(NSColor *) + randomColor:
 Generates a random color with the given saturation.
(NSColor *) + makeRgbColor:green:blue:alpha:
 Convenience to create a calibrated RGB color.
(float) + redComponentOf:
 Extracts the respective component in calibrated RGB space.
(float) + greenComponentOf:
 Extracts the respective component in calibrated RGB space.
(float) + blueComponentOf:
 Extracts the respective component in calibrated RGB space.
(float) + alphaComponentOf:
 Extracts the respective component in calibrated RGB space.
(NSColor *) + darkerColor:
 Returns a darker/brighter color variant.
(NSColor *) + brighterColor:
 Returns a darker/brighter color variant.
(NSString *) + getIndentForLevel:
 Returns a string of spaces for the given indent level.
(NSPoint) + randomPointInBounds:
 Returns a random point within the given bounds.

Detailed Description

Namespace-style class for color math, randomization, and note helpers.

Concrete implementations of Utility helpers.

Definition at line 15 of file Utility.h.

Method Documentation

◆ alphaComponentOf:

+ (float) alphaComponentOf: (NSColor *) color

Extracts the respective component in calibrated RGB space.

Returns the component value in calibrated RGB space or 0 on failure.

Definition at line 115 of file Utility.m.

◆ blueComponentOf:

+ (float) blueComponentOf: (NSColor *) color

Extracts the respective component in calibrated RGB space.

Returns the component value in calibrated RGB space or 0 on failure.

Definition at line 105 of file Utility.m.

◆ brighterColor:

+ (NSColor *) brighterColor: (NSColor *) inColor

Returns a darker/brighter color variant.

Increases RGB toward 1.0 to produce a brighter color.

Definition at line 143 of file Utility.m.

Here is the call graph for this function:

◆ colorForNote:

+ (NSColor *) colorForNote: (int) note

Deterministic color mapping for a given MIDI note.

Maps a MIDI note to a hue/brightness for consistent pad coloring.

Definition at line 38 of file Utility.m.

Here is the caller graph for this function:

◆ darkerColor:

+ (NSColor *) darkerColor: (NSColor *) inColor

Returns a darker/brighter color variant.

Scales RGB by a constant factor to produce a darker color.

Definition at line 128 of file Utility.m.

Here is the call graph for this function:

◆ getIndentForLevel:

+ (NSString *) getIndentForLevel: (int) level

Returns a string of spaces for the given indent level.

Builds a space string for indentation (level * 2), clamped to 8 spaces.

Definition at line 166 of file Utility.m.

Here is the caller graph for this function:

◆ greenComponentOf:

+ (float) greenComponentOf: (NSColor *) color

Extracts the respective component in calibrated RGB space.

Returns the component value in calibrated RGB space or 0 on failure.

Definition at line 95 of file Utility.m.

◆ makeRgbColor:green:blue:alpha:

+ (NSColor *) makeRgbColor: (CGFloat) red
green: (CGFloat) green
blue: (CGFloat) blue
alpha: (CGFloat) alpha 

Convenience to create a calibrated RGB color.

Convenience to create a calibrated RGB color with components.

Definition at line 77 of file Utility.m.

Here is the caller graph for this function:

◆ randomColor:

+ (NSColor *) randomColor: (CGFloat) saturation

Generates a random color with the given saturation.

Creates a random calibrated RGB color with the given saturation.

Definition at line 64 of file Utility.m.

Here is the caller graph for this function:

◆ randomPointInBounds:

+ (NSPoint) randomPointInBounds: (NSRect) bounds

Returns a random point within the given bounds.

Returns a random point uniformly distributed within bounds.

Definition at line 181 of file Utility.m.

Here is the caller graph for this function:

◆ redComponentOf:

+ (float) redComponentOf: (NSColor *) color

Extracts the respective component in calibrated RGB space.

Returns the component value in calibrated RGB space or 0 on failure.

Definition at line 85 of file Utility.m.

◆ stringFromNote:

+ (NSString *) stringFromNote: (int) note

Formats a MIDI note number as a string like [C3].

Converts a MIDI note number to a label like [C3].

Definition at line 30 of file Utility.m.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: