@@ -259,15 +259,17 @@ impl Frame<'static> {
259
259
/// # Panics:
260
260
/// * If the length of pixels does not equal `width * height`.
261
261
/// * If the length of palette > `256 * 3`.
262
- pub fn from_palette_pixels ( width : u16 , height : u16 , pixels : & [ u8 ] , palette : & [ u8 ] , transparent : Option < u8 > ) -> Frame < ' static > {
262
+ pub fn from_palette_pixels ( width : u16 , height : u16 , pixels : impl Into < Vec < u8 > > , palette : impl Into < Vec < u8 > > , transparent : Option < u8 > ) -> Frame < ' static > {
263
+ let pixels = pixels. into ( ) ;
264
+ let palette = palette. into ( ) ;
263
265
assert_eq ! ( width as usize * height as usize , pixels. len( ) , "Too many or too little pixels for the given width and height to create a GIF Frame" ) ;
264
266
assert ! ( palette. len( ) <= 256 * 3 , "Too many palette values to create a GIF Frame" ) ;
265
267
266
268
Frame {
267
269
width,
268
270
height,
269
- buffer : Cow :: Owned ( pixels. to_vec ( ) ) ,
270
- palette : Some ( palette. to_vec ( ) ) ,
271
+ buffer : Cow :: Owned ( pixels) ,
272
+ palette : Some ( palette) ,
271
273
transparent,
272
274
..Frame :: default ( )
273
275
}
@@ -277,7 +279,8 @@ impl Frame<'static> {
277
279
///
278
280
/// # Panics:
279
281
/// * If the length of pixels does not equal `width * height`.
280
- pub fn from_indexed_pixels ( width : u16 , height : u16 , pixels : & [ u8 ] , transparent : Option < u8 > ) -> Frame < ' static > {
282
+ pub fn from_indexed_pixels ( width : u16 , height : u16 , pixels : impl Into < Vec < u8 > > , transparent : Option < u8 > ) -> Frame < ' static > {
283
+ let pixels = pixels. into ( ) ;
281
284
assert_eq ! ( width as usize * height as usize , pixels. len( ) , "Too many or too little pixels for the given width and height to create a GIF Frame" ) ;
282
285
283
286
Frame {
0 commit comments