#pragma once

//this file should only be included from <daguerre/fixed-font.hpp>

#include <daguerre/image.hpp>
#include <utility>

namespace daguerre {

  template<class color_t>
  fixed_font<color_t>::fixed_font() : glyph_width(0), glyph_height(0) {}

  template <class color_t>
  fixed_font<color_t>::fixed_font(int glyph_width, int glyph_height)
  : glyph_width(glyph_width), glyph_height(glyph_height) {
    for (int i = 0; i < 128; ++i)
      glyphs[i] = image<color_t>(glyph_width, glyph_height);
  }

  template <class color_t>
  fixed_font<color_t>::fixed_font(fixed_font<color_t> &&other)
    : glyph_width(other.glyph_width), glyph_height(other.glyph_height) {
      for (int i = 0; i < 128; ++i)
        glyphs[i] = std::move(other.glyphs[i]);
      other.glyph_width = 0;
      other.glyph_height = 0;
    }

  template <class color_t>
  fixed_font<color_t> &fixed_font<color_t>::operator =(
    fixed_font<color_t> &&other) {
    glyph_width = other.glyph_width;
    glyph_height = other.glyph_height;
    for (int i = 0; i < 128; ++i)
      glyphs[i] = std::move(other.glyphs[i]);
    other.glyph_width = 0;
    other.glyph_height = 0;
    return *this;
  }

  template <class color_t>
  template <class other_color_t>
  fixed_font<color_t>::fixed_font(
    const fixed_font<other_color_t> &other,
    converter_t<color_t, other_color_t> *conversion)
  : glyph_width(other.glyph_width), glyph_height(other.glyph_height) {
    for (int i = 0; i < 128; ++i)
      glyphs[i] = image<color_t>(other.glyphs[i], conversion);
  }

  template <class color_t>
  fixed_font<color_t>::fixed_font(const fixed_font<color_t> &other, bool)
  : glyph_width(other.glyph_width), glyph_height(other.glyph_height) {
    for (int i = 0; i < 128; ++i)
      glyphs[i] = image<color_t>(other.glyphs[i], true);
  }

}

#include <daguerre/image.hpp>
