Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
levels.c File Reference
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "bauhaus/bauhaus.h"
#include "common/colorspaces.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/imageop_gui.h"
#include "develop/openmp_maths.h"
#include "dtgtk/drawingarea.h"
#include "gui/draw.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "iop/iop_api.h"
#include "libs/colorpicker.h"
+ Include dependency graph for levels.c:

Data Structures

struct  dt_iop_levels_params_t
 
struct  dt_iop_levels_gui_data_t
 
struct  dt_iop_levels_data_t
 
struct  dt_iop_levels_global_data_t
 

Macros

#define DT_GUI_CURVE_EDITOR_INSET   DT_PIXEL_APPLY_DPI(5)
 
#define DT_GUI_CURVE_INFL   .3f
 

Typedefs

typedef enum dt_iop_levels_mode_t dt_iop_levels_mode_t
 
typedef struct dt_iop_levels_params_t dt_iop_levels_params_t
 
typedef struct dt_iop_levels_gui_data_t dt_iop_levels_gui_data_t
 
typedef struct dt_iop_levels_data_t dt_iop_levels_data_t
 
typedef struct dt_iop_levels_global_data_t dt_iop_levels_global_data_t
 

Enumerations

enum  dt_iop_levels_mode_t {
  LEVELS_MODE_MANUAL ,
  LEVELS_MODE_AUTOMATIC
}
 

Functions

static gboolean dt_iop_levels_area_draw (GtkWidget *widget, cairo_t *crf, gpointer user_data)
 
static gboolean dt_iop_levels_motion_notify (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 
static gboolean dt_iop_levels_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean dt_iop_levels_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean dt_iop_levels_leave_notify (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
 
static gboolean dt_iop_levels_scroll (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 
static void dt_iop_levels_autoadjust_callback (GtkRange *range, dt_iop_module_t *self)
 
const char * name ()
 
int default_group ()
 
int flags ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
const char ** description (struct dt_iop_module_t *self)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
static void dt_iop_levels_compute_levels_manual (const uint32_t *histogram, float *levels)
 
static void dt_iop_levels_compute_levels_automatic (dt_dev_pixelpipe_iop_t *piece)
 
static void compute_lut (dt_dev_pixelpipe_iop_t *piece)
 
void color_picker_apply (dt_iop_module_t *self, GtkWidget *picker, dt_dev_pixelpipe_iop_t *piece)
 
static void commit_params_late (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece)
 
void process (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void commit_params (dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void init_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous)
 
void gui_update (dt_iop_module_t *self)
 
void init (dt_iop_module_t *module)
 
void init_global (dt_iop_module_so_t *self)
 
void cleanup_global (dt_iop_module_so_t *self)
 
void gui_init (dt_iop_module_t *self)
 
void gui_cleanup (dt_iop_module_t *self)
 
static void dt_iop_levels_move_handle (dt_iop_module_t *self, int handle_move, float new_pos, float *levels, float drag_start_percentage)
 

Macro Definition Documentation

◆ DT_GUI_CURVE_EDITOR_INSET

#define DT_GUI_CURVE_EDITOR_INSET   DT_PIXEL_APPLY_DPI(5)

◆ DT_GUI_CURVE_INFL

#define DT_GUI_CURVE_INFL   .3f

Typedef Documentation

◆ dt_iop_levels_data_t

◆ dt_iop_levels_global_data_t

◆ dt_iop_levels_gui_data_t

◆ dt_iop_levels_mode_t

◆ dt_iop_levels_params_t

Enumeration Type Documentation

◆ dt_iop_levels_mode_t

Enumerator
LEVELS_MODE_MANUAL 
LEVELS_MODE_AUTOMATIC 

Function Documentation

◆ cleanup_global()

◆ cleanup_pipe()

void cleanup_pipe ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

◆ color_picker_apply()

◆ commit_params()

◆ commit_params_late()

◆ compute_lut()

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

References IOP_CS_LAB.

◆ default_group()

int default_group ( )

References IOP_GROUP_TONES.

◆ description()

const char ** description ( struct dt_iop_module_t self)

◆ dt_iop_levels_area_draw()

◆ dt_iop_levels_autoadjust_callback()

◆ dt_iop_levels_button_press()

static gboolean dt_iop_levels_button_press ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ dt_iop_levels_button_release()

static gboolean dt_iop_levels_button_release ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

References FALSE, dt_iop_module_t::gui_data, and TRUE.

Referenced by gui_init().

◆ dt_iop_levels_compute_levels_automatic()

◆ dt_iop_levels_compute_levels_manual()

static void dt_iop_levels_compute_levels_manual ( const uint32_t *  histogram,
float *  levels 
)
static

References levels().

Referenced by dt_iop_levels_autoadjust_callback().

◆ dt_iop_levels_leave_notify()

static gboolean dt_iop_levels_leave_notify ( GtkWidget *  widget,
GdkEventCrossing *  event,
gpointer  user_data 
)
static

References dt_iop_module_t::gui_data, and TRUE.

Referenced by gui_init().

◆ dt_iop_levels_motion_notify()

static gboolean dt_iop_levels_motion_notify ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  user_data 
)
static

◆ dt_iop_levels_move_handle()

static void dt_iop_levels_move_handle ( dt_iop_module_t self,
int  handle_move,
float  new_pos,
float *  levels,
float  drag_start_percentage 
)
static

Move handler_move to new_pos, storing the value in handles, while keeping new_pos within a valid range and preserving the ratio between the three handles.

Parameters
selfPointer to this module to be able to access gui_data
handle_moveHandle to move
new_powNew position (0..1)
levelsPointer to dt_iop_levels_params->levels.
drag_start_percentageRatio between handle 1, 2 and 3.
Returns
TRUE if the marker were given a new position. FALSE otherwise.

References FALSE, dt_iop_module_t::gui_data, and levels().

Referenced by dt_iop_levels_motion_notify(), and dt_iop_levels_scroll().

◆ dt_iop_levels_scroll()

◆ flags()

int flags ( )

◆ gui_changed()

void gui_changed ( dt_iop_module_t self,
GtkWidget *  w,
void previous 
)

◆ gui_cleanup()

void gui_cleanup ( dt_iop_module_t self)

◆ gui_init()

◆ gui_update()

◆ init()

◆ init_global()

◆ init_pipe()

◆ legacy_params()

int legacy_params ( dt_iop_module_t self,
const void *const  old_params,
const int  old_version,
void new_params,
const int  new_version 
)

◆ name()

const char * name ( )

◆ process()