rubysdl 1.3.1 → 2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. data/MANIFEST +22 -2
  2. data/NEWS.en +80 -0
  3. data/NEWS.ja +83 -0
  4. data/README.en +2 -1
  5. data/README.ja +2 -2
  6. data/doc-en/Makefile +18 -0
  7. data/doc-en/cdrom.rsd +417 -0
  8. data/doc-en/collision.rsd +174 -0
  9. data/doc-en/event.rsd +1476 -0
  10. data/doc-en/font.rsd +811 -0
  11. data/doc-en/general.rsd +43 -0
  12. data/doc-en/init.rsd +168 -0
  13. data/doc-en/joystick.rsd +401 -0
  14. data/doc-en/mixer.rsd +869 -0
  15. data/doc-en/mpeg.rsd +585 -0
  16. data/doc-en/opengl.rsd +155 -0
  17. data/doc-en/sdlskk.rsd +472 -0
  18. data/doc-en/time.rsd +46 -0
  19. data/doc-en/video.rsd +2806 -0
  20. data/doc-en/wm.rsd +112 -0
  21. data/doc/Makefile +1 -1
  22. data/doc/cdrom.rsd +3 -3
  23. data/doc/event.rsd +178 -179
  24. data/doc/general.rsd +10 -0
  25. data/doc/init.rsd +2 -2
  26. data/doc/joystick.rsd +29 -5
  27. data/doc/mixer.rsd +20 -0
  28. data/doc/rsd.rb +42 -9
  29. data/doc/sdlskk.rsd +7 -7
  30. data/doc/video.rsd +461 -168
  31. data/doc/wm.rsd +2 -2
  32. data/extconf.rb +1 -8
  33. data/lib/rubysdl_aliases.rb +52 -190
  34. data/lib/rubysdl_compatible_ver1.rb +243 -0
  35. data/lib/sdl.rb +58 -92
  36. data/rubysdl.h +59 -68
  37. data/rubysdl_cdrom.c +125 -102
  38. data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
  39. data/rubysdl_event.c +318 -255
  40. data/rubysdl_event_key.c +299 -287
  41. data/rubysdl_image.c +37 -13
  42. data/rubysdl_joystick.c +180 -67
  43. data/rubysdl_kanji.c +61 -75
  44. data/rubysdl_main.c +65 -138
  45. data/rubysdl_mixer.c +339 -214
  46. data/rubysdl_mouse.c +50 -43
  47. data/rubysdl_opengl.c +31 -28
  48. data/rubysdl_pixel.c +17 -28
  49. data/rubysdl_ref.en.html +5658 -0
  50. data/rubysdl_ref.en.rd +6337 -0
  51. data/rubysdl_ref.html +2253 -1964
  52. data/rubysdl_ref.rd +823 -469
  53. data/rubysdl_rwops.c +9 -6
  54. data/rubysdl_sdlskk.c +137 -165
  55. data/rubysdl_sge_video.c +355 -469
  56. data/rubysdl_smpeg.c +189 -190
  57. data/rubysdl_time.c +1 -1
  58. data/rubysdl_ttf.c +147 -215
  59. data/rubysdl_video.c +486 -405
  60. data/rubysdl_wm.c +30 -30
  61. data/sample/aadraw.rb +9 -9
  62. data/sample/alpha.rb +12 -13
  63. data/sample/alphadraw.rb +10 -10
  64. data/sample/bfont.rb +4 -4
  65. data/sample/cdrom.rb +11 -4
  66. data/sample/collision.rb +20 -20
  67. data/sample/cursor.rb +5 -5
  68. data/sample/ellipses.rb +20 -16
  69. data/sample/event2.rb +11 -9
  70. data/sample/font.rb +4 -4
  71. data/sample/fpstimer.rb +3 -3
  72. data/sample/icon.bmp.gz +0 -0
  73. data/sample/icon.png +0 -0
  74. data/sample/joy2.rb +14 -14
  75. data/sample/kanji.rb +7 -7
  76. data/sample/load_from_io.rb +44 -0
  77. data/sample/movesp.rb +13 -12
  78. data/sample/playmod.rb +2 -3
  79. data/sample/plaympeg.rb +8 -8
  80. data/sample/playwave.rb +5 -6
  81. data/sample/sdlskk.rb +11 -11
  82. data/sample/sgetest.rb +14 -12
  83. data/sample/stetris.rb +12 -13
  84. data/sample/testgl.rb +13 -14
  85. data/sample/testsprite.rb +12 -11
  86. data/sample/transformblit.rb +23 -22
  87. metadata +62 -35
  88. data/rubysdl_event2.c +0 -417
