Add brightness and contrast controls, thanks @evanw

This commit is contained in:
Tom Payne
2012-07-22 02:24:17 +02:00
parent 883089c3d1
commit ec2ab8265c
4 changed files with 88 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ goog.require('ol.Store');
* @enum {string}
*/
ol.LayerProperty = {
BRIGHTNESS: 'brightness',
CONTRAST: 'contrast',
HUE: 'hue',
OPACITY: 'opacity',
SATURATION: 'saturation',
@@ -33,6 +35,8 @@ ol.Layer = function(store, opt_values) {
*/
this.store_ = store;
this.setBrightness(0);
this.setContrast(0);
this.setHue(0);
this.setOpacity(1);
this.setSaturation(0);
@@ -46,6 +50,22 @@ ol.Layer = function(store, opt_values) {
goog.inherits(ol.Layer, ol.Object);
/**
* @return {number} Brightness.
*/
ol.Layer.prototype.getBrightness = function() {
return /** @type {number} */ this.get(ol.LayerProperty.BRIGHTNESS);
};
/**
* @return {number} Contrast.
*/
ol.Layer.prototype.getContrast = function() {
return /** @type {number} */ this.get(ol.LayerProperty.CONTRAST);
};
/**
* @return {number} Hue.
*/
@@ -88,6 +108,22 @@ ol.Layer.prototype.getVisible = function() {
};
/**
* @param {number} brightness Brightness.
*/
ol.Layer.prototype.setBrightness = function(brightness) {
this.set(ol.LayerProperty.BRIGHTNESS, brightness);
};
/**
* @param {number} contrast Contrast.
*/
ol.Layer.prototype.setContrast = function(contrast) {
this.set(ol.LayerProperty.CONTRAST, contrast);
};
/**
* @param {number} hue Hue.
*/