PSizei.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
20 class PSizef;
21 
27 class PAPILLON_API_CORE PSizei : public PObject
28 {
29 public:
33  static const PSizei& Zero() { static const PSizei ZERO(0,0); return ZERO; }
34 
38  PSizei();
39 
43  explicit PSizei(papillon::int32 n);
44 
48  explicit PSizei(papillon::int32 width, papillon::int32 height);
49 
53  PSizei(const PSizei& other);
54 
58  virtual ~PSizei();
59 
63  PSizei& operator=(const PSizei& other);
64 
69  bool operator==(const PSizei& other) const;
70 
75  bool operator!=(const PSizei& other) const;
76 
81  bool IsValid() const;
82 
86  bool IsZero() const;
87 
91  papillon::int32 GetWidth() const;
92 
96  papillon::int32 GetHeight() const;
97 
101  PSizei Scaled(float factor) const;
102 
106  PSizei Clamped(papillon::int32 min, papillon::int32 max);
107 
112  PSizei ClampedWH(papillon::int32 minW, papillon::int32 maxW, papillon::int32 minH, papillon::int32 maxH);
113 
117  PSizef ToSizef() const;
118 
125  static PResult FromString(const PString& s, PSizei& size);
126 
130  PString ToStringShort() const;
131 };
132 
133 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PSizei class represents the size of an image or a rectangle: width (int) and height (int); PSizei...
Definition: PSizei.h:27
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
PResult FromString(const PString &s)
Builds a PObject from a string (destringify).
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
The PSizef class represents the size of an image or a rectangle: width (float) and height (float); PS...
Definition: PSizef.h:28
static const PSizei & Zero()
Returns the constant holding the 0x0 size.
Definition: PSizei.h:33