1 #ifndef __DALI_INTEGRATION_RESOURCE_TYPES_H__
2 #define __DALI_INTEGRATION_RESOURCE_TYPES_H__
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
26 #include <dali/public-api/common/dali-common.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <dali/public-api/images/image-operations.h>
29 #include <dali/public-api/math/uint-16-pair.h>
30 #include <dali/public-api/math/vector2.h>
35 typedef Uint16Pair ImageDimensions;
43 * Extendable set of resource types
51 * The abstract base class for resource types.
57 * @param[in] typeId resource type id
59 ResourceType(ResourceTypeId typeId)
65 virtual ~ResourceType() {}
68 * Create a copy of the resource type with the same attributes.
69 * @return pointer to the new ResourceType.
71 virtual ResourceType* Clone() const = 0;
73 const ResourceTypeId id;
77 // Undefined copy constructor.
78 ResourceType(const ResourceType& typePath);
80 // Undefined assignment operator.
81 ResourceType& operator=(const ResourceType& rhs);
85 * BitmapResourceType describes a bitmap resource, which can be requested
86 * from ResourceLoader::LoadResource() or AllocateBitmapImage.
88 struct BitmapResourceType : public ResourceType
92 * @param[in] size The requested size for the bitmap.
93 * @param[in] scalingMode The method to use to map the source bitmap to the desired
95 * @param[in] samplingMode The filter to use if the bitmap needs to be downsampled
96 * to the requested size.
97 * @param[in] orientationCorrection Whether to use bitmap metadata to rotate or
98 * flip the bitmap, e.g., from portrait to landscape.
100 BitmapResourceType( ImageDimensions size = ImageDimensions( 0, 0 ),
101 FittingMode::Type scalingMode = FittingMode::DEFAULT,
102 SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
103 bool orientationCorrection = true )
104 : ResourceType(ResourceBitmap),
105 size(size), scalingMode(scalingMode), samplingMode(samplingMode), orientationCorrection(orientationCorrection) {}
110 virtual ~BitmapResourceType() {}
113 * @copydoc ResourceType::Clone
115 virtual ResourceType* Clone() const
117 return new BitmapResourceType( size, scalingMode, samplingMode, orientationCorrection );
121 * Attributes are copied from the request.
123 ImageDimensions size;
124 FittingMode::Type scalingMode;
125 SamplingMode::Type samplingMode;
126 bool orientationCorrection;
130 // Undefined copy constructor.
131 BitmapResourceType(const BitmapResourceType& typePath);
133 // Undefined assignment operator.
134 BitmapResourceType& operator=(const BitmapResourceType& rhs);
137 } // namespace Integration
141 #endif // __DALI_INTEGRATION_RESOURCE_TYPES_H__