diff --git a/swf/src/types.rs b/swf/src/types.rs index 35560dadd..087219c03 100644 --- a/swf/src/types.rs +++ b/swf/src/types.rs @@ -762,7 +762,7 @@ pub enum FillStyle { }, } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct Gradient { pub matrix: Matrix, pub spread: GradientSpread, @@ -770,7 +770,7 @@ pub struct Gradient { pub records: Vec, } -#[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq, Enum)] +#[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq, Enum, Hash)] pub enum GradientSpread { Pad = 0, Reflect = 1, @@ -788,7 +788,7 @@ impl GradientSpread { } } -#[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, FromPrimitive, PartialEq, Hash)] pub enum GradientInterpolation { Rgb = 0, LinearRgb = 1, @@ -805,7 +805,7 @@ impl GradientInterpolation { } } -#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash)] pub struct GradientRecord { pub ratio: u8, pub color: Color, diff --git a/swf/src/types/color.rs b/swf/src/types/color.rs index accdec3bb..a4bbcdac0 100644 --- a/swf/src/types/color.rs +++ b/swf/src/types/color.rs @@ -1,7 +1,7 @@ /// An RGBA (red, green, blue, alpha) color. /// /// All components are stored as [`u8`] and have a color range of 0-255. -#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash)] pub struct Color { /// The red component value. pub r: u8, diff --git a/swf/src/types/fixed.rs b/swf/src/types/fixed.rs index 7684afb74..975016c4f 100644 --- a/swf/src/types/fixed.rs +++ b/swf/src/types/fixed.rs @@ -19,7 +19,7 @@ macro_rules! define_fixed { into_float($($into_type:path),*) ) => { /// A signed fixed-point value with $frac_bits bits. - #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct $type_name($underlying_type); /// A signed fixed-point type. diff --git a/swf/src/types/matrix.rs b/swf/src/types/matrix.rs index 7b0c5b135..80086fbd2 100644 --- a/swf/src/types/matrix.rs +++ b/swf/src/types/matrix.rs @@ -15,7 +15,7 @@ use std::ops; /// This means that objects in Flash can only move in units of twips, or 1/20 pixels. /// /// [SWF19 pp.22-24](https://web.archive.org/web/20220205011833if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf#page=22) -#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub struct Matrix { /// The matrix element at `[0, 0]`. Labeled `ScaleX` in SWF19. pub a: Fixed16, diff --git a/swf/src/types/twips.rs b/swf/src/types/twips.rs index 48d40f5ca..72b32e373 100644 --- a/swf/src/types/twips.rs +++ b/swf/src/types/twips.rs @@ -15,7 +15,7 @@ /// 40,000 twips, or `4*10^4` . If you then have two such numbers, /// multiplying them as part of calculations yields `16*10^8`, which is /// relatively close to the upper limit of `i32` at about `2*10^9`. -#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd, Hash)] pub struct Twips(i32); impl Twips {