Compare commits

..

No commits in common. "main" and "v1.1.0" have entirely different histories.
main ... v1.1.0

3 changed files with 10 additions and 17 deletions

View file

@ -6,7 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
eframe = { version = "0.22.0", default-features = false, features = ["glow", "default_fonts"] }
eframe = { version = "0.22.0", default-features = false, features = [
"glow",
"default_fonts",
] }
image = { version = "0.24.6", default-features = false, features = ["png"] }
native-dialog = "0.6.4"
rand = "0.8.5"

View file

@ -13,8 +13,6 @@ pub struct RenderOptions {
pub cx: f64,
pub cy: f64,
pub fill_style: FillStyle,
#[serde(default)]
pub invert: bool,
}
#[derive(Clone, PartialEq, Serialize, Deserialize)]
@ -33,7 +31,6 @@ impl Default for RenderOptions {
cx: 0.4,
cy: -0.2,
fill_style: FillStyle::Bright,
invert: false,
}
}
}
@ -61,18 +58,13 @@ pub fn render_c(q: &RenderOptions, mut image: RgbImage) -> RgbImage {
image
}
pub fn color_iteration(iter: u16, color: (u8, u8, u8), invert: bool) -> Rgb<u8> {
pub fn color_iteration(iter: u16, color: (u8, u8, u8)) -> Rgb<u8> {
let i = iter.min(255) as u8;
let (r, g, b) = (
Rgb([
i.saturating_mul(color.0),
i.saturating_mul(color.1),
i.saturating_mul(color.2),
);
if invert {
Rgb([255 - r, 255 - g, 255 - b])
} else {
Rgb([r, g, b])
}
])
}
pub fn render_julia(q: &RenderOptions, color: (u8, u8, u8)) -> RgbImage {
@ -83,8 +75,8 @@ pub fn render_julia(q: &RenderOptions, color: (u8, u8, u8)) -> RgbImage {
let ppu = width / q.unit_width;
let fill = match q.fill_style {
FillStyle::Black => Rgb([q.invert as u8 * 255; 3]),
FillStyle::Bright => color_iteration(q.max_iter, color, q.invert),
FillStyle::Black => Rgb([0; 3]),
FillStyle::Bright => color_iteration(q.max_iter, color),
};
(0..q.height)
@ -99,7 +91,7 @@ pub fn render_julia(q: &RenderOptions, color: (u8, u8, u8)) -> RgbImage {
if i == q.max_iter {
row.push(fill);
} else {
row.push(color_iteration(i, color, q.invert));
row.push(color_iteration(i, color));
}
}
row

View file

@ -250,7 +250,6 @@ impl eframe::App for JuliaGUI {
.radio_value(&mut self.settings.fill_style, FillStyle::Bright, "Bright")
.changed();
});
let set_invert = ui.checkbox(&mut self.settings.invert, "invert");
ui.horizontal(|ui| {
ui.label("Colour (RGB)");
@ -390,7 +389,6 @@ impl eframe::App for JuliaGUI {
|| set_red.changed() || set_green.changed()
|| set_blue.changed()
|| set_point_vis.changed()
|| set_invert.changed()
{
self.settings_changed = true;
}