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>
24 #include <dali/internal/common/image-attributes.h>
32 class ResourceManager;
34 typedef IntrusivePtr<ImageTicket> ImageTicketPtr;
37 * ImageTicket is essentially the same as a ResourceTicket,
38 * except that it contains additional information about the loaded image resource.
39 * The data is the result of the resource loading request.
41 * Multi-threading note: this class should be used in the main thread only
42 * i.e. not from within Dali::Integration::Core::Render().
44 class ImageTicket : public ResourceTicket
49 * Create an image resource request.
50 * This should only be done by the ResourceTicketRegistry.
51 * @param [in] observer A resource ticket lifetime observer.
52 * @param [in] id A unique ID for this ticket (loading request).
53 * @param [in] typePath The resource Type & Path pair.
55 ImageTicket( ResourceTicketLifetimeObserver& observer, unsigned int id, ResourceTypePath& typePath );
58 * Get the attributes of an image.
59 * Only to be used after the image has finished loading.
60 * (Ticket's LoadingSucceeded callback was called)
61 * Reflects the last cached values after a LoadComplete.
62 * If requested width or height was 0, they are replaced by concrete dimensions.
63 * @return a copy of the image attributes
65 const ImageAttributes& GetAttributes() const { return mAttributes;}
68 * Get the width of an image.
69 * Only to be used after the image has finished loading.
70 * (Ticket's LoadingSucceeded callback was called)
71 * Reflects the last cached values after a LoadComplete.
72 * If requested width or height was 0, they are replaced by concrete dimensions.
78 * Get the height of an image.
79 * Only to be used after the image has finished loading.
80 * (Ticket's LoadingSucceeded callback was called)
81 * Reflects the last cached values after a LoadComplete.
82 * If requested width or height was 0, they are replaced by concrete dimensions.
85 int GetHeight() const;
90 * A reference counted object may only be deleted by calling Unreference()
92 virtual ~ImageTicket()
98 // Undefined copy constructor.
99 ImageTicket(const ImageTicket& typePath);
101 // Undefined copy constructor.
102 ImageTicket& operator=(const ImageTicket& rhs);
107 * Loaded Image attributes (width, height, pixelformat etc.).
108 * Contains actual values only after the image has finished loading.
109 * If requested width or height was 0, the natural size is used.
111 ImageAttributes mAttributes;
114 * ResourceClient needs to set dimensions and pixelformat.
115 * Image needs to know about them.
117 friend class ResourceClient;
120 } // namespace Internal
124 #endif // __DALI_INTERNAL_IMAGE_TICKET_H__