#pragma once

class tiny_bitmap
{
public:
  tiny_bitmap(std::string file_name)
    :m_image_buf(NULL)
  {
   std::ifstream fin;
   fin.open(file_name.c_str(), std::ios::binary);

   fin.read((char*)&m_bh, sizeof(BITMAP_HEADER));
   fin.read((char*)&m_bih, sizeof(BITMAP_INFO_HEADER));

   if(m_bh.type !=0x4D42)
   {

     fin.close();
     std::cerr << "[ERROR] tiny.bitmap::tiny_bitmap() Invalid Image File" <<std::endl;
     exit(1);
   }

   m_image_buf = create_bitmap_24bit(m_bih.height, m_bih.width);
   char padding_buf[4];
   for(int i=0 ; i<m_bih.height ; i++)
   {
     fin.read((char*)(m_image_buf[m_bih.height-1-i]),m_bih.width * 3);
     if((m_bih.width % 4) != 0)
     {
       fin.read(padding_buf, (m_bih.width % 4));
     }
   }

   fin.close();
  }

  void export_image(std::string file_name)
  {
    std::ofstream fout;

    fout.open(file_name.c_str(), std::ios::binary);

    fout.write((char*)&m_bh, sizeof(BITMAP_HEADER));
    fout.write((char*)&m_bih, sizeof(BITMAP_INFO_HEADER));

    char padding_buf[4] = {0,0,0,0};
    for(int i=0 ; i<m_bih.height ; i++)
    {
      for(int j=0 ; j<m_bih.width *3 ; j+=3)
      {
        fout.write((char*)(m_image_buf[m_bih.height-1-i]+j), sizeof(unsigned char));
        fout.write((char*)(m_image_buf[m_bih.height-1-i]+j+1), sizeof(unsigned char));
        fout.write((char*)(m_image_buf[m_bih.height-1-i]+j+2), sizeof(unsigned char));
      }

      if((m_bih.width % 4) !=0)
      {
        fout.write(padding_buf, (m_bih.width % 4));
      }
    }
  }

protected:
  unsigned char** create_bitmap_24bit(int height, int width)
  {
    unsigned char** image_buf;
    image_buf = new unsigned char*[height];
    for(int i=0 ; i < height ; i++)
    {
      image_buf[i] = new unsigned char[width*3];
    }

    return image_buf;
  }

  ~tiny_bitmap()
  {
    if(m_image_buf != NULL)
    {
      delete [] m_image_buf;
      m_image_buf = NULL ;
    }
  }

protected:
  BITMAP_HEADER m_bh;
  BITMAP_INFO_HEADER m_bih;
  unsigned char** m_image_buf;

};





#pragma once
#include "tinybmp.h"

class tiny_bitmap_rotate : public tiny_bitmap
{
public:
  tiny_bitmap_rotate(std::string file_name)
    :tiny_bitmap(file_name)
  {

  }
public:
  void rotate()
  {
    unsigned char** new_image_buf = create_bitmap_24bit(m_bih.width, m_bih.height);
    for(int i = 0; i < m_bih.height ; i++)
    {
      for(int j = 0; j < m_bih.width ; j++)
      {
        new_image_buf[j][i*3 ] = m_image_buf[i][];
        new_image_buf[j][i*3+1] = m_image_buf[i][];
        new_image_buf[j][i*3+2] = m_image_buf[i][];
      }
    }

    for(int i=0; i<m_bih.height;i++)
    {
      delete [] m_image_buf[i];
    }
    delete [] m_image_buf;

    m_image_buf = new_image_buf;
  }
};

이 코드에서 마지막 형광색 칠한부분만 넣으면 이미지가 오른쪽으로 90도 회전한다고 하는데 아무리 넣어봐도 모르겠네요
마지막으로 이것만 넣으면 끝인데 아무리 해봐도 안되네요
제발 좀 도와주세요