template<blend_pf f>
void Sprite::make_print_blink_dot2(Image& dst, CN(Vec) pos, int timer) const {
  constexpr int dots2x2[2][2] = {
    {0, 1},
    {1, 0} };
  //! оптимизация по размеру вставки
  if ( !tex.check() || !dst.check()) return;
  int posx = pos.x + offset.x;
  int posy = pos.y + offset.y;
  if (posx >= dst.getX()) return;
  if (posy >= dst.getY()) return;
  auto ey = posy + tex.getY();
  auto ex = posx + tex.getX();
  if (ex <= 0) return;
  if (ey <= 0) return;
  if (ey > dst.getY()) ey = dst.getY();
  if (ex > dst.getX()) ex = dst.getX();
  cauto old_posy = posy;
  cauto old_posx = posx;
  if (posx < 0) posx = 0;
  if (posy < 0) posy = 0;
  for (int y = posy; y < ey; ++y)
  for (int x = posx; x < ex; ++x) {
    // оптимизация без использования ветвления
    CN(Color) MASK = mask.fast_get(x - old_posx, y - old_posy);
    CN(Color) SRC  =  tex.fast_get(x - old_posx, y - old_posy);
    Color &DST = *dst.fast_get_ptr(x, y);
    Color SRC_DST[2] = {SRC, DST};
    const int mode = dots2x2[x & 1][y & 1] ^ (timer & 1);
    SRC_DST[0] = SRC_DST[mode];
    f(SRC_DST[MASK.val & 1], DST);
  }
}
void Sprite::print_blink_dot2(Image& dst, CN(Vec) pos, int timer) const
  { make_print_blink_dot2<blend_past>(dst, pos, timer); }
void Sprite::print_blink_dot2_diff(Image& dst, CN(Vec) pos, int timer) const
  { make_print_blink_dot2<blend_diff>(dst, pos, timer); }
template<blend_pf pf> void Sprite::make_print_mask(CN(Vec) pos, Image& dst) const {
  //! оптимизация по размеру вставки
  if ( !tex.check() || !dst.check()) return;
  int posx = pos.x + offset.x;
  int posy = pos.y + offset.y;
  if (posx >= dst.getX()) return;
  if (posy >= dst.getY()) return;
  auto ey = posy + tex.getY();
  auto ex = posx + tex.getX();
  if (ex <= 0) return;
  if (ey <= 0) return;
  if (ey > dst.getY()) ey = dst.getY();
  if (ex > dst.getX()) ex = dst.getX();
  cauto old_posy = posy;
  cauto old_posx = posx;
  if (posx < 0) posx = 0;
  if (posy < 0) posy = 0;
  for (int y = posy; y < ey; ++y)
  for (int x = posx; x < ex; ++x) {
    // оптимизация без использования ветвления
    CN(Color) MASK = mask.fast_get(x - old_posx, y - old_posy);
    Color SRC = tex.fast_get(x - old_posx, y - old_posy);
    Color &DST = *dst.fast_get_ptr(x, y);
    pf(DST, SRC);
    const Color SRC_DST[2] = {SRC, DST};
    DST = SRC_DST[MASK.val & 1];
    //pf(, DST);
  }
}