83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Graphics; Pseudo Package body
|
|
|
|
//## Subsystem: Graphic
|
|
|
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\Graphics.cpp
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Graphics
|
|
|
|
#include "Graphic\Graphics.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
#include <iostream.h>
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
// Class Graphics
|
|
|
|
|
|
|
|
Graphics::Graphics()
|
|
|
|
//## begin Graphics::Graphics%.hasinit preserve=no
|
|
|
|
//## end Graphics::Graphics%.hasinit
|
|
|
|
//## begin Graphics::Graphics%.initialization preserve=yes
|
|
|
|
//## end Graphics::Graphics%.initialization
|
|
|
|
{
|
|
|
|
//## begin Graphics::Graphics%.body preserve=yes
|
|
|
|
//## end Graphics::Graphics%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Graphics::~Graphics()
|
|
|
|
{
|
|
|
|
//## begin Graphics::~Graphics%.body preserve=yes
|
|
|
|
//## end Graphics::~Graphics%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (implementation)
|
|
|
|
void Graphics::drawCircle (Point center, int radius, Color color)
|
|
|
|
{
|
|
|
|
//## begin Graphics::drawCircle%938436810.body preserve=yes
|
|
|
|
cout << "\nCircle drawn with ("<<center.getx()<<","<<center.gety()<<") ,radius="<<radius<<" , color="<<color;
|
|
|
|
//## end Graphics::drawCircle%938436810.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Graphics::drawRectangle (Point leftTop, Point rightBottom, Color color)
|
|
|
|
{
|
|
|
|
//## begin Graphics::drawRectangle%938436812.body preserve=yes
|
|
|
|
cout << "\nRectangle drawn with ("<<leftTop.getx()<<","<<leftTop.gety()<<") to ("<<rightBottom.getx()<<","<<rightBottom.getx()<<"), color="<<color;
|
|
|
|
//## end Graphics::drawRectangle%938436812.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Graphics::drawLine (int x1, int y1, int x2, int y2, Color color)
|
|
|
|
{
|
|
|
|
//## begin Graphics::drawLine%938436813.body preserve=yes
|
|
|
|
cout << "\nLine drawn from ("<<x1<<","<<y1<<") to ("<<x2<<","<<y2<<"), color="<<color;
|
|
|
|
//## end Graphics::drawLine%938436813.body
|
|
|
|
}
|
|
|
|
|
|
|
|
Color Graphics::getBGColor ()
|
|
|
|
{
|
|
|
|
//## begin Graphics::getBGColor%939797852.body preserve=yes
|
|
|
|
return 0;
|
|
|
|
//## end Graphics::getBGColor%939797852.body
|
|
|
|
}
|
|
|
|
|
|
|
|
// Additional Declarations
|
|
|
|
//## begin Graphics.declarations preserve=yes
|
|
|
|
//## end Graphics.declarations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|