1 #ifndef __DALI_INTERNAL_IMAGE_TICKET_H__
2 #define __DALI_INTERNAL_IMAGE_TICKET_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.
22 #include <dali/internal/event/resources/resource-ticket.h>
23 #include <dali/public-api/images/image.h>
31 class ResourceManager;
33 typedef IntrusivePtr<ImageTicket> ImageTicketPtr;
36 * ImageTicket is essentially the same as a ResourceTicket,
37 * except that it contains additional information about the loaded image resource.
38 * The data is the result of the resource loading request.
40 * Multi-threading note: this class should be used in the main thread only
41 * i.e. not from within Dali::Integration::Core::Render().
43 class ImageTicket : public ResourceTicket
48 * Create an image resource request.
49 * This should only be done by the ResourceTicketRegistry.
50 * @param [in] observer A resource ticket lifetime observer.
51 * @param [in] id A unique ID for this ticket (loading request).
52 * @param [in] typePath The resource Type & Path pair.
54 ImageTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath );
57 * Get the attributes of an image.
58 * Only to be used after the image has finished loading.
59 * (Ticket's LoadingSucceeded callback was called)
60 * Reflects the last cached values after a LoadComplete.
61 * If requested width or height was 0, they are replaced by concrete dimensions.
62 * @return a copy of the image attributes
64 const Dali::ImageAttributes& GetAttributes() const { return mAttributes;}
67 * Get the width of an image.
68 * Only to be used after the image has finished loading.
69 * (Ticket's LoadingSucceeded callback was called)
70 * Reflects the last cached values after a LoadComplete.
71 * If requested width or height was 0, they are replaced by concrete dimensions.
77 * Get the height of an image.
78 * Only to be used after the image has finished loading.
79 * (Ticket's LoadingSucceeded callback was called)
80 * Reflects the last cached values after a LoadComplete.
81 * If requested width or height was 0, they are replaced by concrete dimensions.
84 int GetHeight() const;
89 * A reference counted object may only be deleted by calling Unreference()
91 virtual ~ImageTicket()
97 // Undefined copy constructor.
98 ImageTicket(const ImageTicket& typePath);
100 // Undefined copy constructor.
101 ImageTicket& operator=(const ImageTicket& rhs);
106 * Loaded Image attributes (width, height, pixelformat etc.).
107 * Contains actual values only after the image has finished loading.
108 * If requested width or height was 0, the natural size is used.
110 Dali::ImageAttributes mAttributes;
113 * ResourceClient needs to set dimensions and pixelformat.
114 * Image needs to know about them.
116 friend class ResourceClient;
119 } // namespace Internal
123 #endif // __DALI_INTERNAL_IMAGE_TICKET_H__