PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PlatformBezier Class Reference

#include <PlatformDrawObject.h>

Inheritance diagram for PlatformBezier:
PlatformDrawObject PBezier PlatformDrawObject PBezier PlatformWidget PlatformWidget PDrawObject PlatformWidget PlatformWidget PDrawObject PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget

Public Member Functions

 PlatformBezier (int x, int y, Variant xpoints, Variant ypoints, int steps, Variant fg)
 
virtual ~PlatformBezier ()
 
virtual bool Draw ()
 This method initiates everything needed to display the main window

 
 PlatformBezier (int x, int y, Variant xpoints, Variant ypoints, int steps, Variant fg)
 
virtual ~PlatformBezier ()
 
virtual bool Draw ()
 This method initiates everything needed to display the main window

 
virtual std::string ObjectName () const
 
virtual bool SetProperty (std::string name, Variant v)
 
virtual ObjectValidationError ValidateProperty (std::string name, Variant v) const
 
virtual ObjectValidationError ValidateProperty (std::string name) const
 
virtual void SetPosition (pInt x, pInt y)
 This sets the widget's position on its parent widget.
 
- Public Member Functions inherited from PlatformDrawObject
 PlatformDrawObject ()
 
 ~PlatformDrawObject ()
 
 PlatformDrawObject ()
 
 ~PlatformDrawObject ()
 
- Public Member Functions inherited from PlatformWidget
 PlatformWidget ()
 
virtual ~PlatformWidget ()
 
virtual SDL_Texture * GetSDL_Texture ()
 Used to extract an SDL surface from the widget. Used by children drawing themselves on their parent.
 
void SetParent (PlatformWidget *parent)
 
SDL_Surface * GetSurface ()
 
virtual bool SetRenderer (SDL_Renderer *renderer)
 
SDL_Renderer * GetRenderer ()
 
virtual bool AddToParentWidget (PlatformWidget *parent)
 
virtual bool AddSubWidget (PlatformWidget *widget)
 
virtual bool RemoveSubWidget (PlatformWidget *widget)
 
virtual bool RemoveSubWidgets ()
 
virtual bool RotoZoom (double angle, double zoomx, double zoomy, int smooth)
 This uses the SDL_gfx package to 'rotozoom'.
 
bool SetPoint (int x, int y, PColor col)
 
PColor GetPixel (int x, int y)
 
 PlatformWidget ()
 
 PlatformWidget (pInt x, pInt y, pInt width, pInt height, bool visible)
 
virtual ~PlatformWidget ()
 
virtual bool RotoZoom (pDouble angle, pDouble zoomx, pDouble zoomy, pInt smooth)
 
virtual bool SetPoint (pInt x, pInt y, PColor col)
 
virtual PColor GetPixel (pInt x, pInt y)
 
- Public Member Functions inherited from PWidget
 PWidget ()
 
 PWidget (const PWidget &pw)
 
 PWidget (pInt x, pInt y, pInt width, pInt height, bool visible)
 
virtual ~PWidget ()
 
virtual void SetParent (PWidget *widget)
 This unconditionally sets the parent widget.
 
virtual PWidgetGetParent ()
 
virtual bool IsParent (PWidget *parent)
 
