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

#include <PlatformDrawObject.h>

Inheritance diagram for PlatformEllipse:
PlatformDrawObject PEllipse PlatformDrawObject PEllipse PlatformWidget PlatformWidget PDrawObject PlatformWidget PlatformWidget PDrawObject PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget

Public Member Functions

 PlatformEllipse (int x1, int y1, int dx, int dy, Variant fg, bool filled)
 
virtual ~PlatformEllipse ()
 
virtual bool Draw ()
 This method initiates everything needed to display the main window

 
 PlatformEllipse (int x1, int y1, int rx, int ry, Variant fg, bool filled)
 
virtual ~PlatformEllipse ()
 
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 PEllipse
 PEllipse (pInt x1, pInt y1, pInt rx, pInt ry, Variant fg, bool filled)
 
virtual ~PEllipse ()
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual void SetSize (pInt dx, pInt dy)
 
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 PEllipse
pInt mRX
 
pInt mRY
 
- Protected Attributes inherited from PDrawObject
bool mFilled
 
bool mAntiAliased
 

Detailed Description

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

Constructor & Destructor Documentation

◆ PlatformEllipse() [1/2]

PlatformEllipse::PlatformEllipse ( int  x1,
int  y1,
int  dx,
int  dy,
Variant  fg,
bool  filled 
)

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

340 :
341 PEllipse(x1,y1,dx,dy,fg, filled)
342
343{
344 mNeedsTexture=false;
346 mSurface =NULL;
347 mParent = NULL;
348
349 mIsVisible=true;
350
351// mIsVisible=true;
352// mX = x1;
353// mY = y1;
354
355}
#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.

◆ ~PlatformEllipse() [1/2]

PlatformEllipse::~PlatformEllipse ( )
virtual

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

358{
359
360}

◆ PlatformEllipse() [2/2]

PlatformEllipse::PlatformEllipse ( int  x1,
int  y1,
int  rx,
int  ry,
Variant  fg,
bool  filled 
)

◆ ~PlatformEllipse() [2/2]

virtual PlatformEllipse::~PlatformEllipse ( )
virtual

Member Function Documentation

◆ Draw() [1/2]

bool PlatformEllipse::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

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

369{
370
371 int result=-1;
372 if(mParent && mRenderer)
373 {
374 SDL_SetRenderTarget(mRenderer, dynamic_cast<PlatformWidget*>(mParent)->GetSDL_Texture());
375
376 //LockSurface();
377 if(mFilled)
378 {
379
380 //aa ellipse only handles unfilled, so we need to draw it on-top.
381 if(mAntiAliased)
382 {
383 result = aaellipseRGBA(mRenderer,mX, mY, mRX, mRY,
384 GetColor()->GetRed(), GetColor()->GetGreen(), GetColor()->GetBlue(), GetColor()->GetAlpha());
385 }
386
387
388 result = filledEllipseRGBA(mRenderer,mX, mY, mRX, mRY,
389 GetColor()->GetRed(), GetColor()->GetGreen(), GetColor()->GetBlue(), GetColor()->GetAlpha());
390 }
391 else
392 {
393 if(mAntiAliased)
394 {
395 result = aaellipseRGBA(mRenderer,mX, mY, mRX, mRY,
396 GetColor()->GetRed(), GetColor()->GetGreen(), GetColor()->GetBlue(), GetColor()->GetAlpha());
397 }else
398 {
399 result = ellipseRGBA(mRenderer,mX, mY, mRX, mRY,
400 GetColor()->GetRed(), GetColor()->GetGreen(), GetColor()->GetBlue(), GetColor()->GetAlpha());
401 }
402 }
403 SDL_SetRenderTarget(mRenderer,NULL);
404 }
405 //UnlockSurface();
406 return result;
407}
bool mAntiAliased
Definition PDrawObject.h:69
PColor * GetColor() const
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.

References PDrawObject::GetColor(), PlatformWidget::GetSDL_Texture(), PDrawObject::mAntiAliased, PDrawObject::mFilled, PWidget::mParent, PlatformWidget::mRenderer, PEllipse::mRX, PEllipse::mRY, PWidget::mX, PWidget::mY, and NULL.

◆ Draw() [2/2]

virtual bool PlatformEllipse::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

◆ ObjectName()

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

Reimplemented from PWidget.

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

100{ return "PlatformEllipse (validator)"; }

◆ SendToStream() [1/2]

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

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

Reimplemented from PlatformWidget.

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

363{
364 out << "<An ellipse:"<< mX << ", " << mY << ":" << mRX << ", " << mRY << std::endl;
365 return out;
366}

References PEllipse::mRX, PEllipse::mRY, PWidget::mX, and PWidget::mY.

◆ SendToStream() [2/2]

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

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

Reimplemented from PlatformWidget.

◆ SetPosition()

virtual void PlatformEllipse::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 104 of file validator/PlatformDrawObject.h.

104{ PEllipse::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 PlatformEllipse::SetProperty ( std::string  name,
Variant  v 
)
inlinevirtual

Reimplemented from PWidget.

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

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

References PEllipse::SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PWidget.

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

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

References PEllipse::ValidateProperty().

◆ ValidateProperty() [2/2]

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

Reimplemented from PWidget.

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

102{ return PEllipse::ValidateProperty(name, v); }

References PEllipse::ValidateProperty().


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