class interface ICO_BITMAP

creation
   make (a_block: F_MEMORY)
      --  Initialise from memory block.

      require
         not_void: a_block /= Void

   make_rgb
      --  Make blank header for 24bit RGB bitmap.

      ensure
         is_valid: is_valid

   make_mono
      --  Blank header for uncompressed 256 color bitmap.

      ensure
         is_valid

   make_16_colors
      --  Blank header for uncompressed 16 color bitmap.

      ensure
         is_valid: is_valid;
         colors: has_colors

   make_256_colors
      --  Blank header for uncompressed 256 color bitmap.

      ensure
         is_valid: is_valid;
         colors: has_colors

feature(s) from BITMAPINFO
   --  Creation

   make (a_block: F_MEMORY)
      --  Initialise from memory block.

      require
         not_void: a_block /= Void

feature(s) from BITMAPINFO
   --  Creation

   set (a_block: F_MEMORY)
      --  Initialise from memory block.

      require
         not_void: a_block /= Void

   make_rgb
      --  Make blank header for 24bit RGB bitmap.

      ensure
         is_valid: is_valid

   make_16_colors
      --  Blank header for uncompressed 16 color bitmap.

      ensure
         is_valid: is_valid;
         colors: has_colors

   make_256_colors
      --  Blank header for uncompressed 256 color bitmap.

      ensure
         is_valid: is_valid;
         colors: has_colors

   make_mono
      --  Blank header for uncompressed 256 color bitmap.

      ensure
         is_valid

   reset_header
      --  Reset header.


feature(s) from BITMAPINFO
   --  Access

   is_valid: BOOLEAN
      --  Is layout OK?


   has_colors: BOOLEAN
      --  Colors layout OK?

      require
         valid: is_valid

   width: INTEGER
      --  Width.

      require
         valid: is_valid

   set_width (an_int: INTEGER)
      --  Set width.

      require
         valid: is_valid
      ensure
         valid: is_valid

   height: INTEGER
      --  Height.

      require
         valid: is_valid

   set_height (an_int: INTEGER)
      --  Set width.

      require
         valid: is_valid
      ensure
         valid: is_valid

   bit_count: INTEGER
      --  Bit count.

      require
         valid: is_valid

   number_of_colors: INTEGER
      --  Number of colors.

      require
         valid: is_valid

   color (n: INTEGER): RGB_COLOR
      --  Color.

      require
         valid: is_valid;
         min: n >= 1;
         max: n <= number_of_colors;
         layout: has_colors

   set_color (a_color: RGB_COLOR; n: INTEGER)
      --  Set color.

      require
         valid: is_valid;
         has_colors: has_colors;
         min: n >= 1;
         max: n <= number_of_colors;
         color_not_void: a_color /= Void
      ensure
         done: color(n).is_equal(a_color)

feature(s) from ICO_BITMAP
   --  Access

   has_xor_bitmap: BOOLEAN
      --  Is XOR bitmap here?

      require
         valid: is_valid

   has_and_bitmap: BOOLEAN
      --  Is AND bitmap here?

      require
         valid: is_valid

   is_well_formed: BOOLEAN
      --  All pieces there?

      ensure
         layout: Result implies is_valid;
         colors: Result implies has_colors;
         xor_bitmap: Result implies has_xor_bitmap;
         and_bitmap: Result implies has_and_bitmap

   xor_bitmap: ICO_BITMAP_DATA
      --  XOR bitmap data.

      require
         valid: is_valid;
         has: has_xor_bitmap

   and_bitmap: ICO_BITMAP_DATA
      --  AND bitmap data.

      require
         valid: is_valid;
         has: has_and_bitmap

invariant
   valid_memory: memory /= Void;
   valid_memory: memory /= Void;

end of ICO_BITMAP