@@ -39,7 +39,8 @@ A bitmap is convertible to @racket['png-bytes] through the
39
39
'unknown ]
40
40
[bg-color (or/c (is-a?/c color%) #f ) #f ]
41
41
[complain-on-failure? any/c #f ]
42
- [backing-scale (>/c 0.0 ) 1.0 ])
42
+ [backing-scale (>/c 0.0 ) 1.0 ]
43
+ [save-data-from-file? any/c #f ])
43
44
([bits bytes?]
44
45
[width exact-positive-integer?]
45
46
[height exact-positive-integer?]))]{
@@ -78,8 +79,11 @@ When a @racket[bits] byte string is provided: Creates a monochrome
78
79
@racket[height] is larger than 8 times the length of @racket[bits],
79
80
@|MismatchExn|.
80
81
82
+ See @method[bitmap% get-data-from-file] for information on @racket[save-data-from-file?]
83
+
81
84
@history[#:changed "1.1 " @elem{Added the @racket[backing-scale]
82
- optional arguments.}]}
85
+ optional arguments.}
86
+ #:changed "1.17 " @elem{Added @racket[save-data-from-file?]}]}
83
87
84
88
@defmethod[(get-argb-pixels [x exact-nonnegative-integer?]
85
89
[y exact-nonnegative-integer?]
@@ -113,6 +117,26 @@ Returns the bitmap's @tech{backing scale}.
113
117
114
118
@history[#:added "1.1 " ]}
115
119
120
+ @defmethod[(get-data-from-file)
121
+ (or/c (vector/c (or/c 'unknown 'unknown/mask 'unknown/alpha
122
+ 'gif 'gif/mask 'gif/alpha
123
+ 'jpeg 'jpeg/alpha
124
+ 'png 'png/mask 'png/alpha
125
+ 'xbm 'xbm/alpha 'xpm 'xpm/alpha
126
+ 'bmp 'bmp/alpha )
127
+ (or/c (is-a?/c color%) #f )
128
+ (and/c bytes? immutable?)
129
+ #:immutable? #t )
130
+ #f )]{
131
+ If the bitmap data in this bitmap was read from a file
132
+ and the @racket[_save-data-from-file?] was passed with
133
+ a true value when it was read (either in the constructor
134
+ or in @method[bitmap% load-file]), then this method
135
+ returns the contents of the loaded file as bytes. Otherwise,
136
+ it returns @racket[#f ].
137
+
138
+ @history[#:added "1.17 " ]
139
+ }
116
140
117
141
@defmethod[(get-depth)
118
142
exact-nonnegative-integer?]{
@@ -206,7 +230,8 @@ Returns @racket[#f] if the bitmap is monochrome, @racket[#t] otherwise.
206
230
'bmp 'bmp/alpha )
207
231
'unknown ]
208
232
[bg-color (or/c (is-a?/c color%) #f ) #f ]
209
- [complain-on-failure? any/c #f ])
233
+ [complain-on-failure? any/c #f ]
234
+ [#:save-data-from-file? save-data-from-file? any/c #f ])
210
235
boolean?]{
211
236
212
237
Loads a bitmap from a file format that read from @racket[in], unless
@@ -278,7 +303,11 @@ For PNG and BMP loading, if @racket[bg-color] is not @racket[#f], then it is
278
303
are both undefined, a platform-specific default is used.
279
304
280
305
After a bitmap is created, @method[bitmap% load-file] can be used
281
- only if the bitmap's @tech{backing scale} is @racket[1.0 ].}
306
+ only if the bitmap's @tech{backing scale} is @racket[1.0 ].
307
+
308
+ See @method[bitmap% get-data-from-file] for information on @racket[save-data-from-file?]
309
+
310
+ @history[#:changed "1.17 " @elem{Added @racket[save-data-from-file?]}]}
282
311
283
312
284
313
@defmethod[(make-dc)
0 commit comments