#include "Text.h" /********************************************* Constructores *********************************************/ Text::Text() { } Text::Text(ifstream & infile) { infile >> sub_type >> color >> depth >> pen_style >> font; infile >> font_size >> angle >> font_flags; infile >> height >> length >> x >> y; stringText = readText(infile); } /********************************************* Operaciones *********************************************/ string Text::readText(ifstream &infile) { char c; string s; const string tail001="\\001"; getline(infile,s); infile >> c; // read the new line at the end of thhe line. s+=c; // added to s. Text might have new lines. while(s.substr(s.length()-5,4) != tail001){ infile >> c; // need to read even blank spaces. s += c; } return s; } //-------------------------------------------- void Text::write(void) { cout << object_code << ' '; cout << sub_type <<' '<< color << ' ' << depth <<' ' << pen_style <<' ' << font << ' ' << font_size <<' ' << angle << ' ' << font_flags << ' ' << height <<' ' << length <<' ' << x << ' ' << y << ' ' << stringText << '\n'; } //-------------------------------------------- void Text::mag(int xc, int yc, double f) { font_size=int(font_size*f); height = int(height*f); length = int(length*f); x = xc + int((x-xc)*f); y = yc + int((y-yc)*f); } //----------------------------------------------------- void Text::trans(int _x, int _y) { x+=_x; y+=_y; } //----------------------------------------------------- void Text::rot(int x, int y, Sentido s) { }