message: Deprecate IcoEncoder::encode due to endianness issue
diff: @@ -28,6 +28,9 @@ impl<W: Write> IcoEncoder<W> {
  /// Encodes the image ```image``` that has dimensions ```width``` and
  /// ```height``` and ```ColorType``` ```c```. The dimensions of the image
  /// must be between 1 and 256 (inclusive) or an error will be returned.
  + ///
  + /// Expects data to be big endian.
  + #[deprecated = "Use `IcoEncoder::write_image` instead. Beware that `write_image` has a different endianness convention"]
  pub fn encode(
  mut self,
  data: &[u8],
  @@ -36,6 +39,7 @@ impl<W: Write> IcoEncoder<W> {
  color: ColorType,
  ) -> ImageResult<()> {
  let mut image_data: Vec<u8> = Vec::new();
  + #[allow(deprecated)]
  PngEncoder::new(&mut image_data).encode(data, width, height, color)?;
  write_icondir(&mut self.w, 1)?;
  @@ -53,14 +57,33 @@ impl<W: Write> IcoEncoder<W> {
  }
  impl<W: Write> ImageEncoder for IcoEncoder<W> {
  + /// Write an ICO image with the specified width, height, and color type.
  + ///
  + /// For color types with 16-bit per channel or larger, the contents of `buf` should be in
  + /// native endian.
  + ///
  + /// WARNING: In image 0.23.14 and earlier this method erroneously expected buf to be in big endian.
  fn write_image(
  - self,
  + mut self,
  buf: &[u8],
  width: u32,
  height: u32,
  color_type: ColorType,
  ) -> ImageResult<()> {
  - self.encode(buf, width, height, color_type)
  + let mut image_data: Vec<u8> = Vec::new();
  + PngEncoder::new(&mut image_data).write_image(buf, width, height, color_type)?;
  +
  + write_icondir(&mut self.w, 1)?;
  + write_direntry(
  + &mut self.w,
  + width,
  + height,
  + color_type,
  + ICO_ICONDIR_SIZE + ICO_DIRENTRY_SIZE,
  + image_data.len() as u32,
  + )?;
  + self.w.write_all(&image_data)?;
  + Ok(())
  }
  }
  