data/doc-en/time.rsd ADDED
@@ -0,0 +1,46 @@
1
+ = Time
2
+ TOC
3
+ SDL provides several cross-platform functions for dealing with
4
+ time.
5
+ It provides a way to get the current time
6
+ and a way to wait a little while.
7
+
8
+ ==Methods
9
+ %%%
10
+ NAME get_ticks
11
+ TYPE .
12
+ PURPOSE Get the number of milliseconds since the SDL library initialization
13
+ RVAL UINT
14
+
15
+ PROTO
16
+ get_ticks
17
+ getTicks
18
+
19
+ DESC
20
+ Get the number of milliseconds since @[init] is called
21
+ Note that this value wraps if the program runs
22
+ for more than ~49 days.
23
+
24
+ SEEALSO
25
+ delay
26
+
27
+ %%
28
+ NAME delay
29
+ TYPE .
30
+ PURPOSE Wait a specified number of milliseconds before returning
31
+
32
+ PROTO
33
+ delay(ms)
34
+
35
+ DESC
36
+ Wait a specified number of milliseconds before returning.
37
+ This method will wait ((*at least*)) the specified time,
38
+ but possible longer due to OS scheduling.
39
+
40
+ NOTES
41
+ Count on a delay granularity of ((*at least*)) 10 ms. Some
42
+ platforms have shorter clock ticks but this is the most
43
+ common.
44
+
45
+ Ruby's threads cannot preempt while waiting with this method.
46
+ You can use Kernel#sleep instead.
data/doc-en/video.rsd ADDED
@@ -0,0 +1,2806 @@
1
+ = Video
2
+ * ((<Video Subsystem Outline>))
3
+ * ((<SDL::Screen>))
4
+ * ((<SDL::Surface>))
5
+ * ((<SDL::VideoInfo>))
6
+ * ((<Color, PixelFormat and Pixel value>))
7
+
8
+ * Methods
9
+ TOC
10
+
11
+ == Video Subsystem Outline
12
+ SDL presents a very simple interface to the display framebuffer.
13
+ The framebuffer is represented as an offscreen surface to which
14
+ you can write directly. If you want the screen to show what you
15
+ have written, call the @[update|Screen#update_rect]
16
+ function which will guarantee that
17
+ the desired portion of the screen is updated.
18
+
19
+ Before you call any of the SDL video functions, you must first
20
+ call @[init](SDL::INIT_VIDEO), which initializes the video and
21
+ events in the SDL library.
22
+
23
+ If you use both sound and video in your application, you need to
24
+ call @[init](SDL::INIT_AUDIO | SDL::INIT_VIDEO) before opening
25
+ the sound device, otherwise under Win32 DirectX, you won't be
26
+ able to set full-screen display modes.
27
+
28
+ After you have initialized the library, you can start up the
29
+ video display in a number of ways. The easiest way is to pick a
30
+ common screen resolution and depth and just initialize the
31
+ video, checking for errors. You will probably get what you want,
32
+ but SDL may be emulating your requested mode and converting the
33
+ display on update. The best way is to @[query|Screen.info],
34
+ for the best video
35
+ mode closest to the desired one, and then
36
+ @[convert|Surface#display_format] your images to
37
+ that pixel format.
38
+
39
+ SDL currently supports any bit depth >= 8 bits per pixel. 8 bpp
40
+ formats are considered 8-bit palettized modes, while 12, 15, 16,
41
+ 24, and 32 bits per pixel are considered "packed pixel" modes,
42
+ meaning each pixel contains the RGB color components packed in
43
+ the bits of the pixel.
44
+
45
+ After you have initialized your video mode, you can take the
46
+ surface that was returned, and write to it like any other
47
+ framebuffer, calling the update routine as you go.
48
+
49
+ == SDL::Surface
50
+ Graphical Surface class.
51
+
52
+ This class represent areas of "graphical" memory, memory that
53
+ can be drawn to.
54
+
55
+ METHODS(Surface)
56
+
57
+ == SDL::Screen
58
+ Video framebuffer class.
59
+
60
+ This class is subclass of @[Surface], and contents
61
+ is shown in display.
62
+
63
+ The video framebuffer is returned by
64
+ @[Screen.open] and @[Screen.get].
65
+
66
+ METHODS(Screen)
67
+
68
+ == SDL::VideoInfo
69
+ Video Target information class.
70
+
71
+ The instance of this class is returned by @[Screen.info]. It
72
+ contains information on either the 'best' available mode (if
73
+ called before @[Screen.open]) or the current video mode.
74
+
75
+ This class has following methods.
76
+
77
+ --- SDL::VideoInfo#hw_available
78
+
79
+ Is it possible to create hardware surfaces?
80
+
81
+ --- SDL::VideoInfo#wm_available
82
+
83
+ Is there a window manager available?
84
+
85
+ --- SDL::VideoInfo#blit_hw
86
+
87
+ Are hardware to hardware blits accelerated?
88
+
89
+ --- SDL::VideoInfo#blit_hw_CC
90
+
91
+ Are hardware to hardware colorkey blits accelerated?
92
+
93
+ --- SDL::VideoInfo#blit_hw_A
94
+
95
+ Are hardware to hardware alpha blits accelerated?
96
+
97
+ --- SDL::VideoInfo#blit_sw
98
+
99
+ Are software to hardware blits accelerated?
100
+
101
+ --- SDL::VideoInfo#blit_sw_CC
102
+
103
+ Are software to hardware colorkey blits accelerated?
104
+
105
+ --- SDL::VideoInfo#blit_sw_A
106
+
107
+ Are software to hardware alpha blits accelerated?
108
+
109
+ --- SDL::VideoInfo#blit_fill
110
+
111
+ Are color fills accelerated?
112
+
113
+ --- SDL::VideoInfo#video_mem
114
+
115
+ Total amount of video memory in Kilobytes
116
+
117
+ --- SDL::VideoInfo#bpp
118
+
119
+ bits per pixel of the video device
120
+
121
+ == SDL::PixelFormat
122
+ Surface format information class.
123
+ Please see ((<Color, PixelFormat and Pixel value>)).
124
+
125
+ METHODS(PixelFormat)
126
+
127
+ == Color, PixelFormat and Pixel value
128
+
129
+ === Outline
130
+ In Ruby/SDL, color is described as four elements
131
+ of 8-bit unsigned interger(from 0 to 255), Red, Green,
132
+ Blue and Alpha. In Ruby/SDL, this values are
133
+ packed as unsigned n-bit integer(n=8,16,24,32).
134
+ The rules of this conversion is called PixelFormat
135
+ and converted n-bit integer is called pixel value.
136
+ Each surface has one PixelFormat, and you can use
137
+ @[Surface#format] to get PixelFormat from surface object.
138
+ You can also covert from or to pixel values calling
139
+ @[PixelFormat#map_rgb], @[PixelFormat#map_rgba],
140
+ @[PixelFormat#get_rgb] and @[PixelFormat#get_rgba].
141
+ You can use pixel value or 3 elements array
142
+ or 4 elements array as color parameter.
143
+ Return values are normally pixel values.
144
+
145
+ === Details
146
+ Not documented yet.
147
+
148
+ == Video Methods
149
+ %%%
150
+ NAME get_video_surface
151
+ TYPE .
152
+ PURPOSE returns the current display surface
153
+ RVAL Screen
154
+ OBSOLETE Screen.get
155
+
156
+ PROTO
157
+ get_video_surface
158
+ getVideoSurface
159
+
160
+ %%
161
+ NAME get
162
+ MOD Screen
163
+ TYPE .
164
+ PURPOSE returns the current display surface
165
+ RVAL Screen
166
+
167
+ PROTO
168
+ get
169
+
170
+ DESC
171
+ This method returns the current display surface.
172
+ If SDL is doing format conversion on the display surface, this
173
+ method returns the publicly visible surface, not the real
174
+ video surface.
175
+
176
+ RET
177
+ Returns the instance of @[Screen].
178
+
179
+ EXCEPTION *
180
+
181
+ %%
182
+ NAME video_info
183
+ TYPE .
184
+ PURPOSE returns information about the video hardware
185
+ RVAL VideoInfo
186
+ OBSOLETE Screen.info
187
+
188
+ PROTO
189
+ video_info
190
+ videoInfo
191
+
192
+ %%
193
+ NAME info
194
+ MOD Screen
195
+ TYPE .
196
+ PURPOSE returns information about the video hardware
197
+ RVAL VideoInfo
198
+
199
+ PROTO
200
+ info
201
+
202
+ DESC
203
+ This function returns a @[information|VideoInfo] about
204
+ the video hardware. If this is called before @[Screen.open],
205
+ bpp attribute of the returned object will contain the pixel
206
+ format of the "best" video mode.
207
+
208
+ RET
209
+ Returns the instance of @[VideoInfo].
210
+
211
+ EXCEPTION *
212
+
213
+ SEEALSO
214
+ Screen.open
215
+ VideoInfo
216
+
217
+ %%
218
+ NAME video_driver_name
219
+ TYPE .
220
+ PURPOSE Obtain the name of the video driver
221
+ RVAL String
222
+ OBSOLETE Screen.driver_name
223
+
224
+ PROTO
225
+ video_driver_name
226
+ videoDriverName
227
+
228
+ %%
229
+ NAME driver_name
230
+ MOD Screen
231
+ TYPE .
232
+ PURPOSE Obtain the name of the video driver
233
+ RVAL String
234
+
235
+ PROTO
236
+ driver_name
237
+ driverName
238
+
239
+ DESC
240
+ The driver name is a simple one
241
+ word identifier like "x11" or "windib".
242
+
243
+ RET
244
+ Returns driver name as string.
245
+
246
+ EXCEPTION
247
+ Raises @[Error] if video has not been initialized with
248
+ @[init].
249
+
250
+ SEEALSO
251
+ init
252
+
253
+ %%
254
+ NAME list_modes
255
+ TYPE .
256
+ PURPOSE Returns an array of available screen dimensions for the given format and video flags
257
+ RVAL nil/true/Array of [UINT, UINT]
258
+ OBSOLETE Screen.list_modes
259
+
260
+ PROTO
261
+ list_modes(flags)
262
+ listModes(flags)
263
+
264
+ %%
265
+ NAME list_modes
266
+ MOD Screen
267
+ TYPE .
268
+ PURPOSE Returns an array of available screen dimensions for the given format and video flags
269
+ RVAL nil/true/Array of [UINT, UINT]
270
+
271
+ PROTO
272
+ list_modes(flags)
273
+ listModes(flags)
274
+
275
+ DESC
276
+ Return an array of available screen dimensions for
277
+ the given format and video flags, sorted largest to smallest.
278
+
279
+ Returns nil if there are no dimensions available for a
280
+ particular format, or true if any dimension is okay for the given
281
+ format.
282
+ The flag parameter is an OR'd
283
+ combination of surface flags. The flags are the same as those
284
+ used @[Screen.open] and they play a strong role in deciding
285
+ what modes are valid.
286
+ For instance, if you pass SDL::HWSURFACE as
287
+ a flag only modes that support hardware video surfaces will be
288
+ returned.
289
+
290
+ EXAMPLE
291
+ # Get available fullscreen/hardware modes
292
+ modes = SDL::Screen.list_modes(SDL::FULLSCREEN|SDL::HWSURFACE)
293
+
294
+ # Check is there are any modes available
295
+ if modes == nil
296
+ puts "No modes available!"
297
+ exit 1
298
+ end
299
+
300
+ # Check is there are any modes available
301
+ if modes == true
302
+ puts "All resolutions available."
303
+ else
304
+ # Print valid modes
305
+ puts "Available Modes"
306
+ modes.each{|w, h| puts " #{w} x #{h}"}
307
+ end
308
+
309
+ SEEALSO
310
+ Screen.open
311
+ Screen.info
312
+
313
+ %%
314
+ NAME check_video_mode
315
+ TYPE .
316
+ PURPOSE Check to see if a particular video mode is supported.
317
+ RVAL Integer
318
+ OBSOLETE Screen.check_mode
319
+
320
+ PROTO
321
+ check_video_mode(w,h,bpp,flags)
322
+ checkVideoMode(w,h,bpp,flags)
323
+
324
+ %%
325
+ NAME check_mode
326
+ MOD Screen
327
+ TYPE .
328
+ PURPOSE Check to see if a particular video mode is supported.
329
+ RVAL Integer
330
+
331
+ PROTO
332
+ check_mode(w,h,bpp,flags)
333
+ checkMode(w,h,bpp,flags)
334
+
335
+ DESC
336
+ Returns 0 if the requested mode is not supported
337
+ under any bit depth,
338
+ or returns the bits-per-pixel of the
339
+ closest available mode with the given width, height and
340
+ requested surface flags (see @[Screen.open]).
341
+
342
+ The bits-per-pixel value returned is only a suggested mode. You
343
+ can usually request and bpp you want when
344
+ @[setting|Screen.opn] the video mode
345
+ and SDL will emulate that color depth with a shadow video
346
+ surface.
347
+
348
+
349
+ EXAMPLE
350
+ puts "Checking mode 640x480@16bpp."
351
+ bpp = SDL::Screen.check_mode(640, 480, 16, SDL::HWSURFACE)
352
+ if bpp == 0
353
+ puts "Mode not available."
354
+ exit 1
355
+ end
356
+
357
+ puts "SDL Recomemends 640x480@#{bpp}bpp."
358
+ screen = SDL::Screen.open(640, 480, bpp, SDL_HWSURFACE)
359
+
360
+ SEEALSO
361
+ Screen.open
362
+ Screen.info
363
+
364
+ %%
365
+ NAME set_video_mode
366
+ TYPE .
367
+ PURPOSE Set up a video mode with the specified width, height and bits-per-pixel.
368
+ RVAL Screen
369
+ OBSOLETE Screen.open
370
+
371
+ PROTO
372
+ setVideoMode(w,h,bpp,flags)
373
+ set_video_mode(w,h,bpp,flags)
374
+
375
+ %%
376
+ NAME open
377
+ MOD Screen
378
+ TYPE .
379
+ PURPOSE Set up a video mode with the specified width, height and bits-per-pixel.
380
+ RVAL Screen
381
+
382
+ PROTO
383
+ open(w,h,bpp,flags)
384
+
385
+ DESC
386
+ Set up a video mode with the specified width, height and
387
+ bits-per-pixel.
388
+
389
+ If bpp is 0, it is treated as the current display bits per
390
+ pixel.
391
+
392
+ The flags parameter is the same as the @[Surface#flags]
393
+ OR'd combinations of the following values
394
+ are valid.
395
+
396
+ :SDL::SWSURFACE
397
+ Create the video surface in system memory
398
+ :SDL::HWSURFACE
399
+ Create the video surface in video memory
400
+ :SDL::ASYNCBLIT
401
+ Enables the use of asynchronous updates of the
402
+ display surface. This will usually slow down
403
+ blitting on single CPU machines, but may
404
+ provide a speed increase on SMP systems.
405
+ :SDL::ANYFORMAT
406
+ Normally, if a video surface of the requested
407
+ bits-per-pixel ($[bpp]) is not available, SDL will
408
+ emulate one with a shadow surface. Passing
409
+ SDL_ANYFORMAT prevents this and causes SDL to
410
+ use the video surface, regardless of its pixel
411
+ depth.
412
+ :SDL::HWPALETTE
413
+ Give SDL exclusive palette access. Without this
414
+ flag you may not always get the the colors you
415
+ request with @[Surface#set_colors] or @[Surface#set_palette].
416
+ :SDL::DOUBLEBUF
417
+ Enable hardware double buffering; only valid
418
+ with SDL::HWSURFACE. Calling @[Screen#flip] will flip
419
+ the buffers and update the screen. All drawing
420
+ will take place on the surface that is not
421
+ displayed at the moment. If double buffering
422
+ could not be enabled then @[Screen#flip] will just
423
+ perform a @[Screen#update_rect] on the entire screen.
424
+ :SDL::FULLSCREEN
425
+ SDL will attempt to use a fullscreen mode. If a
426
+ hardware resolution change is not possible (for
427
+ whatever reason), the next higher resolution
428
+ will be used and the display window centered on
429
+ a black background.
430
+ :SDL::OPENGL
431
+ Create an OpenGL rendering context. You should
432
+ have previously set OpenGL video attributes
433
+ with @[GL.set_attr].
434
+ :SDL::OPENGLBLIT
435
+ Create an OpenGL rendering context, like above,
436
+ but allow normal blitting operations. The
437
+ screen (2D) surface may have an alpha channel,
438
+ and @[Screen.update_rect] must be used for updating
439
+ changes to the screen surface. NOTE: This
440
+ option is kept for compatibility only, and is
441
+ ((*not recommended*)) for new code.
442
+
443
+ :SDL::RESIZABLE
444
+ Create a resizable window. When the window is
445
+ resized by the user a @[Event::VideoResize] event is
446
+ generated and @[Screen.open] can be called
447
+ again with the new size.
448
+ :SDL::NOFRAME
449
+ If possible, SDL::NOFRAME causes SDL to create a
450
+ window with no title bar or frame decoration.
451
+ Fullscreen modes automatically have this flag
452
+ set.
453
+
454
+ NOTES
455
+ Whatever flags @[Screen.open] could satisfy are set
456
+ in the $[Surface#flags] of the returned surface.
457
+
458
+ The $[bpp] parameter is the number of bits per pixel, so
459
+ a $[bpp] of 24 uses the packed representation of 3 bytes/pixel.
460
+ For the more common 4 bytes/pixel mode, use a $[bpp] of 32.
461
+ Somewhat oddly, both 15 and 16 will request a 2 bytes/pixel
462
+ mode, but different pixel formats.
463
+
464
+ RET
465
+ Returns the framebuffer surface as instace of @[Screen].
466
+
467
+ EXCEPTION *
468
+ SEEALSO
469
+ Surface#lock
470
+ Surface#set_colors
471
+ Screen#flip
472
+ Screen
473
+
474
+ %%
475
+ NAME update_rect
476
+ MOD Screen
477
+ TYPE #
478
+ PURPOSE Makes sure the given area is updated on the given screen.
479
+
480
+ PROTO
481
+ updateRect(x,y,w,h)
482
+ update_rect(x,y,w,h)
483
+
484
+ DESC
485
+ Makes sure the given area is updated on the given screen. The
486
+ rectangle must be confined within the screen boundaries (no
487
+ clipping is done).
488
+
489
+ If $[x], $[y], $[w] and $[h] are all 0, this method
490
+ update the entire screen.
491
+
492
+ This method should not be called while screen is
493
+ $[locked|Surface#lock].
494
+
495
+ SEEALSO
496
+ Surface#lock
497
+ Screen#update_rects
498
+
499
+ %%
500
+ NAME update_rects
501
+ MOD Screen
502
+ TYPE #
503
+ PURPOSE Makes sure the given list of rectangles is updated on the given screen
504
+
505
+ PROTO
506
+ update_rects(*rects)
507
+ updateRects(*rects)
508
+
509
+ DESC
510
+ Makes sure the given list of rectangles is updated on the given
511
+ screen. Each rectangle parameter should be an array
512
+ of 4 elements as [x, y, w, h].
513
+ The rectangles must all be confined within the screen
514
+ boundaries (no clipping is done).
515
+
516
+ This method should not be called while screen($[self]),
517
+ is @[locked|Surface#lock].
518
+
519
+ SEEALSO
520
+ Surface#lock
521
+ Screen#update_rect
522
+
523
+ %%
524
+ NAME flip
525
+ MOD Screen
526
+ TYPE #
527
+ PURPOSE Swaps screen buffers
528
+
529
+ PROTO
530
+ flip
531
+
532
+ DESC
533
+ On hardware that supports double-buffering, this function sets
534
+ up a flip and returns. The hardware will wait for vertical
535
+ retrace, and then swap video buffers before the next video
536
+ surface blit or lock will return. On hardware that doesn't
537
+ support double-buffering, this is equivalent to calling
538
+ $[self].@[update_rect|Screen#update_rect](0, 0, 0, 0)
539
+
540
+ EXCEPTION *
541
+
542
+ SEEALSO
543
+ set_video_mode
544
+ Screen#update_rect
545
+
546
+ %%
547
+ NAME set_colors
548
+ MOD Surface
549
+ TYPE #
550
+ PURPOSE Sets a portion of the colormap for the given 8-bit surface.
551
+ RVAL true/false
552
+
553
+ PROTO
554
+ set_colors(colors,firstcolor)
555
+ setColors(colors,firstcolor)
556
+
557
+ DESC
558
+ Sets a portion of the colormap for the given 8-bit surface.
559
+
560
+ When $[self] is the surface associated with the current display,
561
+ the display colormap will be updated with the requested colors.
562
+ If SDL::HWPALETTE was set in @[Screen.open] flags,
563
+ this method will always return true, and the palette is
564
+ guaranteed to be set the way you desire, even if the window
565
+ colormap has to be warped or run under emulation.
566
+
567
+ $[colors] is array of colors, one color has three componets,
568
+ R, G, B and each component is 8-bits in size.
569
+
570
+ Palettized (8-bit) screen surfaces with the SDL::HWPALETTE flag
571
+ have two palettes, a logical palette that is used for mapping
572
+ blits to/from the surface and a physical palette (that
573
+ determines how the hardware will map the colors to the display).
574
+ SDL_SetColors modifies both palettes (if present), and is
575
+ equivalent to calling @[Surface#set_palette]
576
+ with the flags set to (SDL::OGPAL | SDL::PHYSPAL).
577
+
578
+ RET
579
+ If $[self] is not a palettized surface, this method does
580
+ nothing, returning false.
581
+ If all of the colors were set as passed to
582
+ this method, it will return true.
583
+ If not all the color entries
584
+ were set exactly as given, it will return false,
585
+ and you should look
586
+ at the surface palette to determine the actual color palette.
587
+
588
+ EXAMPLE
589
+ # Create a display surface with a grayscale palette
590
+
591
+ # Fill colors with color information
592
+ colors = Array.new(256){|i| [i, i, i]}
593
+ # Create display
594
+ screen = SDL::Screen.open(640, 480, 8, SDL::HWPALETTE)
595
+
596
+ # Set palette
597
+ screen.set_colors(colors, 0)
598
+
599
+ SEEALSO
600
+ Surface#set_palette
601
+ Screen.open
602
+
603
+ %%
604
+ NAME set_palette
605
+ MOD Surface
606
+ TYPE #
607
+ PURPOSE Sets the colors in the palette of an 8-bit surface
608
+ RVAL true/false
609
+
610
+ PROTO
611
+ set_palette(flags,colors,firstcolor)
612
+ setPalette(flags,colors,firstcolor)
613
+
614
+ DESC
615
+ Sets a portion of the palette for the given 8-bit surface.
616
+
617
+ Palettized (8-bit) screen surfaces with the SDL::HWPALETTE flag
618
+ have two palettes, a logical palette that is used for mapping
619
+ blits to/from the surface and a physical palette (that
620
+ determines how the hardware will map the colors to the display).
621
+ @[Surface.blit] always uses the logical palette when blitting
622
+ surfaces (if it has to convert between surface pixel formats).
623
+ Because of this, it is often useful to modify only one or the
624
+ other palette to achieve various special color effects (e.g.,
625
+ screen fading, color flashes, screen dimming).
626
+
627
+ This method can modify either the logical or physical palette
628
+ by specifing SDL::LOGPAL or SDL::PHYSPALthe in the $[flags]
629
+ parameter.
630
+
631
+ When $[self] is the surface associated with the current display,
632
+ the display colormap will be updated with the requested colors.
633
+ If SDL::HWPALETTE was set in @[Screen.open] flags,
634
+ this method will always return true, and the palette is
635
+ guaranteed to be set the way you desire, even if the window
636
+ colormap has to be warped or run under emulation.
637
+
638
+ $[colors] is array of colors, one color has three componets,
639
+ R, G, B and each component is 8-bits in size.
640
+
641
+ RET
642
+ If surface is not a palettized surface, this function does
643
+ nothing, returning false.
644
+ If all of the colors were set as passed to
645
+ this method, it will return true.
646
+ If not all the color entries
647
+ were set exactly as given, it will return false,
648
+ and you should look
649
+ at the surface palette to determine the actual color palette.
650
+
651
+ EXAMPLE
652
+ # Create a display surface with a grayscale palette
653
+
654
+ # Fill colors with color information
655
+ colors = Array.new(256){|i| [i, i, i]}
656
+ # Create display
657
+ screen = SDL::Screen.open(640, 480, 8, SDL::HWPALETTE)
658
+
659
+ # Setpalette
660
+ screen.set_palette(SDL::LOGPAL|SDL::PHYSPAL, colors, 0)
661
+
662
+ SEEALSO
663
+ Surface#set_colors
664
+ Screen.open
665
+
666
+ %%
667
+ NAME set_gamma
668
+ TYPE .
669
+ PURPOSE Sets the color gamma function for the display
670
+ OBSOLETE Screen.set_gamma
671
+
672
+ PROTO
673
+ set_gamma(redgamma,greengamma,bluegamma)
674
+ setGamma(redgamma,greengamma,bluegamma)
675
+
676
+ %%
677
+ NAME set_gamma
678
+ MOD Screen
679
+ TYPE .
680
+ PURPOSE Sets the color gamma function for the display
681
+
682
+ PROTO
683
+ set_gamma(redgamma,greengamma,bluegamma)
684
+ setGamma(redgamma,greengamma,bluegamma)
685
+
686
+ DESC
687
+ Sets the "gamma function" for the display of each color
688
+ component. Gamma controls the brightness/contrast of colors
689
+ displayed on the screen. A gamma value of 1.0 is identity (i.e.,
690
+ no adjustment is made).
691
+
692
+ This function adjusts the gamma based on the "gamma function"
693
+ parameter, you can directly specify lookup tables for gamma
694
+ adjustment with @[Screen.set_gamma_ramp].
695
+
696
+
697
+ EXCEPTION *
698
+ NOTES
699
+ Not all display hardware is able to change gamma.
700
+
701
+ SEEALSO
702
+ Screen.get_gamma_ramp
703
+ Screen.set_gamma_ramp
704
+
705
+ %%
706
+ NAME get_gamma_ramp
707
+ TYPE .
708
+ PURPOSE Gets the color gamma lookup tables for the display
709
+ RVAL Array of UINT
710
+ OBSOLETE Screen.get_gamma_ramp
711
+
712
+ PROTO
713
+ get_gamma_ramp
714
+ getGammaRamp
715
+
716
+ %%
717
+ NAME get_gamma_ramp
718
+ MOD Screen
719
+ TYPE .
720
+ PURPOSE Gets the color gamma lookup tables for the display
721
+ RVAL Array of UINT
722
+
723
+ PROTO
724
+ get_gamma_ramp
725
+ getGammaRamp
726
+
727
+ DESC
728
+ Gets the gamma translation lookup tables currently used by the
729
+ display. Each table is an array of 256 16bit unsigned integer
730
+ values.
731
+
732
+ RET
733
+ Returns an array of 3 elements of an array of 256 16bit unsigned integer.
734
+
735
+ NOTES
736
+ Not all display hardware is able to change gamma.
737
+
738
+ EXCEPTION *
739
+
740
+ SEEALSO
741
+ Screen.set_gamma
742
+ Screen.set_gamma_ramp
743
+
744
+ %%
745
+ NAME set_gamma_ramp
746
+ TYPE .
747
+ PURPOSE Sets the color gamma lookup tables for the display
748
+ OBSOLETE Screen.set_gamma_ramp
749
+ PROTO
750
+ set_gamma_ramp(table)
751
+ setGammaRamp(table)
752
+
753
+ %%
754
+ NAME set_gamma_ramp
755
+ MOD Screen
756
+ TYPE .
757
+ PURPOSE Sets the color gamma lookup tables for the display
758
+
759
+ PROTO
760
+ set_gamma_ramp(tables)
761
+ setGammaRamp(tables)
762
+
763
+ DESC
764
+ Sets the gamma lookup tables for the display for each color
765
+ component.
766
+ $[tables] parameter is same as @[Screen.get_gamma_ramp],
767
+ representing a mapping between the input and output for that
768
+ channel. The input is the index into the array, and the output
769
+ is the 16-bit gamma value at that index, scaled to the output
770
+ color precision.
771
+
772
+ This function adjusts the gamma based on lookup tables, you can
773
+ also have the gamma calculated based on a "gamma function"
774
+ parameter with @[Screen.set_gamma].
775
+
776
+ EXCEPTION *
777
+
778
+ SEEALSO
779
+ Screen.set_gamma
780
+ Screen.get_gamma_ramp
781
+
782
+ %%
783
+ NAME map_rgb
784
+ MOD Surface
785
+ TYPE #
786
+ PURPOSE Map a RGB color value to a pixel format.
787
+ RVAL UINT
788
+ OBSOLETE PixelFormat#map_rgb
789
+
790
+ PROTO
791
+ map_rgb(r,g,b)
792
+ mapRGB(r,g,b)
793
+
794
+ %%
795
+ NAME map_rgb
796
+ MOD PixelFormat
797
+ TYPE #
798
+ PURPOSE RGB Map a RGB color value to a pixel format.
799
+ RVAL UINT
800
+
801
+ PROTO
802
+ map_rgb(r,g,b)
803
+ mapRGB(r,g,b)
804
+
805
+ DESC
806
+ Maps the RGB color value to the specified pixel format and
807
+ returns the pixel value as a 32-bit integer.
808
+ $[r], $[g], $[b] should be more than and equal to 0,
809
+ and less than or equal to 255.
810
+
811
+ If the format has a palette (8-bit) the index of the closest
812
+ matching color in the palette will be returned.
813
+
814
+ If the specified pixel format has an alpha component it will be
815
+ returned as all 1 bits (fully opaque).
816
+
817
+ RET
818
+ A pixel value best approximating the given RGB color value for a
819
+ given pixel format. If the pixel format bpp (color depth) is
820
+ less than 32-bpp then the unused upper bits of the return value
821
+ can safely be ignored (e.g., with a 16-bpp format the return
822
+ value can be assigned to a 16-bit unsigned integer,
823
+ and similarly a 8-bit unsigned integer for an 8-bpp format).
824
+
825
+ SEEALSO
826
+ PixelFormat#get_rgb
827
+ PixelFormat#get_rgba
828
+ PixelFormat#map_rgba
829
+ ((<Color, PixelFormat and Pixel value>))
830
+
831
+ %%
832
+ NAME map_rgba
833
+ MOD Surface
834
+ TYPE #
835
+ PURPOSE RGBA Map a RGBA color value to a pixel format.
836
+ RVAL UINT
837
+ OBSOLETE PixelFormat#map_rgba
838
+
839
+ PROTO
840
+ map_rgba(r,g,b,a)
841
+ mapRGBA(r,g,b,a)
842
+
843
+ %%
844
+ NAME map_rgba
845
+ MOD PixelFormat
846
+ TYPE #
847
+ PURPOSE Map a RGBA color value to a pixel format.
848
+ RVAL UINT
849
+
850
+ PROTO
851
+ map_rgba(r,g,b,a)
852
+ mapRGBA(r,g,b,a)
853
+
854
+ DESC
855
+ Maps the RGBA color value to the specified pixel format and
856
+ returns the pixel value as a 32-bit integer.
857
+ $[r], $[g], $[b] should be more than and equal to 0,
858
+ and less than or equal to 255.
859
+
860
+ If the format has a palette (8-bit) the index of the closest
861
+ matching color in the palette will be returned.
862
+
863
+ If the specified pixel format has no alpha component the alpha
864
+ value will be ignored (as it will be in formats with a palette).
865
+
866
+ RET
867
+ A pixel value best approximating the given RGBA color value for a
868
+ given pixel format. If the pixel format bpp (color depth) is
869
+ less than 32-bpp then the unused upper bits of the return value
870
+ can safely be ignored (e.g., with a 16-bpp format the return
871
+ value can be assigned to a 16-bit unsigned integer,
872
+ and similarly a 8-bit unsigned integer for an 8-bpp format).
873
+
874
+ SEEALSO
875
+ PixelFormat#get_rgb
876
+ PixelFormat#get_rgba
877
+ PixelFormat#map_rgb
878
+ ((<Color, PixelFormat and Pixel value>))
879
+
880
+ %%
881
+ NAME get_rgb
882
+ MOD Surface
883
+ TYPE #
884
+ PURPOSE Get RGB values from a pixel in the specified pixel format.
885
+ RVAL [UINT, UINT, UINT]
886
+ OBSOLETE PixelFormat#get_rgb
887
+ PROTO
888
+ get_rgb(pixel)
889
+ getRGB(pixel)
890
+
891
+ %%
892
+ NAME get_rgb
893
+ MOD PixelFormat
894
+ TYPE #
895
+ PURPOSE Get RGB values from a pixel in the specified pixel format.
896
+ RVAL [UINT, UINT, UINT]
897
+
898
+ PROTO
899
+ get_rgb(pixel)
900
+ getRGB(pixel)
901
+
902
+ DESC
903
+ Get RGB component values from a pixel stored in the specified
904
+ pixel format. It returns an array of 3 elements.
905
+
906
+ This function uses the entire 8-bit [0..255] range when
907
+ converting color components from pixel formats with less than
908
+ 8-bits per RGB component (e.g., a completely white pixel in
909
+ 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8,
910
+ 0xfc, 0xf8]).
911
+
912
+ SEEALSO
913
+ PixelFormat#get_rgba
914
+ PixelFormat#map_rgb
915
+ PixelFormat#map_rgba
916
+ ((<Color, PixelFormat and Pixel value>))
917
+
918
+ %%
919
+ NAME get_rgba
920
+ MOD Surface
921
+ TYPE #
922
+ PURPOSE Get RGBA values from a pixel in the specified pixel format.
923
+ RVAL [UINT, UINT, UINT, UINT]
924
+ OBSOLETE PixelFormat#get_rgba
925
+
926
+ PROTO
927
+ get_rgba(pixel)
928
+ getRGBA(pixel)
929
+
930
+ %%
931
+ NAME get_rgba
932
+ MOD PixelFormat
933
+ TYPE #
934
+ PURPOSE Get RGBA values from a pixel in the specified pixel format.
935
+ RVAL [UINT, UINT, UINT, UINT]
936
+
937
+ PROTO
938
+ get_rgba(pixel)
939
+ getRGBA(pixel)
940
+
941
+ DESC
942
+ Get RGBA component values as array of four elements
943
+ from a pixel stored in the specified
944
+ pixel format.
945
+
946
+ This function uses the entire 8-bit [0..255] range when
947
+ converting color components from pixel formats with less than
948
+ 8-bits per RGB component (e.g., a completely white pixel in
949
+ 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8,
950
+ 0xfc, 0xf8]).
951
+
952
+ If the surface has no alpha component, the alpha will be
953
+ returned as 0xff (100% opaque).
954
+
955
+ SEEALSO
956
+ PixelFormat#get_rgba
957
+ PixelFormat#map_rgb
958
+ PixelFormat#map_rgba
959
+ ((<Color, PixelFormat and Pixel value>))
960
+
961
+ %%
962
+ NAME new
963
+ MOD Surface
964
+ TYPE .
965
+ PURPOSE Create an empty @[Surface]
966
+ RVAL Surface
967
+
968
+ PROTO
969
+ new(flags,w,h,depth,Rmask,Gmask,Bmask,Amask)
970
+ new(flags,w,h,format)
971
+
972
+ DESC
973
+ Allocate an empty surface
974
+ (must be called after @[Screen.open])
975
+
976
+ If depth is 8 bits an empty palette is allocated for the
977
+ surface, otherwise a 'packed-pixel' format is created
978
+ using the $[RGBAmask]'s provided (see @[PixelFormat]).
979
+ The $[flags]
980
+ specifies the type of surface that should be created, it is an
981
+ OR'd combination of the following possible values.
982
+
983
+ :SDL::SWSURFACE
984
+ SDL will create the surface in system memory.
985
+ This improves the performance of pixel level
986
+ access, however you may not be able to take
987
+ advantage of some types of hardware blitting.
988
+ :SDL::HWSURFACE
989
+ SDL will attempt to create the surface in
990
+ video memory. This will allow SDL to take
991
+ advantage of Video->Video blits (which are
992
+ often accelerated).
993
+ :SDL::SRCCOLORKEY
994
+ This flag turns on colourkeying for blits from
995
+ this surface. If SDL::HWSURFACE is also
996
+ specified and colourkeyed blits are
997
+ hardware-accelerated, then SDL will attempt to
998
+ place the surface in video memory. Use
999
+ @[Surface#set_color_key] to set or clear this flag
1000
+ after surface creation.
1001
+ :SDL::SRCALPHA
1002
+ This flag turns on alpha-blending for blits
1003
+ from this surface. If SDL::HWSURFACE is also
1004
+ specified and alpha-blending blits are
1005
+ hardware-accelerated, then the surface will be
1006
+ placed in video memory if possible. Use
1007
+ @[Surface#set_alpha] to set or clear this flag after
1008
+ surface creation.
1009
+
1010
+ RET
1011
+ Returns the instance of @[Surface].
1012
+
1013
+ EXCEPTION *
1014
+
1015
+ NOTES
1016
+ Note: If an alpha-channel is specified (that is, if $[Amask] is
1017
+ nonzero), then the SDL::SRCALPHA flag is automatically set.
1018
+ You may remove this flag by calling @[Surface#set_alpha] after
1019
+ surface creation.
1020
+
1021
+ EXAMPLE
1022
+ # Create a 32-bit surface with the bytes of
1023
+ # each pixel in R,G,B,A order,
1024
+ # as expected by OpenGL for textures
1025
+
1026
+ big_endian = ([1].pack("N") == [1].pack("L"))
1027
+
1028
+ if big_endian
1029
+ rmask = 0xff000000
1030
+ gmask = 0x00ff0000
1031
+ bmask = 0x0000ff00
1032
+ amask = 0x000000ff
1033
+ else
1034
+ rmask = 0x000000ff
1035
+ gmask = 0x0000ff00
1036
+ bmask = 0x00ff0000
1037
+ amask = 0xff000000
1038
+ end
1039
+
1040
+ surface = SDL::Surface.new(SDL::SWSURFACE, width, height, 32,
1041
+ rmask, gmask, bmask, amask);
1042
+
1043
+ SEEALSO
1044
+ Surface.new_from
1045
+ Screen.oepn
1046
+ Surface#lock
1047
+ Surface#set_alpha
1048
+ Surface#set_color_key
1049
+
1050
+ %%
1051
+ NAME new_from
1052
+ MOD Surface
1053
+ TYPE .
1054
+ PURPOSE Create an @[Surface] object from pixel data
1055
+ RVAL Surface
1056
+
1057
+ PROTO
1058
+ new_from(pixels,w,h,depth,pitch,Rmask,Gmask,Bmask,Amask)
1059
+
1060
+ DESC
1061
+ Creates an @[Surface] object from the provided pixel data.
1062
+
1063
+ The data stored in $[pixels](String object)
1064
+ is assumed to be of the depth
1065
+ specified in the parameter list.
1066
+ $[pitch] is the length of each scanline in bytes.
1067
+
1068
+ See @[Surface.new] for a more detailed description of the
1069
+ other parameters.
1070
+
1071
+ RET
1072
+ Returns the created surface.
1073
+
1074
+ EXCEPTION *
1075
+
1076
+ SEEALSO
1077
+ Surface.new
1078
+
1079
+ %%
1080
+ NAME lock
1081
+ MOD Surface
1082
+ TYPE #
1083
+ PURPOSE Lock a surface for directly access.
1084
+
1085
+ PROTO
1086
+ lock
1087
+
1088
+ DESC
1089
+ This method sets up a surface for directly accessing the pixels. Between calls to @[Surface#lock]
1090
+ and @[Surface#unlock] you can write to and read from surface directly.
1091
+ Once you are done accessing the surface, you should use @[Surface#unlock] to release it.
1092
+
1093
+ Not all surfaces require locking. If @[Surface#must_lock?] returns false, then you can read and write to
1094
+ the surface at any time, and the pixel format of the surface will not change.
1095
+
1096
+ No operating system or library calls should be made between lock/unlock pairs, as critical system locks
1097
+ may be held during this time.
1098
+
1099
+ It should be noted, that since SDL 1.1.8 surface locks are recursive. This means that you can lock a
1100
+ surface multiple times, but each lock must have a match unlock.
1101
+ surface.lock
1102
+ # Surface is locked
1103
+ # Direct pixel access on surface here
1104
+ surface.lock
1105
+ # More direct pixel access on surface
1106
+ surface.unlock
1107
+ # Surface is still locked
1108
+ # Note: Is versions < 1.1.8, the surface would have been
1109
+ # no longer locked at this stage
1110
+ surface.unlock
1111
+ # Surface is now unlocked
1112
+
1113
+ You shoud lock before colling following methods:
1114
+ * @[Surface#pixels]
1115
+ LOCKLIST
1116
+
1117
+ NOTES
1118
+ If @[Surface#auto_lock?] returns true, you need not call this method
1119
+ because Ruby/SDL automatically locks surface when you call methods that
1120
+ need locking.
1121
+
1122
+ EXCEPTION
1123
+ Raises @[Error], if the surface couldn't be locked.
1124
+
1125
+ SEEALSO
1126
+ Surface#unlock
1127
+ Surface#must_lock?
1128
+ auto_lock?
1129
+ auto_lock_on
1130
+ auto_lock_off
1131
+ auto_lock=
1132
+
1133
+ %%
1134
+ NAME unlock
1135
+ MOD Surface
1136
+ TYPE #
1137
+ PURPOSE Unlocks a previously locked surface.
1138
+
1139
+ PROTO
1140
+ unlock
1141
+
1142
+ DESC
1143
+ Surfaces that were previously locked using @[Surfaces#lock] must be unlocked with @[Surfaces#unlock].
1144
+ Surfaces should be unlocked as soon as possible.
1145
+
1146
+ It should be noted that since 1.1.8, surface locks are recursive.
1147
+
1148
+ SEEALSO
1149
+ Surface#lock
1150
+
1151
+ %%
1152
+ NAME must_lock?
1153
+ MOD Surface
1154
+ TYPE #
1155
+ PURPOSE Get whether the surface require locking or not.
1156
+ RVAL true/false
1157
+
1158
+ PROTO
1159
+ must_lock?
1160
+ mustLock?
1161
+
1162
+ DESC
1163
+ Returns true if $[self] require locking for direct access to the pixels,
1164
+ otherwise returns false.
1165
+
1166
+ SEEALSO
1167
+ Surface#lock
1168
+
1169
+ %%
1170
+ NAME load_bmp
1171
+ MOD Surface
1172
+ TYPE .
1173
+ PURPOSE Load a Windows BMP file into an SDL_Surface.
1174
+ RVAL Surface
1175
+
1176
+ PROTO
1177
+ load_bmp(filename)
1178
+ loadBMP(filename)
1179
+
1180
+ DESC
1181
+ Loads a surface from a named Windows BMP file.
1182
+
1183
+ RET
1184
+ Returns the new @[Surface] object.
1185
+
1186
+ EXCEPTION *
1187
+
1188
+ SEEALSO
1189
+ Surface#save_bmp
1190
+ Surface.load
1191
+
1192
+ %%
1193
+ NAME load_bmp_from_io
1194
+ MOD Surface
1195
+ TYPE .
1196
+ PURPOSE Load a Windows BMP file into an Surface from IO object.
1197
+ RVAL Surface
1198
+
1199
+ PROTO
1200
+ load_bmp_from_io(io)
1201
+ loadBMPFromIO(io)
1202
+
1203
+ DESC
1204
+ Loads a surface from a ruby's IO object.
1205
+ IO object means the ruby object that has following methods:
1206
+ * read
1207
+ * rewind
1208
+ * tell
1209
+
1210
+ For example, instances of IO class, StringIO class and Zlib::GZipReader class
1211
+ are IO object.
1212
+
1213
+ RET
1214
+ Returns the new @[Surface] object.
1215
+
1216
+ EXCEPTION *
1217
+
1218
+ SEEALSO
1219
+ Surface.load_bmp
1220
+ Surface.load_from_io
1221
+
1222
+ %%
1223
+ NAME save_bmp
1224
+ MOD Surface
1225
+ TYPE #
1226
+ PURPOSE Save an SDL_Surface as a Windows BMP file.
1227
+
1228
+ PROTO
1229
+ save_bmp(filename)
1230
+ saveBMP(filename)
1231
+
1232
+ DESC
1233
+ Saves the $[self] surface as a Windows BMP file named $[filename].
1234
+
1235
+ EXCEPTION *
1236
+ SEEALSO
1237
+ Surface.load_bmp
1238
+
1239
+ %%
1240
+ NAME set_color_key
1241
+ MOD Surface
1242
+ TYPE #
1243
+ PURPOSE Sets the color key (transparent pixel) in a blittable surface and RLE acceleration.
1244
+
1245
+ PROTO
1246
+ set_color_key(flag,key)
1247
+ setColorKey(flag,key)
1248
+
1249
+ DESC
1250
+ Sets the color key (transparent pixel) in a blittable $[surface|Surface]
1251
+ and enables or disables RLE blit acceleration.
1252
+ $[key] parameter should be pixel value or color array.
1253
+
1254
+ RLE acceleration can substantially speed up blitting
1255
+ of images with large horizontal runs of transparent
1256
+ pixels (i.e., pixels that match the $[key] value).
1257
+ The key must be of the same pixel format as the surface,
1258
+ if pixel value is used.
1259
+ In that case, @[PixelFormat#map_rgb]
1260
+ is often useful for obtaining an acceptable value.
1261
+
1262
+ If $[flag] is SDL_SRCCOLORKEY then $[key] is the transparent pixel color in the source image of a blit.
1263
+
1264
+ If $[flag] is OR'd with SDL::RLEACCEL then the surface will
1265
+ be draw using RLE acceleration when drawn with
1266
+ @[Surface.blit]. The surface will actually be encoded
1267
+ for RLE acceleration the first time @[Surface.blit]
1268
+ or @[Surface#display_format] is called on the surface.
1269
+
1270
+ If $[flag] is 0, this function clears any current color key.
1271
+
1272
+ EXCEPTION *
1273
+ SEEALSO
1274
+ Surface.blit
1275
+ Surface#display_format
1276
+ Surface#map_rgb
1277
+ Surface#set_alpha
1278
+ Surface#colorkey
1279
+
1280
+ %%
1281
+ NAME set_alpha
1282
+ MOD Surface
1283
+ TYPE #
1284
+ PURPOSE Adjust the alpha properties of a surface
1285
+
1286
+ PROTO
1287
+ set_alpha(flags,alpha)
1288
+ setAlpha(flags,alpha)
1289
+
1290
+ DESC
1291
+ This method is used for setting the per-surface alpha value and/or enabling and disabling alpha
1292
+ blending.
1293
+
1294
+ The surface parameter specifies which surface whose
1295
+ alpha attributes you wish to adjust. $[flags] is used to
1296
+ specify whether alpha blending should be used (SDL::SRCALPHA)
1297
+ and whether the surface should use RLE
1298
+ acceleration for blitting (SDL::RLEACCEL). $[flags]
1299
+ can be an OR'd combination of these two options, one of
1300
+ these options or 0. If SDL::SRCALPHA is not passed as a flag
1301
+ then all alpha information is ignored when
1302
+ blitting the surface. The alpha parameter is the
1303
+ per-surface alpha value; a surface need not have an
1304
+ alpha channel to use per-surface alpha and blitting can still be accelerated with SDL::RLEACCEL.
1305
+
1306
+ Alpha effects surface blitting in the following ways:
1307
+
1308
+ :RGBA->RGB with SDL::SRCALPHA
1309
+ The source is alpha-blended with the destination, using the alpha channel.
1310
+ SDL_SRCCOLORKEY and the per-surface alpha are ignored.
1311
+
1312
+ :RGBA->RGB without SDL::SRCALPHA
1313
+ The RGB data is copied from the source. The source alpha channel and the per-surface
1314
+ alpha value are ignored.
1315
+
1316
+ :RGB->RGBA with SDL::SRCALPHA
1317
+ The source is alpha-blended with the destination using the per-surface alpha value. If
1318
+ SDL::SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. The
1319
+ alpha channel of the copied pixels is set to opaque.
1320
+
1321
+ :RGB->RGBA without SDL::SRCALPHA
1322
+ The RGB data is copied from the source and the alpha value of the copied pixels is set to
1323
+ opaque. If SDL::SRCCOLORKEY is set, only the pixels not matching the colorkey value are
1324
+ copied.
1325
+
1326
+ :RGBA->RGBA with SDL::SRCALPHA
1327
+ The source is alpha-blended with the destination using the source alpha channel. The
1328
+ alpha channel in the destination surface is left untouched. SDL::SRCCOLORKEY is ignored.
1329
+
1330
+ RGBA->RGBA witout SDL::SRCALPHA
1331
+ The RGBA data is copied to the destination surface. If SDL::SRCCOLORKEY is set, only the
1332
+ pixels not matching the colorkey value are copied.
1333
+
1334
+ RGB->RGB with SDL_SRCALPHA
1335
+ The source is alpha-blended with the destination using the per-surface alpha value. If
1336
+ SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
1337
+
1338
+ RGB->RGB witout SDL_SRCALPHA
1339
+ The RGB data is copied from the source. If SDL_SRCCOLORKEY is set, only the pixels not
1340
+ matching the colorkey value are copied.
1341
+
1342
+ NOTES
1343
+ Note: This method and the semantics of SDL alpha blending have changed since version 1.1.4. Up
1344
+ until version 1.1.5, an alpha value of 0 was considered opaque and a value of 255 was considered
1345
+ transparent. This has now been inverted: 0 (SDL::ALPHA_TRANSPARENT) is now considered transparent and
1346
+ 255 (SDL::ALPHA_OPAQUE) is now considered opaque.
1347
+ The per-surface alpha value of 128 is considered a special case and is optimised, so it's much
1348
+ faster than other per-surface values.
1349
+
1350
+ Note that RGBA->RGBA blits (with SDL::SRCALPHA set) keep the alpha of the destination surface.
1351
+ This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would
1352
+ expect from "overlaying" them; the destination alpha will work as a mask.
1353
+
1354
+ Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used
1355
+ if available
1356
+
1357
+ EXCEPTION *
1358
+ SEEALSO
1359
+ Surface#map_rgba
1360
+ Surface#get_rgba
1361
+ Surface#display_format
1362
+ Surface.blit
1363
+ Surface#alpha
1364
+
1365
+ %%
1366
+ NAME set_clip_rect
1367
+ MOD Surface
1368
+ TYPE #
1369
+ PURPOSE Sets the clipping rectangle for a surface.
1370
+
1371
+ PROTO
1372
+ set_clip_rect(x,y,w,h)
1373
+ setClipRect(x,y,w,h)
1374
+
1375
+ DESC
1376
+ Sets the clipping rectangle for a surface.
1377
+ When this surface is the destination of a blit, only the area
1378
+ within the clip rectangle will be drawn into.
1379
+
1380
+ The rectangle pointed to by rect will be clipped to the edges of the surface so that the clip rectangle
1381
+ for a surface can never fall outside the edges of the surface.
1382
+
1383
+ SEEALSO
1384
+ Surface#get_clip_rect
1385
+ Surface.blit
1386
+
1387
+ %%
1388
+ NAME get_clip_rect
1389
+ MOD Surface
1390
+ TYPE #
1391
+ PURPOSE Gets the clipping rectangle for a surface.
1392
+ RVAL [Integer, Integer, UINT, UINT]
1393
+
1394
+ PROTO
1395
+ get_clip_rect
1396
+ getClipRect
1397
+
1398
+ DESC
1399
+ Gets the clipping rectangle for a surface. When this surface is the destination of a blit, only the area
1400
+ within the clip rectangle is drawn into.
1401
+
1402
+ RET
1403
+ Returns 4 element array as [x, y, w, h].
1404
+
1405
+ SEEALSO
1406
+ Surface#set_clip_rect
1407
+ Surface.blit
1408
+
1409
+ %%
1410
+ NAME blit_surface
1411
+ TYPE .
1412
+ PURPOSE Performs a fast blit from the source surface to the destination surface.
1413
+ RVAL 0/-2
1414
+ OBSOLETE Surface.blit
1415
+
1416
+ PROTO
1417
+ blit_surface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
1418
+ blitSurface(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
1419
+
1420
+
1421
+ %%
1422
+ NAME blit
1423
+ MOD Surface
1424
+ TYPE .
1425
+ PURPOSE This performs a fast blit from the source surface to the destination surface.
1426
+ RVAL 0/-2
1427
+
1428
+ PROTO
1429
+ blit(src,srcX,srcY,srcW,srcH,dst,dstX,dstY)
1430
+
1431
+ DESC
1432
+ This performs a fast blit from the source surface to the destination surface.
1433
+
1434
+ $[src] is source surface, $[dst] is destination surface,
1435
+ $[srcX], $[srcY], $[srcW], $[srcH] is source rectangle,
1436
+ and $[dstX], $[dstY] is destination point.
1437
+ If all of $[srcX], $[srcY], $[srcW], $[srcH] is zero, the entire surface is copied.
1438
+
1439
+ The blit function should not be called on a locked surface.
1440
+
1441
+ The results of blitting operations vary greatly depending on whether SDL::SRCAPLHA is set or not. See
1442
+ @[Surface#set_alpha] for an explaination of how this
1443
+ affects your results. Colorkeying and alpha attributes also
1444
+ interact with surface blitting, as the following pseudo-code should hopefully explain.
1445
+
1446
+ if source surface has SDL::SRCALPHA set
1447
+ if source surface has alpha channel (that is, Amask != 0)
1448
+ blit using per-pixel alpha, ignoring any colour key
1449
+ elsif source surface has SDL::SRCCOLORKEY set
1450
+ blit using the colour key AND the per-surface alpha value
1451
+ else
1452
+ blit using the per-surface alpha value
1453
+ end
1454
+ elsif source surface has SDL::SRCCOLORKEY se
1455
+ blit using the colour key
1456
+ else
1457
+ ordinary opaque rectangular blit
1458
+ end
1459
+
1460
+ RET
1461
+ If the blit is successful, it returns 0.
1462
+
1463
+ If either of the surfaces were in video memory,
1464
+ and the blit returns -2, the video memory was lost, so it
1465
+ should be reloaded with artwork and re-blitted.
1466
+
1467
+ This happens under DirectX 5.0 when the system switches away from your fullscreen application. Locking
1468
+ the surface will also fail until you have access to the video memory again.
1469
+
1470
+ %%
1471
+ NAME fill_rect
1472
+ MOD Surface
1473
+ TYPE #
1474
+ PURPOSE This function performs a fast fill of the given rectangle with some color
1475
+
1476
+ PROTO
1477
+ fill_rect(x,y,w,h,color)
1478
+ fillRect(x,y,w,h,color)
1479
+
1480
+ DESC
1481
+ This method performs a fast fill of the given rectangle with $[color].
1482
+
1483
+ Please see ((<Color, PixelFormat and Pixel value>)) to specify $[color].
1484
+ If the color value contains an alpha value then the destination is simply "filled"
1485
+ with that alpha information, no blending takes place.
1486
+
1487
+ If there is a clip rectangle set on the destination (set via @[Surface#set_clip_rect])
1488
+ then this function will clip based on the intersection of the clip rectangle
1489
+ and the dstrect rectangle and the dstrect rectangle
1490
+ will be modified to represent the area actually filled.
1491
+
1492
+ EXCEPTION *
1493
+ SEEALSO
1494
+ Surface#map_rgb
1495
+ Surface#map_rgba
1496
+ Surface.blit
1497
+
1498
+ %%
1499
+ NAME display_format
1500
+ MOD Surface
1501
+ TYPE #
1502
+ PURPOSE Convert a surface to the display format
1503
+ RVAL Surface
1504
+
1505
+ PROTO
1506
+ display_format
1507
+ displayFormat
1508
+
1509
+ DESC
1510
+ This method copies $[self] to a new surface of the pixel format and colors of the video
1511
+ framebuffer, suitable for fast blitting onto the display surface.
1512
+
1513
+ If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the
1514
+ colorkey and alpha value before calling this function.
1515
+
1516
+ If you want an alpha channel, see @[Surface#display_format_alpha].
1517
+
1518
+ RET
1519
+ Returns converted surface object.
1520
+
1521
+ EXCEPTION
1522
+ Raises @[Error] if the conversion fails or runs out of memory.
1523
+
1524
+ SEEALSO
1525
+ Surface#display_format_alpha
1526
+ Surface#set_alpha
1527
+ Surface#set_color_key
1528
+
1529
+ %%
1530
+ NAME display_format_alpha
1531
+ MOD Surface
1532
+ TYPE #
1533
+ PURPOSE Convert a surface to the display format
1534
+ RVAL Surface
1535
+
1536
+ PROTO
1537
+ display_format_alpha
1538
+ displaFormatAlpha
1539
+
1540
+ DESC
1541
+ This method copies $[self] to a new surface of the pixel format and colors of the video
1542
+ framebuffer plus an alpha channel, suitable for fast blitting onto the display surface.
1543
+
1544
+ If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the
1545
+ colorkey and alpha value before calling this function.
1546
+
1547
+ This function can be used to convert a colourkey to an alpha channel, if the SDL::SRCCOLORKEY flag is set
1548
+ on the surface. The generated surface will then be transparent (alpha=0) where the pixels match the
1549
+ colourkey, and opaque (alpha=255) elsewhere.
1550
+
1551
+ RET
1552
+ Returns converted surface object.
1553
+
1554
+ EXCEPTION
1555
+ Raises @[Error] if the conversion fails or runs out of memory.
1556
+
1557
+ SEEALSO
1558
+ Surface#display_format
1559
+ Surface#set_alpha
1560
+ Surface#set_color_key
1561
+
1562
+ %%
1563
+ NAME flags
1564
+ MOD Surface
1565
+ TYPE #
1566
+ PURPOSE Get surface flags
1567
+ RVAL UINT
1568
+
1569
+ PROTO
1570
+ flags
1571
+
1572
+ DESC
1573
+ Returns the surface flags.
1574
+ The following are supported:
1575
+
1576
+ :SDL::SWSURFACE
1577
+ Surface is stored in system memory
1578
+ :SDL::HWSURFACE
1579
+ Surface is stored in video memory
1580
+ :SDL::ASYNCBLIT
1581
+ Surface uses asynchronous blits if possible
1582
+ :SDL::ANYFORMAT
1583
+ Allows any pixel-format (Display surface)
1584
+ :SDL::HWPALETTE
1585
+ Surface has exclusive palette
1586
+ :SDL::DOUBLEBUF
1587
+ Surface is double buffered (Display surface)
1588
+ :SDL::FULLSCREEN
1589
+ Surface is full screen (Display Surface)
1590
+ :SDL::OPENGL
1591
+ Surface has an OpenGL context (Display Surface)
1592
+ :SDL::OPENGLBLIT
1593
+ Surface supports OpenGL blitting (Display Surface)
1594
+ :SDL::RESIZABLE
1595
+ Surface is resizable (Display Surface)
1596
+ :SDL::HWACCEL
1597
+ Surface blit uses hardware acceleration
1598
+ :SDL::SRCCOLORKEY
1599
+ Surface use colorkey blitting
1600
+ :SDL::RLEACCEL
1601
+ Colorkey blitting is accelerated with RLE
1602
+ :SDL::SRCALPHA
1603
+ Surface blit uses alpha blending
1604
+
1605
+ RET
1606
+ Returns OR'd compination of above constants.
1607
+
1608
+ SEEALSO
1609
+ Surface
1610
+ Screen
1611
+
1612
+ %%
1613
+ NAME format
1614
+ MOD Surface
1615
+ TYPE #
1616
+ PURPOSE Get surface pixel format
1617
+ RVAL PixelFormat
1618
+
1619
+ PROTO
1620
+ format
1621
+
1622
+ DESC
1623
+ Returns @[PixelFormat] object.
1624
+
1625
+ %%
1626
+ NAME w
1627
+ MOD Surface
1628
+ TYPE #
1629
+ PURPOSE Get surface width
1630
+ RVAL UINT
1631
+
1632
+ PROTO
1633
+ w
1634
+
1635
+ DESC
1636
+ Returns width of the surface.
1637
+
1638
+ SEEALSO
1639
+ Surface#h
1640
+
1641
+ %%
1642
+ NAME h
1643
+ MOD Surface
1644
+ TYPE #
1645
+ PURPOSE Get surface height
1646
+ RVAL UINT
1647
+
1648
+ PROTO
1649
+ h
1650
+
1651
+ DESC
1652
+ Returns height of the surface
1653
+
1654
+ SEEALSO
1655
+ Surface#w
1656
+
1657
+ %%
1658
+ NAME pixels
1659
+ MOD Surface
1660
+ TYPE #
1661
+ PURPOSE Get the actual pixel data
1662
+ RVAL String
1663
+
1664
+ PROTO
1665
+ pixels
1666
+
1667
+ DESC
1668
+ Returns pixel data as String object.
1669
+ Examine @[Surface#flags], @[Surface#pitch] and @[Surface#format]
1670
+ to analyze pixel data.
1671
+
1672
+ NOTES
1673
+ You must @[lock|Surface#lock] surface before calling this method.
1674
+
1675
+ SEEALSO
1676
+ Surface#flags
1677
+ Surface#pitch
1678
+ Surface#format
1679
+
1680
+ %%
1681
+ NAME Rmask
1682
+ MOD PixelFormat
1683
+ TYPE #
1684
+ PURPOSE Get binary mask used to retrieve red color value
1685
+ RVAL UINT
1686
+
1687
+ PROTO
1688
+ Rmask
1689
+
1690
+ DESC
1691
+ Returns binary mask allowing us to isolate red component.
1692
+
1693
+ %%
1694
+ NAME Gmask
1695
+ MOD PixelFormat
1696
+ TYPE #
1697
+ PURPOSE Get binary mask used to retrieve green color value
1698
+ RVAL UINT
1699
+
1700
+ PROTO
1701
+ Gmask
1702
+
1703
+ DESC
1704
+ Returns binary mask allowing us to isolate green component.
1705
+
1706
+ %%
1707
+ NAME Bmask
1708
+ MOD PixelFormat
1709
+ TYPE #
1710
+ PURPOSE Get binary mask used to retrieve blue color value
1711
+ RVAL UINT
1712
+
1713
+ PROTO
1714
+ Bmask
1715
+
1716
+ DESC
1717
+ Returns binary mask allowing us to isolate blue component.
1718
+
1719
+ %%
1720
+ NAME Amask
1721
+ MOD PixelFormat
1722
+ TYPE #
1723
+ PURPOSE Get binary mask used to retrieve alpla value
1724
+ RVAL UINT
1725
+
1726
+ PROTO
1727
+ Amask
1728
+
1729
+ DESC
1730
+ Returns binary mask allowing us to isolate alpha component.
1731
+
1732
+ %%
1733
+ NAME Rloss
1734
+ MOD PixelFormat
1735
+ TYPE #
1736
+ PURPOSE Precision loss of red component
1737
+ RVAL UINT
1738
+
1739
+ PROTO
1740
+ Rloss
1741
+
1742
+ DESC
1743
+ Returns the number of bits lost from red component when packing 8-bit color component in a pixel.
1744
+
1745
+ %%
1746
+ NAME Gloss
1747
+ MOD PixelFormat
1748
+ TYPE #
1749
+ PURPOSE Precision loss of green component
1750
+ RVAL UINT
1751
+
1752
+ PROTO
1753
+ Gloss
1754
+
1755
+ DESC
1756
+ Returns the number of bits lost from green component when packing 8-bit color component in a pixel.
1757
+
1758
+ %%
1759
+ NAME Bloss
1760
+ MOD PixelFormat
1761
+ TYPE #
1762
+ PURPOSE Precision loss of blue component
1763
+ RVAL UINT
1764
+
1765
+ PROTO
1766
+ Bloss
1767
+
1768
+ DESC
1769
+ Returns the number of bits lost from blue component when packing 8-bit color component in a pixel.
1770
+
1771
+ %%
1772
+ NAME Aloss
1773
+ MOD PixelFormat
1774
+ TYPE #
1775
+ PURPOSE Precision loss of alpha component
1776
+ RVAL UINT
1777
+
1778
+ PROTO
1779
+ Aloss
1780
+
1781
+ DESC
1782
+ Returns the number of bits lost from alpha component when packing 8-bit color component in a pixel.
1783
+
1784
+ %%
1785
+ NAME Rshift
1786
+ MOD PixelFormat
1787
+ TYPE #
1788
+ PURPOSE Binary left shift of red component in the pixel value
1789
+ RVAL UINT
1790
+
1791
+ PROTO
1792
+ Rshift
1793
+
1794
+ DESC
1795
+ Returns the number of bits to the right of red component in the pixel value.
1796
+
1797
+ %%
1798
+ NAME Gshift
1799
+ MOD PixelFormat
1800
+ TYPE #
1801
+ PURPOSE Binary left shift of green component in the pixel value
1802
+ RVAL UINT
1803
+
1804
+ PROTO
1805
+ Gshift
1806
+
1807
+ DESC
1808
+ Returns the number of bits to the right of green component in the pixel value.
1809
+
1810
+ %%
1811
+ NAME Bshift
1812
+ MOD PixelFormat
1813
+ TYPE #
1814
+ PURPOSE Binary left shift of blue component in the pixel value
1815
+ RVAL UINT
1816
+
1817
+ PROTO
1818
+ Bshift
1819
+
1820
+ DESC
1821
+ Returns the number of bits to the right of blue component in the pixel value
1822
+
1823
+ %%
1824
+ NAME Ashift
1825
+ MOD PixelFormat
1826
+ TYPE #
1827
+ PURPOSE Binary left shift of alpha component in the pixel value
1828
+ RVAL UINT
1829
+
1830
+ PROTO
1831
+ Ashift
1832
+
1833
+ DESC
1834
+ Returns the number of bits to the right of alpha component in the pixel value.
1835
+
1836
+ %%
1837
+ NAME colorkey
1838
+ MOD Surface
1839
+ TYPE #
1840
+ PURPOSE Pixel value of transparent pixels
1841
+ RVAL UINT
1842
+
1843
+ PROTO
1844
+ colorkey
1845
+
1846
+ DESC
1847
+ Returns pixel value of transparent pixels.
1848
+
1849
+
1850
+ SEEALSO
1851
+ Surface
1852
+ Surface#set_color_key
1853
+ ((<Color, PixelFormat and Pixel value>))
1854
+
1855
+ %%
1856
+ NAME alpha
1857
+ MOD Surface
1858
+ TYPE #
1859
+ PURPOSE Overall surface alpha value
1860
+ RVAL UINT
1861
+
1862
+ PROTO
1863
+ alpha
1864
+
1865
+ DESC
1866
+ Returns surface alpha value from 0(transparent) to 255(opaque).
1867
+
1868
+ SEEALSO
1869
+ Surface#set_alpha
1870
+
1871
+ %%
1872
+ NAME colorkey
1873
+ MOD PixelFormat
1874
+ TYPE #
1875
+ PURPOSE Pixel value of transparent pixels.
1876
+ RVAL UINT
1877
+
1878
+ PROTO
1879
+ colorkey
1880
+
1881
+ DESC
1882
+ Returns pixel value of transparent pixels.
1883
+
1884
+ SEEALSO
1885
+ Surface
1886
+ Surface#set_color_key
1887
+ ((<Color, PixelFormat and Pixel value>))
1888
+
1889
+ %%
1890
+ NAME alpha
1891
+ MOD PixelFormat
1892
+ TYPE #
1893
+ PURPOSE Overall surface alpha value
1894
+ RVAL UINT
1895
+
1896
+ PROTO
1897
+ alpha
1898
+
1899
+ DESC
1900
+ Returns surface alpha value from 0(transparent) to 255(opaque).
1901
+
1902
+ SEEALSO
1903
+ Surface#set_alpha
1904
+
1905
+
1906
+ %%
1907
+ NAME bpp
1908
+ MOD Surface
1909
+ TYPE #
1910
+ PURPOSE The number of bits used to represent each pixel in a surface
1911
+ RVAL UINT
1912
+ OBSOLETE PixelFormat#bpp
1913
+
1914
+ PROTO
1915
+ bpp
1916
+
1917
+ %%
1918
+ NAME bpp
1919
+ MOD PixelFormat
1920
+ TYPE #
1921
+ PURPOSE The number of bits used to represent each pixel in a surface
1922
+ RVAL UINT
1923
+
1924
+ PROTO
1925
+ bpp
1926
+
1927
+ DESC
1928
+ Returns the number of bits used to represent each pixel in a surface.
1929
+ Usually 8, 16, 24 or 32.
1930
+
1931
+ %%
1932
+ NAME load
1933
+ MOD Surface
1934
+ TYPE .
1935
+ DEP SDL_image
1936
+ PURPOSE Load image into an surface
1937
+ RVAL Surface
1938
+
1939
+ PROTO
1940
+ load(filename)
1941
+
1942
+ DESC
1943
+ Load image into an surface and returns @[surface|Surface] object.
1944
+ If image format supports transparent color, colorkey is set into new surfafe.
1945
+
1946
+ Supoorted formats are
1947
+ BMP, PNM (PPM/PGM/PBM), XPM,
1948
+ XCF, PCX, GIF, JPEG, TIFF, TGA, PNG and LBM.
1949
+
1950
+ EXCEPTION *
1951
+
1952
+ %%
1953
+ NAME load_from_io
1954
+ MOD Surface
1955
+ TYPE .
1956
+ PURPOSE Load a image file into an Surface from IO object.
1957
+ RVAL Surface
1958
+
1959
+ PROTO
1960
+ load_from_io(io)
1961
+ loadFromIO(io)
1962
+
1963
+ DESC
1964
+ Loads a surface from a ruby's IO object.
1965
+ IO object means the ruby object that has following methods:
1966
+ * read
1967
+ * rewind
1968
+ * tell
1969
+
1970
+ If image format supports transparent color, colorkey is set into new surfafe.
1971
+ Supoorted formats are
1972
+ BMP, PNM (PPM/PGM/PBM), XPM,
1973
+ XCF, PCX, GIF, JPEG, TIFF, TGA, PNG and LBM.
1974
+
1975
+ EXCEPTION *
1976
+
1977
+ SEEALSO
1978
+ Surface.load
1979
+ Surface.load_bmp_from_io
1980
+
1981
+ %%
1982
+ NAME put_pixel
1983
+ MOD Surface
1984
+ TYPE #
1985
+ LOCK
1986
+ PURPOSE Writes a pixel to the specified position
1987
+
1988
+ PROTO
1989
+ put_pixel(x, y, color)
1990
+ putPixel(x, y, color)
1991
+ []=(x, y, color)
1992
+
1993
+ DESC
1994
+ Writes $[color] pixel at ($[x], $[y]).
1995
+
1996
+ SEEALSO
1997
+ Surface#get_pixel
1998
+ ((<Color, PixelFormat and Pixel value>))
1999
+
2000
+ %%
2001
+ NAME get_pixel
2002
+ MOD Surface
2003
+ TYPE #
2004
+ LOCK
2005
+ PURPOSE Gets the color of the specified pixel.
2006
+ RVAL UINT
2007
+
2008
+ PROTO
2009
+ get_pixel(x, y)
2010
+ getPixel(x, y)
2011
+ [](x, y)
2012
+
2013
+ DESC
2014
+ Returns pixel value at ($[x], $[y]).
2015
+
2016
+ SEEALSO
2017
+ Surface#put_pixel
2018
+ ((<Color, PixelFormat and Pixel value>))
2019
+
2020
+ %%
2021
+ NAME put
2022
+ MOD Surface
2023
+ TYPE #
2024
+ PURPOSE Performs a fast blit from entire surface.
2025
+
2026
+ PROTO
2027
+ put(src, x, y)
2028
+
2029
+ DESC
2030
+ Performs a fast blit from entire $[src] surface to $[self] at ($[x], $[y]).
2031
+
2032
+ This means:
2033
+ SDL::Surface.blit(src, 0, 0, src.w, src.h, self, x, y)
2034
+
2035
+
2036
+ SEEALSO
2037
+ Surface.blit
2038
+
2039
+ %%
2040
+ NAME copy_rect
2041
+ MOD Surface
2042
+ TYPE #
2043
+ PURPOSE Copies a part of surface.
2044
+
2045
+ PROTO
2046
+ copy_rect(x,y,w,h)
2047
+ copyRect(x,y,w,h)
2048
+
2049
+ DESC
2050
+ Copies a ($[x], $[y], $[w], $[h]) rectangle from $[self] and return new $[surface|Surface] object.
2051
+
2052
+ NOTES
2053
+ This method call @[Surface.blit] internally, therefore you must unlock surface before calling it.
2054
+
2055
+ EXCEPTION *
2056
+
2057
+ %%
2058
+ NAME auto_lock?
2059
+ TYPE .
2060
+ DEP SGE
2061
+ PURPOSE Get whether surface is automatically locked
2062
+ RVAL true/false
2063
+ OBSOLETE Surface.auto_lock?
2064
+
2065
+ PROTO
2066
+ auto_lock?
2067
+ autoLock?
2068
+ auto_lock
2069
+ autoLock
2070
+
2071
+ %%
2072
+ NAME auto_lock?
2073
+ MOD Surface
2074
+ TYPE .
2075
+ DEP SGE
2076
+ PURPOSE Get whether surface is automatically locked
2077
+ RVAL true/false
2078
+
2079
+ PROTO
2080
+ auto_lock?
2081
+ autoLock?
2082
+
2083
+ DESC
2084
+ Returns true if surface is automatically @[locked|Surface#lock]
2085
+ when necessary, otherwise returns false.
2086
+
2087
+ Default is ON(true).
2088
+
2089
+ SEEALSO
2090
+ Surface#lock
2091
+ Surface#unlock
2092
+ Surface.auto_lock_on
2093
+ Surface.auto_lock_off
2094
+
2095
+ %%
2096
+ NAME auto_lock_on
2097
+ TYPE .
2098
+ DEP SGE
2099
+ PURPOSE Switch on auto locking
2100
+ OBSOLETE Surface.auto_lock_on
2101
+
2102
+ PROTO
2103
+ auto_lock_on
2104
+ autoLockON
2105
+
2106
+ %%
2107
+ NAME auto_lock_on
2108
+ MOD Surface
2109
+ TYPE .
2110
+ DEP SGE
2111
+ PURPOSE Switch on auto locking
2112
+
2113
+ PROTO
2114
+ auto_lock_on
2115
+ autoLockON
2116
+
2117
+ DESC
2118
+ Enables auto surface locking.
2119
+
2120
+ SEEALSO
2121
+ Surface#lock
2122
+ Surface.auto_lock?
2123
+ Surface.auto_lock_off
2124
+
2125
+ %%
2126
+ NAME auto_lock_off
2127
+ TYPE .
2128
+ DEP SGE
2129
+ PURPOSE Switch off auto locking
2130
+ OBSOLETE Surface.auto_lock_off
2131
+
2132
+ PROTO
2133
+ auto_lock_off
2134
+ autoLockOFF
2135
+
2136
+ %%
2137
+ NAME auto_lock_off
2138
+ MOD Surface
2139
+ TYPE .
2140
+ DEP SGE
2141
+ PURPOSE Switch off auto locking.
2142
+
2143
+ PROTO
2144
+ auto_lock_off
2145
+ autoLockOFF
2146
+
2147
+ DESC
2148
+ Disables auto surface locking.
2149
+
2150
+ SEEALSO
2151
+ Surface#lock
2152
+ Surface.auto_lock?
2153
+ Surface.auto_lock_on
2154
+
2155
+ %%
2156
+ NAME auto_lock=
2157
+ TYPE .
2158
+ DEP SGE
2159
+ PURPOSE Set auto locking
2160
+ OBSOLETE Surface.auto_lock_on
2161
+
2162
+ PROTO
2163
+ auto_lock=(locking)
2164
+ autoLock=(locking)
2165
+
2166
+ DESC
2167
+ Enables or disables auto surface locking.
2168
+ 'SDL.auto_lock = true' is same as @[Surface.auto_lock_on]
2169
+ and 'SDL.auto_lock = false' is same as
2170
+ @[Surface.auto_lock_off].
2171
+
2172
+ SEEALSO
2173
+ Surface#lock
2174
+ auto_lock?
2175
+ auto_lock_on
2176
+ auto_lock_off
2177
+
2178
+ %%
2179
+ NAME transform
2180
+ TYPE .
2181
+ DEP SGE
2182
+ PURPOSE Draw a rotated and scaled image.
2183
+ OBSOLETE Surface.transform_draw
2184
+
2185
+ PROTO
2186
+ transform(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2187
+
2188
+ %%
2189
+ NAME transform_draw
2190
+ MOD Surface
2191
+ TYPE .
2192
+ DEP SGE
2193
+ PURPOSE Draw a rotated and scaled image.
2194
+
2195
+ PROTO
2196
+ transform_draw(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2197
+
2198
+ DESC
2199
+ Draws a rotated and scaled version of $[src] on $[dest].
2200
+ $[angle] the rotation angle in degrees,
2201
+ $[xscale] and $[yscale] are x and y scaling factor,
2202
+ ($[px], $[py]) is the pivot point to rotate around in the $[src],
2203
+ and ($[qx], $[qy]) is the destination point on $[dst] surface.
2204
+
2205
+ $[flags] is OR'd combination of follwing values:
2206
+
2207
+ :0
2208
+ Default
2209
+ :SDL::TRANSFORM_SAFE
2210
+ Don't asume that the $[src] and $[dst] surfaces has
2211
+ the same pixel format. This is the default when the two
2212
+ surfaces don't have the same BPP. This is slower but will
2213
+ render wierd pixel formats right.
2214
+ :SDL::TRANSFORM_AA
2215
+ Use the interpolating renderer. Much slower but
2216
+ can look better.
2217
+ :SDL::TRANSFORM_TMAP
2218
+ Use texture mapping. This is a bit faster but
2219
+ the result isn't as nice as in the normal mode. This mode
2220
+ will also ignore the px/py coordinates and the other flags.
2221
+
2222
+ NOTES
2223
+ To get optimal performance PLEASE make sure that the two
2224
+ surfaces has the same pixel format (color depth) and doesn't use
2225
+ 24-bpp.
2226
+
2227
+ You can set source and destination clipping rectangles with
2228
+ @[Surface#set_clip_rect].
2229
+
2230
+ If you use the interpolated renderer the image will be
2231
+ clipped 1 pixel in hight and width (to optimize the
2232
+ performance).
2233
+
2234
+ If you want to transform a 32-bpp RGBA (alpha) surface with
2235
+ the interpolated renderer, please use the
2236
+ SDL::TRANSFORM_SAFE flag.
2237
+
2238
+ This function will not do any alpha blending, but it will
2239
+ try to preserve the alpha channel. If you want to rotate and
2240
+ alpha blend the result, please use @[Surface.transform_blit]
2241
+ and then blit that surface to its destination.
2242
+
2243
+ SEEALSO
2244
+ Surface.transform_blit
2245
+ Surface#transform_surface
2246
+ Surface.new
2247
+
2248
+ %%
2249
+ NAME transform_blit
2250
+ TYPE .
2251
+ DEP SGE
2252
+ PURPOSE Draw a rotated and scaled image with colorkey and blending
2253
+ OBSOLETE Surface.transform_blit
2254
+
2255
+ PROTO
2256
+ transform_blit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2257
+ transformBlit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2258
+
2259
+ %%
2260
+ NAME transform_blit
2261
+ MOD Surface
2262
+ TYPE .
2263
+ DEP SGE
2264
+ PURPOSE Draw a rotated and scaled image with colorkey and blending
2265
+
2266
+ PROTO
2267
+ transform_blit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2268
+ transformBlit(src,dst,angle,xscale,yscale,px,py,qx,qy,flags)
2269
+
2270
+ DESC
2271
+ Draw a rotated and scaled image.
2272
+ This method is same as @[Surface.transform] except
2273
+ colorkey and blending are enabled.
2274
+
2275
+ SEEALSO
2276
+ Surface.transform
2277
+ Surface#transform_surface
2278
+ Surface#set_color_key
2279
+ Surface#set_alpha
2280
+
2281
+ %%
2282
+ NAME draw_line
2283
+ MOD Surface
2284
+ TYPE #
2285
+ DEP SGE
2286
+ LOCK
2287
+ PURPOSE Draw a line
2288
+
2289
+ PROTO
2290
+ draw_line(x1,x2,y1,y2,color, aa=false, alpha=nil)
2291
+ drawLine(x1,x2,y1,y2,color, aa=false, alpha=nil)
2292
+
2293
+ DESC
2294
+ Draws a $[color] line from ($[x1], $[y1]) to ($[x2], $[y2]).
2295
+ If $[aa] is true, draws an antialiased line.
2296
+ If $[alpha] is integer, draws blended line with alpha value
2297
+ is $[alpha].
2298
+ If $[alpha] is nil, draws a normal line.
2299
+
2300
+ SEEALSO
2301
+ Surface#draw_rect
2302
+
2303
+ %%
2304
+ NAME draw_aa_line
2305
+ MOD Surface
2306
+ TYPE #
2307
+ DEP SGE
2308
+ LOCK
2309
+ PURPOSE Draw an antialiased line
2310
+
2311
+ PROTO
2312
+ draw_aa_line(x1,x2,y1,y2,color)
2313
+ drawAALine(x1,x2,y1,y2,color)
2314
+
2315
+ OBSOLETE Surface#draw_line
2316
+ DESC
2317
+ Draws a $[color] antialiased line from ($[x1], $[y1]) to ($[x2], $[y2]).
2318
+
2319
+ SEEALSO
2320
+ Surface#draw_line
2321
+
2322
+ %%
2323
+ NAME draw_line_alpha
2324
+ MOD Surface
2325
+ TYPE #
2326
+ DEP SGE
2327
+ LOCK
2328
+ PURPOSE Draw a blended line
2329
+ OBSOLETE Surface#draw_line
2330
+
2331
+ PROTO
2332
+ draw_line_alpha(x1,x2,y1,y2,color,alpha)
2333
+ drawLineAlpha(x1,x2,y1,y2,color,alpha)
2334
+
2335
+ DESC
2336
+ Draws a $[color] line from ($[x1], $[y1]) to ($[x2], $[y2])
2337
+ with blending.
2338
+
2339
+ SEEALSO
2340
+ Surface#draw_line
2341
+
2342
+ %%
2343
+ NAME draw_aa_line_alpha
2344
+ MOD Surface
2345
+ TYPE #
2346
+ DEP SGE
2347
+ LOCK
2348
+ PURPOSE Draw an antialiased line with blending.
2349
+ OBSOLETE Surface#draw_line
2350
+
2351
+ PROTO
2352
+ draw_aa_line_alpha(x1,x2,y1,y2,color,alpha)
2353
+ drawAALineAlpha(x1,x2,y1,y2,color,alpha)
2354
+
2355
+ DESC
2356
+ Draws a antialiased $[color] line from
2357
+ ($[x1], $[y1]) to ($[x2], $[y2]) with blending.
2358
+
2359
+
2360
+ SEEALSO
2361
+ Surface#draw_line
2362
+
2363
+ %%
2364
+ NAME draw_rect
2365
+ MOD Surface
2366
+ TYPE #
2367
+ DEP SGE
2368
+ LOCK
2369
+ PURPOSE Draws a rect
2370
+
2371
+ PROTO
2372
+ draw_rect(x,y,w,h,color, fill=false, alpha=nil)
2373
+ drawRect(x,y,w,h,color, fill=false, alpha=nil)
2374
+
2375
+ DESC
2376
+ Draws a rectangle with color $[color].
2377
+ Draw a filled rectangle if $[fill] is true,
2378
+ and a blended rectangle if $[alpha] is integer.
2379
+
2380
+ SEEALSO
2381
+ Surface#fill_rect
2382
+
2383
+ %%
2384
+ NAME draw_rect_alpha
2385
+ MOD Surface
2386
+ TYPE #
2387
+ DEP SGE
2388
+ LOCK
2389
+ PURPOSE Draws a rectangle with blending
2390
+ OBSOLETE Surface#draw_rect
2391
+
2392
+ PROTO
2393
+ draw_rect_alpha(x,y,w,h,color,alpha)
2394
+ drawRectAlpha(x,y,w,h,color,alpha)
2395
+
2396
+ DESC
2397
+ Draws a blended rectangle.
2398
+
2399
+ SEEALSO
2400
+ Surface#fill_rect
2401
+ Surface#draw_rect
2402
+
2403
+ %%
2404
+ NAME draw_filled_rect_alpha
2405
+ MOD Surface
2406
+ TYPE #
2407
+ DEP SGE
2408
+ LOCK
2409
+ PURPOSE Draws a filled blended rectangle.
2410
+ OBSOLETE Surface#draw_rect
2411
+
2412
+ PROTO
2413
+ draw_filled_rect_alpha(x,y,w,h,color,alpha)
2414
+ drawFilledRectAlpha(x,y,w,h,color,alpha)
2415
+
2416
+ DESC
2417
+ Draws a filled blended rectangle.
2418
+
2419
+ SEEALSO
2420
+ Surface#fill_rect
2421
+ Surface#draw_rect
2422
+
2423
+ %%
2424
+ NAME draw_circle
2425
+ MOD Surface
2426
+ TYPE #
2427
+ DEP SGE
2428
+ LOCK
2429
+ PURPOSE Draws a circle
2430
+
2431
+ PROTO
2432
+ draw_circle(x,y,r,color,fill=false,aa=false,alpha=0)
2433
+ drawCircle(x,y,r,color,fill=false,aa=false,alpha=0)
2434
+
2435
+ DESC
2436
+ Draws a circle. ($[x],$[y]) is center,
2437
+ $[r] is radius and $[color] is drawing color.
2438
+ If $[fill] is true, draws a filled circle.
2439
+ If $[aa] is true, draws an antialiased circle.
2440
+ If $[alpha] is integer, draws a blended circle.
2441
+
2442
+ NOTES
2443
+ You cannot draw a filled antialiased blended circle.
2444
+
2445
+ SEEALSO
2446
+ Surface#draw_ellipse
2447
+
2448
+ %%
2449
+ NAME draw_filled_circle
2450
+ MOD Surface
2451
+ TYPE #
2452
+ DEP SGE
2453
+ LOCK
2454
+ PURPOSE Draws a filled circle.
2455
+ OBSOLETE draw_circle
2456
+
2457
+ PROTO
2458
+ draw_filled_circle(x,y,r,color)
2459
+ drawFilledCircle(x,y,r,color)
2460
+
2461
+ DESC
2462
+ Draws a filled circle.
2463
+
2464
+ SEEALSO
2465
+ Surface#draw_circle
2466
+
2467
+ %%
2468
+ NAME draw_aa_circle
2469
+ MOD Surface
2470
+ TYPE #
2471
+ DEP SGE
2472
+ LOCK
2473
+ PURPOSE Draws an antialiased circle.
2474
+ OBSOLETE draw_circle
2475
+
2476
+ PROTO
2477
+ draw_aa_circle(x,y,r,color)
2478
+ drawAACircle(x,y,r,color)
2479
+
2480
+ DESC
2481
+ Draws an antialiased circle.
2482
+
2483
+ SEEALSO
2484
+ Surface#draw_circle
2485
+
2486
+ %%
2487
+ NAME draw_aa_filled_circle
2488
+ MOD Surface
2489
+ TYPE #
2490
+ DEP SGE
2491
+ LOCK
2492
+ PURPOSE Draws a filled antialiased circle
2493
+ OBSOLETE draw_circle
2494
+
2495
+ PROTO
2496
+ draw_aa_filled_circle(x,y,r,color)
2497
+ drawAAFilledCircle(x,y,r,color)
2498
+
2499
+ DESC
2500
+ Draws a filled antialiased circle.
2501
+
2502
+ SEEALSO
2503
+ Surface#draw_circle
2504
+
2505
+ %%
2506
+ NAME draw_circle_alpha
2507
+ MOD Surface
2508
+ TYPE #
2509
+ DEP SGE
2510
+ LOCK
2511
+ PURPOSE Draws blended circle
2512
+ OBSOLETE draw_circle
2513
+
2514
+ PROTO
2515
+ draw_circle_alpha(x,y,r,color,alpha)
2516
+ drawCircleAlpha(x,y,r,color,alpha)
2517
+
2518
+ DESC
2519
+ Draws blended circle.
2520
+
2521
+ SEEALSO
2522
+ Surface#draw_circle
2523
+
2524
+ %%
2525
+ NAME draw_filled_circle_alpha
2526
+ MOD Surface
2527
+ TYPE #
2528
+ DEP SGE
2529
+ LOCK
2530
+ PURPOSE Draws a filled blended circle
2531
+ OBSOLETE draw_circle
2532
+
2533
+ PROTO
2534
+ draw_filled_circle_alpha(x,y,r,color,alpha)
2535
+ drawFilledCircleAlpha(x,y,r,color,alpha)
2536
+
2537
+ DESC
2538
+ Draws a filled blended circle.
2539
+
2540
+ SEEALSO
2541
+ Surface#draw_circle
2542
+
2543
+ %%
2544
+ NAME draw_aa_circle_alpha
2545
+ MOD Surface
2546
+ TYPE #
2547
+ DEP SGE
2548
+ LOCK
2549
+ PURPOSE Draws an antialiased blended circle
2550
+ OBSOLETE draw_circle
2551
+
2552
+ PROTO
2553
+ draw_aa_circle_alpha(x,y,r,color,alpha)
2554
+ drawAACircleAlpha(x,y,r,color,alpha)
2555
+
2556
+ DESC
2557
+ Draws an antialiased blended circle
2558
+
2559
+ SEEALSO
2560
+ Surface#draw_circle
2561
+
2562
+ %%
2563
+ NAME draw_ellipse
2564
+ MOD Surface
2565
+ TYPE #
2566
+ DEP SGE
2567
+ LOCK
2568
+ PURPOSE Draws an ellipse.
2569
+
2570
+ PROTO
2571
+ draw_ellipse(x,y,rx,ry,color, fill=false, aa=false, alpha=nil)
2572
+ drawEllipse(x,y,rx,ry,color, fill=false, aa=false, alpha=nil) )
2573
+
2574
+ DESC
2575
+
2576
+ Draws an ellipse. ($[x],$[y]) is center,
2577
+ $[rx] is x-radius, $[ry] is y-radius
2578
+ and $[color] is drawing color.
2579
+ If $[fill] is true, draws a filled ellipse.
2580
+ If $[aa] is true, draws an antialiased ellipse.
2581
+ If $[alpha] is integer, draws a blended ellipse.
2582
+
2583
+ NOTES
2584
+ You cannot draw a filled antialiased blended ellipse.
2585
+
2586
+ SEEALSO
2587
+ Surface#draw_circle
2588
+
2589
+ %%
2590
+ NAME draw_filled_ellipse
2591
+ MOD Surface
2592
+ TYPE #
2593
+ DEP SGE
2594
+ LOCK
2595
+ PURPOSE Draws a filled ellipse
2596
+ OBSOLETE Surface#draw_ellipse
2597
+
2598
+ PROTO
2599
+ draw_filled_ellipse(x,y,rx,ry,color)
2600
+ drawFilledEllipse(x,y,rx,ry,color)
2601
+
2602
+ DESC
2603
+ Draws a filled ellipse.
2604
+
2605
+ SEEALSO
2606
+ Surface#draw_ellipse
2607
+
2608
+ %%
2609
+ NAME draw_aa_ellipse
2610
+ MOD Surface
2611
+ TYPE #
2612
+ DEP SGE
2613
+ LOCK
2614
+ PURPOSE Draws an antialiased ellipse
2615
+ OBSOLETE Surface#draw_ellipse
2616
+
2617
+ PROTO
2618
+ draw_aa_ellipse(x,y,rx,ry,color)
2619
+ drawAAEllipse(x,y,rx,ry,color)
2620
+
2621
+ DESC
2622
+ Draws an antialiased ellipse.
2623
+
2624
+ SEEALSO
2625
+ Surface#draw_ellipse
2626
+
2627
+ %%
2628
+ NAME draw_aa_filled_ellipse
2629
+ MOD Surface
2630
+ TYPE #
2631
+ DEP SGE
2632
+ LOCK
2633
+ PURPOSE Draws a filled antialiased ellipse
2634
+ OBSOLETE Surface#draw_ellipse
2635
+
2636
+ PROTO
2637
+ draw_aa_filled_ellipse(x,y,rx,ry,color)
2638
+ drawAAFilledEllipse(x,y,rx,ry,color)
2639
+
2640
+ DESC
2641
+ Draws a filled antialiased ellipse.
2642
+
2643
+ SEEALSO
2644
+ Surface#draw_ellipse
2645
+
2646
+ %%
2647
+ NAME draw_ellipse_alpha
2648
+ MOD Surface
2649
+ TYPE #
2650
+ DEP SGE
2651
+ LOCK
2652
+ PURPOSE Draws a blended ellipse
2653
+ OBSOLETE Surface#draw_ellipse
2654
+
2655
+ PROTO
2656
+ draw_ellipse_alpha(x,y,rx,ry,color,alpha)
2657
+ drawEllipseAlpha(x,y,rx,ry,color,alpha)
2658
+
2659
+ DESC
2660
+ Draws a blended ellipse.
2661
+
2662
+ SEEALSO
2663
+ Surface#draw_ellipse
2664
+
2665
+ %%
2666
+ NAME draw_filled_ellipse_alpha
2667
+ MOD Surface
2668
+ TYPE #
2669
+ DEP SGE
2670
+ LOCK
2671
+ PURPOSE Draws a filled blended ellipse
2672
+ OBSOLETE Surface#draw_ellipse
2673
+
2674
+ PROTO
2675
+ draw_filled_ellipse_alpha(x,y,rx,ry,color,alpha)
2676
+ drawFilledEllipseAlpha(x,y,rx,ry,color,alpha)
2677
+
2678
+ DESC
2679
+ Draws a filled blended ellipse
2680
+
2681
+ SEEALSO
2682
+ Surface#draw_ellipse
2683
+
2684
+ %%
2685
+ NAME draw_aa_ellipse_alpha
2686
+ MOD Surface
2687
+ TYPE #
2688
+ DEP SGE
2689
+ LOCK
2690
+ PURPOSE Draws an antialiased blended ellipse
2691
+ OBSOLETE Surface#draw_ellipse
2692
+
2693
+ PROTO
2694
+ draw_aa_ellipse_alpha(x,y,rx,ry,color,alpha)
2695
+ drawAAEllipseAlpha(x,y,rx,ry,color,alpha)
2696
+
2697
+ DESC
2698
+ Draws an antialiased blended ellipse.
2699
+
2700
+ SEEALSO
2701
+ Surface#draw_ellipse
2702
+
2703
+ %%
2704
+ NAME draw_bezier
2705
+ MOD Surface
2706
+ TYPE #
2707
+ DEP SGE
2708
+ LOCK
2709
+ PURPOSE Draws a bezier curve
2710
+
2711
+ PROTO
2712
+ draw_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color,aa=false,alpha=nil)
2713
+ drawBezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color,aa=false,alpha=nil)
2714
+
2715
+ DESC
2716
+ Draws a bezier curve from ($[x1], $[y1]) to ($[x4], $[y4])
2717
+ with the control points ($[x2], $[y2]) and ($[x3], $[y3]).
2718
+ $[level] indicates how
2719
+ good precision the function should use, 4-7 is normal.
2720
+ If $[aa] is true, draws an antialiased curve.
2721
+ If $[alpha] is integer, draws blended curve.
2722
+
2723
+ %%
2724
+ NAME draw_aa_bezier
2725
+ MOD Surface
2726
+ TYPE #
2727
+ DEP SGE
2728
+ LOCK
2729
+ PURPOSE Draws an antialiased bezier curve.
2730
+ OBSOLETE Surface#draw_bezier
2731
+
2732
+ PROTO
2733
+ draw_aa_bezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
2734
+ drawAABezier(x1,y1,x2,y2,x3,y3,x4,y4,level,color)
2735
+
2736
+ DESC
2737
+ Draws an antialiased bezier curve.
2738
+
2739
+ SEEALSO
2740
+ Surface#draw_bezier
2741
+
2742
+ %%
2743
+ NAME draw_bezier_alpha
2744
+ MOD Surface
2745
+ TYPE #
2746
+ DEP SGE
2747
+ LOCK
2748
+ PURPOSE Draws a blended bezier curve.
2749
+ OBSOLETE Surface#draw_bezier
2750
+
2751
+ PROTO
2752
+ draw_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
2753
+ drawBezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
2754
+
2755
+ DESC
2756
+ Draws a blended bezier curve.
2757
+
2758
+ SEEALSO
2759
+ Surface#draw_bezier
2760
+
2761
+ %%
2762
+ NAME draw_aa_bezier_alpha
2763
+ MOD Surface
2764
+ TYPE #
2765
+ DEP SGE
2766
+ LOCK
2767
+ PURPOSE Draws an antialiased blended bezier curve
2768
+ OBSOLETE Surface#draw_bezier
2769
+
2770
+ PROTO
2771
+ draw_aa_bezier_alpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
2772
+ drawAABezierAlpha(x1,y1,x2,y2,x3,y3,x4,y4,level,color,alpha)
2773
+
2774
+ DESC
2775
+ Draws an antialiased blended bezier curve.
2776
+
2777
+ SEEALSO
2778
+ Surface#draw_bezier
2779
+
2780
+ %%
2781
+ NAME transform_surface
2782
+ MOD Surface
2783
+ TYPE #
2784
+ DEP SGE
2785
+ LOCK
2786
+ PURPOSE Creates an rotated an scaled surface
2787
+ RVAL Surface
2788
+
2789
+ PROTO
2790
+ transform_surface(bgcolor,angle,xscale,yscale,flags)
2791
+ transformSurface(bgcolor,angle,xscale,yscale,flags)
2792
+
2793
+ DESC
2794
+ Returns a rotated and scaled version of $[self].
2795
+ See $[Surface.transform] for more information.
2796
+ $[bgcolor] is background color that new surface have.
2797
+
2798
+ The new surface object will have the same depth
2799
+ and pixel format as $[self].
2800
+
2801
+ EXCEPTION *
2802
+
2803
+ SEEALSO
2804
+ Surface.transform
2805
+ Surface.transform_blit
2806
+