class interface ICO_BITMAP_DATA

creation
   make (a_block: F_MEMORY; w, h: INTEGER; a_bit_count: INTEGER)
      --  Set from bitmap and block.

      require
         block_not_void: a_block /= Void;
         width_ok: w > 0;
         height_ok: h > 0;
         bit_ok: is_bit_count(a_bit_count);
         size_ok: a_block.size >= bitmap_size(w,h,a_bit_count)

feature(s) from ICO_BITMAP_DATA
   --  Creation

   make (a_block: F_MEMORY; w, h: INTEGER; a_bit_count: INTEGER)
      --  Set from bitmap and block.

      require
         block_not_void: a_block /= Void;
         width_ok: w > 0;
         height_ok: h > 0;
         bit_ok: is_bit_count(a_bit_count);
         size_ok: a_block.size >= bitmap_size(w,h,a_bit_count)

feature(s) from ICO_BITMAP_DATA
   --  Creation

   set (a_block: F_MEMORY; w, h: INTEGER; a_bit_count: INTEGER)
      --  Set from bitmap and block.

      require
         block_not_void: a_block /= Void;
         width_ok: w > 0;
         height_ok: h > 0;
         bit_ok: is_bit_count(a_bit_count);
         size_ok: a_block.size >= bitmap_size(w,h,a_bit_count)

   memory: F_MEMORY

feature(s) from ICO_BITMAP_DATA
   --  Access

   bit_count: INTEGER
      --  Bits per pixel.


   line_count: INTEGER
      --  Bytes per line.


   width: INTEGER
      --  Size


   height: INTEGER
      --  Size


feature(s) from ICO_BITMAP_DATA
   --  Operation(s)

   pixel (an_x, a_y: INTEGER): INTEGER
      --  Pixel at (x,y), result is color index.

      require
         x_min: an_x >= 1;
         x_max: an_x <= width;
         y_min: a_y >= 1;
         y_max: a_y <= height
      ensure
         color_positive: Result >= 1;
         color_index: Result <= 2 ^ bit_count

invariant
   memory: memory /= Void;
   memory_size: memory.size >= bitmap_size(width,height,bit_count);

end of ICO_BITMAP_DATA