1
- /*
1
+ /*
2
2
NSCachedImageRep.h
3
3
4
4
Cached image representation.
7
7
8
8
Written by: Adam Fedor <fedor@colorado.edu>
9
9
Date: Feb 1996
10
-
10
+
11
11
This file is part of the GNUstep GUI Library.
12
12
13
13
This library is free software; you can redistribute it and/or
22
22
23
23
You should have received a copy of the GNU Lesser General Public
24
24
License along with this library; see the file COPYING.LIB.
25
- If not, see <http://www.gnu.org/licenses/> or write to the
26
- Free Software Foundation, 51 Franklin Street, Fifth Floor,
25
+ If not, see <http://www.gnu.org/licenses/> or write to the
26
+ Free Software Foundation, 51 Franklin Street, Fifth Floor,
27
27
Boston, MA 02110-1301, USA.
28
- */
28
+ */
29
29
30
30
#ifndef _GNUstep_H_NSCachedImageRep
31
31
#define _GNUstep_H_NSCachedImageRep
36
36
37
37
@class NSWindow ;
38
38
39
+ /* *
40
+ * NSCachedImageRep is a specialized image representation that stores
41
+ * cached bitmap data for efficient drawing operations. It provides a
42
+ * way to capture and cache the visual content of windows or specific
43
+ * rectangular areas as bitmap images, enabling fast redrawing and
44
+ * composition operations without regenerating complex graphics content.
45
+ *
46
+ * This class is particularly useful for performance optimization in
47
+ * scenarios where the same graphical content needs to be drawn repeatedly,
48
+ * such as during window dragging, animation sequences, or when implementing
49
+ * custom drawing caches. The cached representation can be created from
50
+ * existing window content or initialized as an empty bitmap with specific
51
+ * characteristics.
52
+ *
53
+ * NSCachedImageRep supports various pixel formats and color depths,
54
+ * allowing for optimization based on the specific requirements of the
55
+ * cached content. It can handle both separate and planar pixel formats,
56
+ * with optional alpha channel support for transparency effects.
57
+ */
39
58
APPKIT_EXPORT_CLASS
40
59
@interface NSCachedImageRep : NSImageRep
41
60
{
@@ -45,11 +64,20 @@ APPKIT_EXPORT_CLASS
45
64
}
46
65
47
66
//
48
- // Initializing an NSCachedImageRep
67
+ // Initializing an NSCachedImageRep
49
68
//
50
69
51
70
/* *
52
71
* GNUstep extension
72
+ *
73
+ * Initializes a new cached image representation with the specified
74
+ * dimensions and pixel characteristics. This extended initializer
75
+ * provides additional control over the pixel format by allowing
76
+ * specification of both logical size and actual pixel dimensions,
77
+ * enabling support for high-resolution displays and custom pixel
78
+ * densities. The depth parameter controls color depth and pixel
79
+ * format, while separate and alpha flags determine memory layout
80
+ * and transparency support respectively.
53
81
*/
54
82
- (id ) initWithSize : (NSSize )aSize
55
83
pixelsWide : (NSInteger )pixelsWide
@@ -58,17 +86,48 @@ APPKIT_EXPORT_CLASS
58
86
separate : (BOOL )separate
59
87
alpha : (BOOL )alpha ;
60
88
89
+ /* *
90
+ * Initializes a new cached image representation with the specified
91
+ * size and pixel characteristics. This creates an empty bitmap cache
92
+ * with the given logical size and pixel format properties. The depth
93
+ * parameter determines the color depth and pixel format, while the
94
+ * separate flag controls whether pixels are stored in separate planes
95
+ * or interleaved format. The alpha flag enables transparency support
96
+ * by including an alpha channel in the pixel format.
97
+ */
61
98
- (id )initWithSize : (NSSize )aSize
62
99
depth : (NSWindowDepth )aDepth
63
100
separate : (BOOL )separate
64
101
alpha : (BOOL )alpha ;
102
+ /* *
103
+ * Initializes a cached image representation by capturing the contents
104
+ * of a specific rectangular area within the given window. This method
105
+ * creates a bitmap cache by copying the current visual content of the
106
+ * specified rectangle from the window's backing store. The cached
107
+ * representation can then be used for efficient redrawing operations
108
+ * without requiring regeneration of the original content.
109
+ */
65
110
- (id )initWithWindow : (NSWindow *)aWindow
66
111
rect : (NSRect )aRect ;
67
112
68
113
//
69
- // Getting the Representation
114
+ // Getting the Representation
70
115
//
116
+ /* *
117
+ * Returns the rectangular area that was cached from the original window.
118
+ * This rectangle represents the bounds of the content that was captured
119
+ * when the cached image representation was created using the window-based
120
+ * initializer. The rectangle is specified in the coordinate system of
121
+ * the original window from which the content was cached.
122
+ */
71
123
- (NSRect )rect ;
124
+ /* *
125
+ * Returns the window from which this cached image representation was
126
+ * created. This provides access to the original source window that
127
+ * was used to capture the cached content. Returns nil if the cached
128
+ * image representation was created using size-based initialization
129
+ * rather than window content capture.
130
+ */
72
131
- (NSWindow *)window ;
73
132
74
133
@end
0 commit comments