1 #ifndef __DALI_INTEGRATION_RESOURCE_TYPES_H__
2 #define __DALI_INTEGRATION_RESOURCE_TYPES_H__
5 * Copyright (c) 2014 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>
31 #include <dali/integration-api/resource-declarations.h>
36 typedef Uint16Pair ImageDimensions;
44 * Extendable set of resource types
52 * The abstract base class for resource types.
58 * @param[in] typeId resource type id
60 ResourceType(ResourceTypeId typeId)
66 virtual ~ResourceType() {}
69 * Create a copy of the resource type with the same attributes.
70 * @return pointer to the new ResourceType.
72 virtual ResourceType* Clone() const = 0;
74 const ResourceTypeId id;
78 // Undefined copy constructor.
79 ResourceType(const ResourceType& typePath);
81 // Undefined assignment operator.
82 ResourceType& operator=(const ResourceType& rhs);
86 * BitmapResourceType describes a bitmap resource, which can be requested
87 * from ResourceLoader::LoadResource() or AllocateBitmapImage.
89 struct BitmapResourceType : public ResourceType
93 * @param[in] size The requested size for the bitmap.
94 * @param[in] scalingMode The method to use to map the source bitmap to the desired
96 * @param[in] samplingMode The filter to use if the bitmap needs to be downsampled
97 * to the requested size.
98 * @param[in] orientationCorrection Whether to use bitmap metadata to rotate or
99 * flip the bitmap, e.g., from portrait to landscape.
101 BitmapResourceType( ImageDimensions size = ImageDimensions( 0, 0 ),
102 FittingMode::Type scalingMode = FittingMode::DEFAULT,
103 SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
104 bool orientationCorrection = true )
105 : ResourceType(ResourceBitmap),
106 size(size), scalingMode(scalingMode), samplingMode(samplingMode), orientationCorrection(orientationCorrection) {}
111 virtual ~BitmapResourceType() {}
114 * @copydoc ResourceType::Clone
116 virtual ResourceType* Clone() const
118 return new BitmapResourceType( size, scalingMode, samplingMode, orientationCorrection );
122 * Attributes are copied from the request.
124 ImageDimensions size;
125 FittingMode::Type scalingMode;
126 SamplingMode::Type samplingMode;
127 bool orientationCorrection;
131 // Undefined copy constructor.
132 BitmapResourceType(const BitmapResourceType& typePath);
134 // Undefined assignment operator.
135 BitmapResourceType& operator=(const BitmapResourceType& rhs);
138 } // namespace Integration
142 #endif // __DALI_INTEGRATION_RESOURCE_TYPES_H__