1- /*
1+ /*
22 NSCachedImageRep.h
33
44 Cached image representation.
77
88 Written by: Adam Fedor <[email protected] > 99 Date: Feb 1996
10-
10+
1111 This file is part of the GNUstep GUI Library.
1212
1313 This library is free software; you can redistribute it and/or
2222
2323 You should have received a copy of the GNU Lesser General Public
2424 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,
2727 Boston, MA 02110-1301, USA.
28- */
28+ */
2929
3030#ifndef _GNUstep_H_NSCachedImageRep
3131#define _GNUstep_H_NSCachedImageRep
3636
3737@class NSWindow ;
3838
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+ */
3958APPKIT_EXPORT_CLASS
4059@interface NSCachedImageRep : NSImageRep
4160{
@@ -45,11 +64,20 @@ APPKIT_EXPORT_CLASS
4564}
4665
4766//
48- // Initializing an NSCachedImageRep
67+ // Initializing an NSCachedImageRep
4968//
5069
5170/* *
5271 * 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.
5381 */
5482- (id ) initWithSize : (NSSize )aSize
5583 pixelsWide : (NSInteger )pixelsWide
@@ -58,17 +86,48 @@ APPKIT_EXPORT_CLASS
5886 separate : (BOOL )separate
5987 alpha : (BOOL )alpha ;
6088
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+ */
6198- (id )initWithSize : (NSSize )aSize
6299 depth : (NSWindowDepth )aDepth
63100 separate : (BOOL )separate
64101 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+ */
65110- (id )initWithWindow : (NSWindow *)aWindow
66111 rect : (NSRect )aRect ;
67112
68113//
69- // Getting the Representation
114+ // Getting the Representation
70115//
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+ */
71123- (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+ */
72131- (NSWindow *)window ;
73132
74133@end
0 commit comments