virtual void SetZoomX (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetZoomY (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetRotation (pDouble x)
 This sets the widget's position on its parent widget.
 
virtual void SetWidth (pInt w)
 
virtual void SetHeight (pInt h)
 
virtual pInt GetX () const
 
virtual pInt GetY () const
 
virtual void SetBackgroundColor (const PColor &color)
 
virtual PColor GetBackgroundColor ()
 
virtual bool AddSubWidget (PWidget *widget)
 
virtual bool RemoveSubWidget (PWidget *widget)
 
virtual bool RemoveLastSubWidget ()
 This is probably pretty useless.
 
virtual void Show ()
 
virtual void Hide ()
 
virtual bool IsVisible () const
 
- Public Member Functions inherited from PEBLObjectBase
 PEBLObjectBase ()
 Standard Constructor.
 
 PEBLObjectBase (ComplexDataType cdt)
 Standard Constructor.
 
 PEBLObjectBase (const PEBLObjectBase &pob)
 
virtual ~PEBLObjectBase ()
 Standard Destructor.
 
virtual bool InitializeProperty (std::string name, Variant v)
 
Variant GetProperty (std::string) const
 
ComplexDataType GetType ()
 
virtual std::ostream & PrintProperties (std::ostream &out)
 
virtual Variant GetPropertyList ()
 
- Public Member Functions inherited from PBezier
 PBezier (pInt x, pInt y, Variant xpoints, Variant ypoints, pInt steps, Variant fg)
 
virtual ~PBezier ()
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual bool SetXPoints (Variant v)
 
virtual bool SetYPoints (Variant v)
 
virtual bool SetSteps (Variant v)
 
virtual std::ostream & SendToStream (std::ostream &out)
 
virtual Variant GetProperty (std::string) const
 
- Public Member Functions inherited from PDrawObject
 PDrawObject ()
 
virtual ~PDrawObject ()
 
virtual void SetFilled (bool filled)
 
virtual void SetColor (Variant col)
 
virtual void SetOutlineColor (Variant ocol)
 
virtual void SetAA (bool aa)
 

Protected Member Functions

virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
virtual std::ostream & SendToStream (std::ostream &out) const
 An inheritable printing class used by PEBLObjectBase::operator<<.
 
- Protected Member Functions inherited from PlatformWidget
virtual void PrintSubWidgets (std::ostream &out) const
 
virtual bool LockSurface ()
 This needs to be used on some platforms/video cards.
 
virtual bool UnlockSurface ()
 This needs to be used on some platforms/video cards.
 
- Protected Member Functions inherited from PDrawObject
PColorGetColor () const
 
PColorGetOutlineColor () const
 

Additional Inherited Members

- Protected Attributes inherited from PlatformWidget
pInt mTextureWidth
 
pInt mTextureHeight
 
bool mNeedsTexture
 
SDL_Texture * mTexture
 
SDL_Surface * mSurface
 
SDL_Renderer * mRenderer
 
- Protected Attributes inherited from PWidget
pInt mX
 
pInt mY
 
pInt mDrawX
 
pInt mDrawY
 
pInt mWidth
 
pInt mHeight
 
pDouble mZoomX
 
pDouble mZoomY
 
pDouble mRotation
 
PColor mBackgroundColor
 The background color of the widget. if alpha = 0, will not be painted.
 
std::list< PWidget * > mSubWidgets
 
bool mIsVisible
 
PWidgetmParent
 
- Protected Attributes inherited from PEBLObjectBase
ComplexDataType mCDT
 
std::map< std::string, VariantmProperties
 
- Protected Attributes inherited from PBezier
Variant mXPoints
 
Variant mYPoints
 
pInt mSteps
 
- Protected Attributes inherited from PDrawObject
bool mFilled
 
bool mAntiAliased
 

Detailed Description

Definition at line 172 of file sdl/PlatformDrawObject.h.

Constructor & Destructor Documentation

◆ PlatformBezier() [1/2]

PlatformBezier::PlatformBezier ( int  x,
int  y,
Variant  xpoints,
Variant  ypoints,
int  steps,
Variant  fg 
)

Definition at line 644 of file sdl/PlatformDrawObject.cpp.

644 :
645 PBezier(x1,y1,xpoints,ypoints,steps, fg)
646{
647 mNeedsTexture=false;
649 mSurface =NULL;
650 mParent = NULL;
651 mIsVisible=true;
652
653}
#define NULL
Definition BinReloc.cpp:317
@ CDT_DRAWOBJECT
Definition PEBLObject.h:60
ComplexDataType mCDT
Definition PEBLObject.h:109
PWidget * mParent
Definition PWidget.h:154
bool mIsVisible
Definition PWidget.h:150
SDL_Surface * mSurface

References CDT_DRAWOBJECT, PEBLObjectBase::mCDT, PWidget::mIsVisible, PlatformWidget::mNeedsTexture, PWidget::mParent, PlatformWidget::mSurface, and NULL.

◆ ~PlatformBezier() [1/2]

PlatformBezier::~PlatformBezier ( )
virtual

Definition at line 655 of file sdl/PlatformDrawObject.cpp.

656{
657
658}

◆ PlatformBezier() [2/2]

PlatformBezier::PlatformBezier ( int  x,
int  y,
Variant  xpoints,
Variant  ypoints,
int  steps,
Variant  fg 
)

◆ ~PlatformBezier() [2/2]

virtual PlatformBezier::~PlatformBezier ( )
virtual

Member Function Documentation

◆ Draw() [1/2]

bool PlatformBezier::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

Definition at line 666 of file sdl/PlatformDrawObject.cpp.

667{
668 int result=-1;
669
670 if(mParent && mRenderer)
671 {
672 SDL_SetRenderTarget(mRenderer, dynamic_cast<PlatformWidget*>(mParent)->GetSDL_Texture());
673
674 //We need to transform the double-list points into int vectors for
675 //the x and y points, plus the length.
676
677 PList * pxlist = mXPoints.GetComplexData()->GetList();
678 PList * pylist = mYPoints.GetComplexData()->GetList();
679 unsigned long int length = pxlist->Length();
680 Sint16 *x = new Sint16[length];
681 Sint16 *y = new Sint16[length];
682
683 vector<Variant>::iterator p1 = pxlist->Begin();
684 vector<Variant>::iterator p2 = pylist->Begin();
685
686 int i = 0;
687 while(p1 != pxlist->End())
688 {
689 x[i]= (Sint16)((int)(*p1)) + (Sint16)mX;
690 y[i]= (Sint16)((int)(*p2)) + (Sint16)mY;
691 p1++;
692 p2++;
693 i++;
694
695 }
696
697
698 result = bezierRGBA(mRenderer,x,y,(int)length,(int)mSteps,
699 GetColor()->GetRed(), GetColor()->GetGreen(), GetColor()->GetBlue(), GetColor()->GetAlpha());
700
701 delete[] x;
702 delete[] y;
703
704 SDL_SetRenderTarget(mRenderer,NULL);
705 }
706
707 return result;
708}
Variant mYPoints
pInt mSteps
Variant mXPoints
PList * GetList() const
PColor * GetColor() const
Definition PList.h:45
std::vector< Variant >::const_iterator End() const
Definition PList.cpp:132
std::vector< Variant >::const_iterator Begin() const
Definition PList.cpp:127
unsigned long Length() const
Definition PList.h:89
pInt mX
Definition PWidget.h:125
pInt mY
Definition PWidget.h:125
SDL_Renderer * mRenderer
virtual SDL_Texture * GetSDL_Texture()
Used to extract an SDL surface from the widget. Used by children drawing themselves on their parent.
PComplexData * GetComplexData() const
Definition Variant.cpp:1299

References PList::Begin(), PList::End(), PDrawObject::GetColor(), Variant::GetComplexData(), PComplexData::GetList(), PlatformWidget::GetSDL_Texture(), PList::Length(), PWidget::mParent, PlatformWidget::mRenderer, PBezier::mSteps, PWidget::mX, PBezier::mXPoints, PWidget::mY, PBezier::mYPoints, and NULL.

◆ Draw() [2/2]

virtual bool PlatformBezier::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

◆ ObjectName()

virtual std::string PlatformBezier::ObjectName ( ) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 142 of file validator/PlatformDrawObject.h.

142{ return "PlatformBezier (validator)"; }

◆ SendToStream() [1/2]

std::ostream & PlatformBezier::SendToStream ( std::ostream &  out) const
protectedvirtual

An inheritable printing class used by PEBLObjectBase::operator<<.

Reimplemented from PlatformWidget.

Definition at line 660 of file sdl/PlatformDrawObject.cpp.

661{
662 out << "<A Bezier :"<< mX << ", " << mY << ":" << std::endl;
663 return out;
664}

References PWidget::mX, and PWidget::mY.

◆ SendToStream() [2/2]

virtual std::ostream & PlatformBezier::SendToStream ( std::ostream &  out) const
protectedvirtual

An inheritable printing class used by PEBLObjectBase::operator<<.

Reimplemented from PlatformWidget.

◆ SetPosition()

virtual void PlatformBezier::SetPosition ( pInt  x,
pInt  y 
)
inlinevirtual

This sets the widget's position on its parent widget.

Sets the location of the upper left-hand corner of the image on the parent widget; unless overridden

Reimplemented from PWidget.

Definition at line 146 of file validator/PlatformDrawObject.h.

146{ PBezier::SetPosition(x, y); }
virtual void SetPosition(pInt x, pInt y)
This sets the widget's position on its parent widget.
Definition PWidget.cpp:220

References PWidget::SetPosition().

◆ SetProperty()

virtual bool PlatformBezier::SetProperty ( std::string  name,
Variant  v 
)
inlinevirtual

Reimplemented from PWidget.

Definition at line 143 of file validator/PlatformDrawObject.h.

143{ return PBezier::SetProperty(name, v); }
virtual bool SetProperty(std::string, Variant v)

References PBezier::SetProperty().

◆ ValidateProperty() [1/2]

virtual ObjectValidationError PlatformBezier::ValidateProperty ( std::string  name) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 145 of file validator/PlatformDrawObject.h.

145{ return PBezier::ValidateProperty(name); }
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const

References PBezier::ValidateProperty().

◆ ValidateProperty() [2/2]

virtual ObjectValidationError PlatformBezier::ValidateProperty ( std::string  name,
Variant  v 
) const
inlinevirtual

Reimplemented from PWidget.

Definition at line 144 of file validator/PlatformDrawObject.h.

144{ return PBezier::ValidateProperty(name, v); }

References PBezier::ValidateProperty().


The documentation for this class was generated from the following files: