pub fn new_palette(&self, color_count: usize) -> Result<Palette<'_>, String> {
    let max = core::i32::MAX as usize;
    if color_count > max {
      return Err("beryllium error: color_count > i32::MAX".to_string());
    }
    if color_count < 2 {
      return Err("beryllium error: color_count of a palette must be at least 2".to_string());
    }
    match NonNull::new(unsafe { SDL_AllocPalette(color_count as i32) }) {
      Some(nn) => Ok(Palette {
        nn,
        _marker: PhantomData,
      }),
      None => Err(get_error()),
    }
  }
/// Allocates a new [Palette] with the number of color slots given.
///
/// The initial value of the palette color values is `0xFF` in all four
/// channels (opaque white).
Allocates a new [Palette] with the number of color slots given.
The initial value of the palette color values is `0xFF` in all four
channels (opaque white).
Allocates a new [ Palette ] with the number of color slots given . The initial value of the palette color values is ` 0xFF ` in all four channels ( opaque white ) .
pub fn new_palette(&self, color_count: usize) -> Result<Palette<'_>, String> {
    let max = core::i32::MAX as usize;
    if color_count > max {
      return Err("beryllium error: color_count > i32::MAX".to_string());
    }
    if color_count < 2 {
      return Err("beryllium error: color_count of a palette must be at least 2".to_string());
    }
    match NonNull::new(unsafe { SDL_AllocPalette(color_count as i32) }) {
      Some(nn) => Ok(Palette {
        nn,
        _marker: PhantomData,
      }),
      None => Err(get_error()),
    }
  }
pub fn new_palette ( & self , color_count : usize ) -> Result < Palette < ' _ > , String > { let max = core :: i32 :: MAX as usize ; if color_count > max { return Err ( " " . to_string ( ) ) ; } if color_count < 2 { return Err ( " " . to_string ( ) ) ; } match NonNull :: new ( unsafe { SDL_AllocPalette ( color_count as i32 ) } ) { Some ( nn ) => Ok ( Palette { nn , _marker : PhantomData , } ) , None => Err ( get_error ( ) ) , } }
Allocates a new [Palette] with the number of color slots given.
Allocates a new [ Palette ] with the number of color slots given .
&self
color_count
usize
&self
color_count
usize