@@ -121,6 +121,34 @@ static REBXYF Zero_Pair = {0, 0};
121
121
}
122
122
123
123
124
+ /***********************************************************************
125
+ **
126
+ */ REBYTE * OS_Get_Window_Buffer (REBCMP * ctx )
127
+ /*
128
+ ** Provide pointer to window compositing buffer.
129
+ ** Return NULL if buffer not available of call failed.
130
+ **
131
+ ** NOTE: The buffer may be "locked" during this call on some platforms.
132
+ ** Always call Os_Release_Window_Buffer(ctx) to be sure it is released.
133
+ **
134
+ ***********************************************************************/
135
+ {
136
+ return ctx -> wind_buffer ;
137
+ }
138
+
139
+ /***********************************************************************
140
+ **
141
+ */ void OS_Release_Window_Buffer (REBCMP * ctx )
142
+ /*
143
+ ** Release the window compositing buffer acquired by Os_Get_Window_Buffer().
144
+ **
145
+ ** NOTE: this call can be "no-op" on platforms that don't need locking.
146
+ **
147
+ ***********************************************************************/
148
+ {
149
+ }
150
+
151
+
124
152
/***********************************************************************
125
153
**
126
154
*/ REBOOL OS_Resize_Window_Buffer (REBCMP * ctx , REBGOB * winGob )
@@ -179,7 +207,7 @@ static REBXYF Zero_Pair = {0, 0};
179
207
//make the new buffer actual
180
208
ctx -> back_buffer = new_buffer ;
181
209
ctx -> back_DC = new_DC ;
182
- // ctx->wind_buffer = new_bytes;
210
+ ctx -> wind_buffer = new_bytes ;
183
211
184
212
//set window clip region
185
213
// SetRectRgn(ctx->win_clip, 0, 0, w, h);
@@ -383,6 +411,36 @@ static REBXYF Zero_Pair = {0, 0};
383
411
GOB_HO (gob ) = GOB_LOG_H (gob );
384
412
}
385
413
414
+
415
+ /***********************************************************************
416
+ **
417
+ */ REBSER * OS_Gob_To_Image (REBGOB * gob )
418
+ /*
419
+ ** Render gob into an image.
420
+ **
421
+ ***********************************************************************/
422
+ {
423
+ REBINT w , h ;
424
+ REBSER * img ;
425
+ REBCMP * cmp ;
426
+
427
+ w = GOB_LOG_W_INT (gob );
428
+ h = GOB_LOG_H_INT (gob );
429
+ img = (REBSER * )RL_MAKE_IMAGE (w , h );
430
+
431
+ cmp = OS_Create_Compositor (Gob_Root , gob );
432
+ OS_Compose_Gob (cmp , gob , gob , TRUE);
433
+
434
+ //copy the composed result to image
435
+ memcpy ((REBYTE * )RL_SERIES (img , RXI_SER_DATA ), OS_Get_Window_Buffer (cmp ), w * h * 4 );
436
+
437
+ OS_Release_Window_Buffer (cmp );
438
+ OS_Destroy_Compositor (cmp );
439
+
440
+ return img ;
441
+ }
442
+
443
+
386
444
/***********************************************************************
387
445
**
388
446
*/ void OS_Blit_Window (REBCMP * ctx )
@@ -466,31 +524,3 @@ static REBXYF Zero_Pair = {0, 0};
466
524
}
467
525
468
526
469
- #ifdef UNUSED_OLD_COMPOSITOR_CODE
470
- /***********************************************************************
471
- **
472
- */ REBYTE * rebcmp_get_buffer (REBCMP * ctx )
473
- /*
474
- ** Provide pointer to window compositing buffer.
475
- ** Return NULL if buffer not available of call failed.
476
- **
477
- ** NOTE: The buffer may be "locked" during this call on some platforms.
478
- ** Always call rebcmp_release_buffer() to be sure it is released.
479
- **
480
- ***********************************************************************/
481
- {
482
- return ctx -> wind_buffer ;
483
- }
484
-
485
- /***********************************************************************
486
- **
487
- */ void rebcmp_release_buffer (REBCMP * ctx )
488
- /*
489
- ** Release the window compositing buffer acquired by rebcmp_get_buffer().
490
- **
491
- ** NOTE: this call can be "no-op" on platforms that don't need locking.
492
- **
493
- ***********************************************************************/
494
- {
495
- }
496
- #endif
0 commit comments