Skip to content

Commit

Permalink
Use color for color.
Browse files Browse the repository at this point in the history
This leaves `peniko::Color` for now, but begins the migration to
using the new `color` crate.
  • Loading branch information
waywardmonkeys committed Nov 24, 2024
1 parent a421674 commit c65c325
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 707 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
# If the compilation fails, then the version specified here needs to be bumped up to reality.
# Be sure to also update the rust-version property in the workspace Cargo.toml file,
# plus all the README.md files of the affected packages.
RUST_MIN_VER: "1.70"
RUST_MIN_VER: "1.82"
# List of packages that will be checked with the minimum supported Rust version.
# This should be limited to packages that are intended for publishing.
RUST_MIN_VER_PKGS: "-p peniko"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You can find its changes [documented below](#020-2024-09-19).

## [Unreleased]

This release has an [MSRV] of 1.70.
This release has an [MSRV] of 1.82.

## [0.2.0][] (2024-09-19)

Expand Down
30 changes: 20 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ keywords = ["graphics", "vector", "style"]
categories = ["graphics"]
repository = "https://github.com/linebender/peniko"
readme = "README.md"
# We support from Rust 1.70 so that CI uses the sparse protocol.
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml and with the relevant README.md files.
# and with the MSRV in the `Unreleased` section of CHANGELOG.md.
rust-version = "1.70"
rust-version = "1.82"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -21,16 +20,22 @@ targets = []

[features]
default = ["std"]
std = ["kurbo/std"]
libm = ["kurbo/libm"]
std = ["color/std", "kurbo/std"]
libm = ["color/libm", "kurbo/libm"]
mint = ["kurbo/mint"]
serde = ["smallvec/serde", "kurbo/serde", "dep:serde_bytes", "dep:serde"]
serde = ["color/serde", "smallvec/serde", "kurbo/serde", "dep:serde_bytes", "dep:serde"]

[dependencies]
# NOTE: Make sure to keep this in sync with the version badge in README.md
kurbo = { version = "0.11.1", default-features = false }
smallvec = "1.13.2"

[dependencies.color]
git = "https://github.com/linebender/color.git"
rev = "1c9b06f702d063617c8eb1980a5b2a6fc3eae359"
version = "0.1.0"
default-features = false

[dependencies.serde]
version = "1.0.210"
optional = true
Expand Down Expand Up @@ -69,8 +74,10 @@ rust.unused_macro_rules = "warn"
rust.unused_qualifications = "warn"
rust.variant_size_differences = "warn"

clippy.allow_attributes = "warn"
clippy.allow_attributes_without_reason = "warn"
# FIXME(color): I'm lazy about fixing this yet.
clippy.allow_attributes = "allow"
clippy.allow_attributes_without_reason = "allow"

clippy.cast_possible_truncation = "warn"
clippy.collection_is_never_read = "warn"
clippy.dbg_macro = "warn"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contains.

## Minimum supported Rust Version (MSRV)

This version of Peniko has been verified to compile with **Rust 1.70** and later.
This version of Peniko has been verified to compile with **Rust 1.82** and later.

Future versions of Peniko might increase the Rust version requirement.
It will not be treated as a breaking change and as such can even happen with small patch releases.
Expand Down
10 changes: 7 additions & 3 deletions src/brush.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use super::{Color, Gradient, Image};
/// Describes the color content of a filled or stroked shape.
///
/// See also [`BrushRef`] which can be used to avoid allocations.
#[derive(Clone, PartialEq, Debug)]
// FIXME(color): `PartialEq` was removed from here for now.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Brush {
/// Solid color brush.
Expand Down Expand Up @@ -37,7 +38,7 @@ impl From<Image> for Brush {

impl Default for Brush {
fn default() -> Self {
Self::Solid(Color::default())
Self::Solid(Color::TRANSPARENT)
}
}

Expand Down Expand Up @@ -77,7 +78,10 @@ impl Brush {
/// This is useful for methods that would like to accept brushes by reference. Defining
/// the type as `impl<Into<BrushRef>>` allows accepting types like `&LinearGradient`
/// directly without cloning or allocating.
#[derive(Copy, Clone, PartialEq, Debug)]
// FIXME(color): `PartialEq` was removed from here for now.
// FIXME(color): Think about this allow
#[allow(variant_size_differences)]
#[derive(Copy, Clone, Debug)]
pub enum BrushRef<'a> {
/// Solid color brush.
Solid(Color),
Expand Down
Loading

0 comments on commit c65c325

Please sign in to comment.