Ocean
MediaTexture2D.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_MEDIA_TEXTURE_2D_H
9 #define META_OCEAN_RENDERING_MEDIA_TEXTURE_2D_H
10 
13 
14 #include "ocean/base/Timestamp.h"
15 
16 #include "ocean/media/MediumRef.h"
18 
19 namespace Ocean
20 {
21 
22 namespace Rendering
23 {
24 
25 // Forward declaration
26 class MediaTexture2D;
27 
28 /**
29  * Definition of a smart object reference holding a 2D texture.
30  * @see SmartObjectRef, Texture2D.
31  * @ingroup rendering
32  */
34 
35 /**
36  * This class is the base class for all 2D textures receiving their image content from Media objects.
37  * @see FrameTexture2D.
38  * @ingroup rendering
39  */
40 class OCEAN_RENDERING_EXPORT MediaTexture2D : virtual public Texture2D
41 {
42  public:
43 
44  /**
45  * Returns the frame medium of this texture.
46  * @exception NotSupportedException Is thrown if this function is not supported
47  * @return Frame medium providing the image data
48  * @see setMedium(), Media::FrameMedium.
49  */
50  virtual Media::FrameMediumRef medium() const;
51 
52  /**
53  * Sets the frame medium of this texture.
54  * @exception NotSupportedException Is thrown if this function is not supported
55  * @param medium Frame medium to set
56  * @see medium(), Media::FrameMedium.
57  */
58  virtual void setMedium(const Media::FrameMediumRef& medium);
59 
60  /**
61  * Returns the frame type of this texture.
62  * @return Texture frame type
63  */
64  FrameType frameType() const override;
65 
66  /**
67  * Returns whether this texture contains at least one transparent pixel.
68  * @return True, if so
69  */
70  bool hasTransparentPixel() const override;
71 
72  /**
73  * Returns the type of this object.
74  * @see Object::type().
75  */
76  ObjectType type() const override;
77 
78  protected:
79 
80  /**
81  * Creates a new 2D media texture object.
82  */
84 
85  /**
86  * Destructs a 2D media texture object.
87  */
88  ~MediaTexture2D() override;
89 
90  protected:
91 
92  /// Frame medium providing the image data.
94 
95  /// The frame type of the current frame.
97 
98  /// The timestamp of the current frame.
100 };
101 
102 }
103 
104 }
105 
106 #endif // META_OCEAN_RENDERING_MEDIA_TEXTURE_2D_H
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition: Frame.h:30
This class is the base class for all 2D textures receiving their image content from Media objects.
Definition: MediaTexture2D.h:41
bool hasTransparentPixel() const override
Returns whether this texture contains at least one transparent pixel.
~MediaTexture2D() override
Destructs a 2D media texture object.
FrameType frameType_
The frame type of the current frame.
Definition: MediaTexture2D.h:96
Timestamp frameTimestamp_
The timestamp of the current frame.
Definition: MediaTexture2D.h:99
FrameType frameType() const override
Returns the frame type of this texture.
virtual Media::FrameMediumRef medium() const
Returns the frame medium of this texture.
ObjectType type() const override
Returns the type of this object.
MediaTexture2D()
Creates a new 2D media texture object.
Media::FrameMediumRef frameMedium_
Frame medium providing the image data.
Definition: MediaTexture2D.h:93
virtual void setMedium(const Media::FrameMediumRef &medium)
Sets the frame medium of this texture.
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all 2D textures.
Definition: Texture2D.h:38
This class implements a timestamp.
Definition: Timestamp.h:36
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition: FrameMedium.h:32
SmartObjectRef< MediaTexture2D > MediaTexture2DRef
Definition of a smart object reference holding a 2D texture.
Definition: MediaTexture2D.h:26
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15