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

#include <PlatformDrawObject.h>

Inheritance diagram for PlatformCircle:
PlatformDrawObject PCircle PlatformDrawObject PCircle PlatformWidget PlatformWidget PDrawObject PlatformWidget PlatformWidget PDrawObject PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget PWidget

Public Member Functions

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

 
 PlatformCircle (int x1, int y1, int r, Variant fg, bool filled)
 
virtual ~PlatformCircle ()
 
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 PCircle
 PCircle (pInt x1, pInt y1, pInt r, Variant fg, bool filled)
 
virtual ~PCircle ()
 
virtual pInt GetWidth () const
 
virtual pInt GetHeight () const
 
virtual std::ostream & SendToStream (std::ostream &out)
 
virtual void SetSize (pInt r)
 
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 PCircle
pDouble mR
 
- Protected Attributes inherited from PDrawObject
bool mFilled
 
bool mAntiAliased
 

Detailed Description

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

Constructor & Destructor Documentation

◆ PlatformCircle() [1/2]

PlatformCircle::PlatformCircle ( int  x1,
int  y1,
int  r,
Variant  fg,
bool  filled 
)

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

411 :
412 PCircle(x1,y1,r,fg,filled)
413{
414
415 mNeedsTexture=false;
417 mSurface =NULL;
418 mParent = NULL;
419 mIsVisible=true;
420
421
422}
#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.

◆ ~PlatformCircle() [1/2]

PlatformCircle::~PlatformCircle ( )
virtual

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

425{
426
427}

◆ PlatformCircle() [2/2]

PlatformCircle::PlatformCircle ( int  x1,
int  y1,
int  r,
Variant  fg,
bool  filled 
)

◆ ~PlatformCircle() [2/2]

virtual PlatformCircle::~PlatformCircle ( )
virtual

Member Function Documentation

◆ Draw() [1/2]

bool PlatformCircle::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

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

436{
437 int result=-1;
438 //LockSurface();
439 if(mParent && mRenderer)
440 {
441 SDL_SetRenderTarget(mRenderer,
442 dynamic_cast<PlatformWidget*>(mParent)->GetSDL_Texture());
443
444 if(mFilled)
445 {
446
447 if(mAntiAliased)
448 {
449 int result2 = aacircleRGBA(mRenderer, mX, mY, (int)mR,
450 GetColor()->GetRed(),
451 GetColor()->GetGreen(),
452 GetColor()->GetBlue(),
453 GetColor()->GetAlpha());
454 if(result2<0)
455 {
456 PError::SignalFatalError("Failed to render aa circle component.");
457 }
458 }
459
460
461 result = filledCircleRGBA(mRenderer, mX, mY, (int)mR,
462 GetColor()->GetRed(),
463 GetColor()->GetGreen(),
464 GetColor()->GetBlue(),
465 GetColor()->GetAlpha());
466 }
467 else
468 {
469
470 if(mAntiAliased)
471 {
472
473 result = aacircleRGBA(mRenderer, mX, mY, (int)mR,
474 GetColor()->GetRed(),
475 GetColor()->GetGreen(),
476 GetColor()->GetBlue(),
477 GetColor()->GetAlpha());
478 }
479 else
480 {
481
482 result = circleRGBA(mRenderer,mX, mY, (int)mR,
483 GetColor()->GetRed(),
484 GetColor()->GetGreen(),
485 GetColor()->GetBlue(),
486 GetColor()->GetAlpha());
487
488 }
489 }
490 SDL_SetRenderTarget(mRenderer,NULL);
491 }
492 //UnlockSurface();
493 return result;
494}
pDouble mR
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.
void SignalFatalError(const std::string &message)

References PDrawObject::GetColor(), PlatformWidget::GetSDL_Texture(), PDrawObject::mAntiAliased, PDrawObject::mFilled, PWidget::mParent, PCircle::mR, PlatformWidget::mRenderer, PWidget::mX, PWidget::mY, NULL, and PError::SignalFatalError().

◆ Draw() [2/2]

virtual bool PlatformCircle::Draw ( )
virtual

This method initiates everything needed to display the main window

Reimplemented from PlatformWidget.

◆ ObjectName()

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

Reimplemented from PWidget.

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

114{ return "PlatformCircle (validator)"; }

◆ SendToStream() [1/2]

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

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

Reimplemented from PlatformWidget.

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

430{
431 out << "<A Circle :"<< mX << ", " << mY << ":" << mR << std::endl;
432 return out;
433}

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

◆ SendToStream() [2/2]

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

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

Reimplemented from PlatformWidget.

◆ SetPosition()

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

118{ PCircle::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 PlatformCircle::SetProperty ( std::string  name,
Variant  v 
)
inlinevirtual

Reimplemented from PWidget.

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

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

References PCircle::SetProperty().

◆ ValidateProperty() [1/2]

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

Reimplemented from PWidget.

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

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

References PCircle::ValidateProperty().

◆ ValidateProperty() [2/2]

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

Reimplemented from PWidget.

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

116{ return PCircle::ValidateProperty(name, v); }

References PCircle::ValidateProperty().


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