mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
Implement the correct Brightness/Contrast node algorithm (#1130)
Implement correct brightness/contrast algorithm
This commit is contained in:
@@ -1610,7 +1610,7 @@ impl DocumentMessageHandler {
|
||||
}
|
||||
|
||||
/// Loads layer resources such as creating the blob URLs for the images and loading all of the fonts in the document
|
||||
pub fn load_layer_resources(&self, responses: &mut VecDeque<Message>, root: &LayerDataType, mut path: Vec<LayerId>, document_id: u64) {
|
||||
pub fn load_layer_resources(&self, responses: &mut VecDeque<Message>, root: &LayerDataType, mut path: Vec<LayerId>, _document_id: u64) {
|
||||
fn walk_layers(data: &LayerDataType, path: &mut Vec<LayerId>, responses: &mut VecDeque<Message>, fonts: &mut HashSet<Font>) {
|
||||
match data {
|
||||
LayerDataType::Folder(folder) => {
|
||||
|
||||
@@ -633,14 +633,15 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
DocumentNodeType {
|
||||
name: "Brightness/Contrast",
|
||||
category: "Image Adjustments",
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _>"),
|
||||
identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _, _>"),
|
||||
inputs: vec![
|
||||
DocumentInputType::value("Image", TaggedValue::ImageFrame(ImageFrame::empty()), true),
|
||||
DocumentInputType::value("Brightness", TaggedValue::F64(0.), false),
|
||||
DocumentInputType::value("Contrast", TaggedValue::F64(0.), false),
|
||||
DocumentInputType::value("Use Legacy", TaggedValue::Bool(false), false),
|
||||
],
|
||||
outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)],
|
||||
properties: node_properties::brighten_image_properties,
|
||||
properties: node_properties::brightness_contrast_properties,
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Threshold",
|
||||
|
||||
@@ -501,11 +501,16 @@ pub fn adjust_hsl_properties(document_node: &DocumentNode, node_id: NodeId, _con
|
||||
]
|
||||
}
|
||||
|
||||
pub fn brighten_image_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let brightness = number_widget(document_node, node_id, 1, "Brightness", NumberInput::default().min(-255.).max(255.), true);
|
||||
let contrast = number_widget(document_node, node_id, 2, "Contrast", NumberInput::default().min(-255.).max(255.), true);
|
||||
pub fn brightness_contrast_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
let brightness = number_widget(document_node, node_id, 1, "Brightness", NumberInput::default().min(-150.).max(150.), true);
|
||||
let contrast = number_widget(document_node, node_id, 2, "Contrast", NumberInput::default().min(-100.).max(100.), true);
|
||||
let use_legacy = bool_widget(document_node, node_id, 3, "Use Legacy", true);
|
||||
|
||||
vec![LayoutGroup::Row { widgets: brightness }, LayoutGroup::Row { widgets: contrast }]
|
||||
vec![
|
||||
LayoutGroup::Row { widgets: brightness },
|
||||
LayoutGroup::Row { widgets: contrast },
|
||||
LayoutGroup::Row { widgets: use_legacy },
|
||||
]
|
||||
}
|
||||
|
||||
pub fn blur_image_properties(document_node: &DocumentNode, node_id: NodeId, _context: &mut NodePropertiesContext) -> Vec<LayoutGroup> {
|
||||
|
||||
Reference in New Issue
Block a user