Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/

Committer:
adelino
Date:
Sun Apr 05 13:54:48 2015 +0000
Revision:
1:a74e42cf52b2
PicasoLib version 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
adelino 1:a74e42cf52b2 1 #include "Segment.h"
adelino 1:a74e42cf52b2 2
adelino 1:a74e42cf52b2 3 Segment::Segment(Screen* mScreen,UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2,Color _color):
adelino 1:a74e42cf52b2 4 Widget(mScreen,0,_x1,_y1,0,0,_color)
adelino 1:a74e42cf52b2 5 {
adelino 1:a74e42cf52b2 6 myX1=_x1;
adelino 1:a74e42cf52b2 7 myY1=_y1;
adelino 1:a74e42cf52b2 8 myX2=_x2;
adelino 1:a74e42cf52b2 9 myY2=_y2;
adelino 1:a74e42cf52b2 10
adelino 1:a74e42cf52b2 11 myType=OBJ_SEGMENT;
adelino 1:a74e42cf52b2 12
adelino 1:a74e42cf52b2 13 myScreen->addWidget((Widget*)this);
adelino 1:a74e42cf52b2 14 }
adelino 1:a74e42cf52b2 15 //------------------------------------------
adelino 1:a74e42cf52b2 16 void Segment::draw(void)
adelino 1:a74e42cf52b2 17 {
adelino 1:a74e42cf52b2 18 if(myIsVisible==false)
adelino 1:a74e42cf52b2 19 return;
adelino 1:a74e42cf52b2 20
adelino 1:a74e42cf52b2 21 //
adelino 1:a74e42cf52b2 22 PicasoSerial* ps=0;
adelino 1:a74e42cf52b2 23 ps=myScreen->getPicasoSerial();
adelino 1:a74e42cf52b2 24
adelino 1:a74e42cf52b2 25 if(ps!=0) {
adelino 1:a74e42cf52b2 26 ps->draw_line(myX1,myY1,myX2,myY2,myColor);
adelino 1:a74e42cf52b2 27 }
adelino 1:a74e42cf52b2 28 ps=0;
adelino 1:a74e42cf52b2 29 }
adelino 1:a74e42cf52b2 30 //------------------------------------------
adelino 1:a74e42cf52b2 31 Segment::~Segment(void)
adelino 1:a74e42cf52b2 32 {
adelino 1:a74e42cf52b2 33 }
adelino 1:a74e42cf52b2 34 //-------------------------------------------
adelino 1:a74e42cf52b2 35 void Segment::setInvisible(bool _state)
adelino 1:a74e42cf52b2 36 {
adelino 1:a74e42cf52b2 37 if(_state==true) {
adelino 1:a74e42cf52b2 38 if(myIsVisible==false)
adelino 1:a74e42cf52b2 39 return;
adelino 1:a74e42cf52b2 40 //
adelino 1:a74e42cf52b2 41 myIsVisible=false;
adelino 1:a74e42cf52b2 42 Color c=myScreen->getColorBkg();
adelino 1:a74e42cf52b2 43
adelino 1:a74e42cf52b2 44 PicasoSerial* ps=0;
adelino 1:a74e42cf52b2 45 ps=myScreen->getPicasoSerial();
adelino 1:a74e42cf52b2 46
adelino 1:a74e42cf52b2 47 if(ps!=0)
adelino 1:a74e42cf52b2 48 ps->draw_line(myX1,myY1,myX2,myY2,c);
adelino 1:a74e42cf52b2 49 ps=0;
adelino 1:a74e42cf52b2 50 }
adelino 1:a74e42cf52b2 51 //
adelino 1:a74e42cf52b2 52 else {
adelino 1:a74e42cf52b2 53 myIsVisible=true;
adelino 1:a74e42cf52b2 54 this->draw();
adelino 1:a74e42cf52b2 55 }
adelino 1:a74e42cf52b2 56 }
adelino 1:a74e42cf52b2 57 //---------------------------------------------
adelino 1:a74e42cf52b2 58 void Segment::setNewCoord(UINT16 _x1,UINT16 _y1,UINT16 _x2,UINT16 _y2)
adelino 1:a74e42cf52b2 59 {
adelino 1:a74e42cf52b2 60 if(myIsVisible==false)
adelino 1:a74e42cf52b2 61 return;
adelino 1:a74e42cf52b2 62
adelino 1:a74e42cf52b2 63 if(myX1==_x1 && myY1==_y1 && myX2==_x2 && myY2==_y2)
adelino 1:a74e42cf52b2 64 return;
adelino 1:a74e42cf52b2 65
adelino 1:a74e42cf52b2 66 this->setInvisible(true);
adelino 1:a74e42cf52b2 67
adelino 1:a74e42cf52b2 68 myX1=_x1;
adelino 1:a74e42cf52b2 69 myY1=_y1;
adelino 1:a74e42cf52b2 70 myX2=_x2;
adelino 1:a74e42cf52b2 71 myY2=_y2;
adelino 1:a74e42cf52b2 72
adelino 1:a74e42cf52b2 73 this->setInvisible(false);
adelino 1:a74e42cf52b2 74 }