Debian Codegraph @

gdk/quartz/gdkgc-quartz.c

raw
1 /* gdkgc-quartz.c
2 *
3 * Copyright (C) 2005 Imendio AB
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21 #include "config.h"
22
23 #include "gdkgc.h"
24 #include "gdkprivate-quartz.h"
25
26 static gpointer parent_class = NULL;
27
28 static void
29 gdk_quartz_gc_get_values (GdkGC *gc,
30 GdkGCValues *values)
31 {
32 GdkGCQuartz *private;
33
34 private = GDK_GC_QUARTZ (gc);
35
36 values->foreground.pixel = _gdk_gc_get_fg_pixel (gc);
37 values->background.pixel = _gdk_gc_get_bg_pixel (gc);
38
39 values->font = private->font;
40
41 values->function = private->function;
42
43 values->fill = _gdk_gc_get_fill (gc);
44 values->tile = _gdk_gc_get_tile (gc);
45 values->stipple = _gdk_gc_get_stipple (gc);
46
47 /* The X11 backend always returns a NULL clip_mask. */
48 values->clip_mask = NULL;
49
50 values->ts_x_origin = gc->ts_x_origin;
51 values->ts_y_origin = gc->ts_y_origin;
52 values->clip_x_origin = gc->clip_x_origin;
53 values->clip_y_origin = gc->clip_y_origin;
54
55 values->graphics_exposures = private->graphics_exposures;
56
57 values->line_width = private->line_width;
58 values->line_style = private->line_style;
59 values->cap_style = private->cap_style;
60 values->join_style = private->join_style;
61 }
62
63
64 static void
65 data_provider_release (void *info, const void *data, size_t size)
66 {
67 g_free (info);
68 }
69
70 static CGImageRef
71 create_clip_mask (GdkPixmap *source_pixmap)
72 {
73 int width, height, bytes_per_row, bits_per_pixel;
74 void *data;
75 CGImageRef source;
76 CGImageRef clip_mask;
77 CGContextRef cg_context;
78 CGDataProviderRef data_provider;
79
80 /* We need to flip the clip mask here, because this cannot be done during
81 * the drawing process when this mask will be used to do clipping. We
82 * quickly create a new CGImage, set up a CGContext, draw the source
83 * image while flipping, and done. If this appears too slow in the
84 * future, we would look into doing this by hand on the actual raw
85 * data.
86 */
87 source = _gdk_pixmap_get_cgimage (source_pixmap);
88
89 width = CGImageGetWidth (source);
90 height = CGImageGetHeight (source);
91 bytes_per_row = CGImageGetBytesPerRow (source);
92 bits_per_pixel = CGImageGetBitsPerPixel (source);
93
94 data = g_malloc (height * bytes_per_row);
95 data_provider = CGDataProviderCreateWithData (data, data,
96 height * bytes_per_row,
97 data_provider_release);
98
99 clip_mask = CGImageCreate (width, height, 8,
100 bits_per_pixel,
101 bytes_per_row,
102 CGImageGetColorSpace (source),
103 CGImageGetAlphaInfo (source),
104 data_provider, NULL, FALSE,
105 kCGRenderingIntentDefault);
106 CGDataProviderRelease (data_provider);
107
108 cg_context = CGBitmapContextCreate (data,
109 width, height,
110 CGImageGetBitsPerComponent (source),
111 bytes_per_row,
112 CGImageGetColorSpace (source),
113 CGImageGetBitmapInfo (source));
114
115 if (cg_context)
116 {
117 CGContextTranslateCTM (cg_context, 0, height);
118 CGContextScaleCTM (cg_context, 1.0, -1.0);
119
120 CGContextDrawImage (cg_context,
121 CGRectMake (0, 0, width, height), source);
122
123 CGContextRelease (cg_context);
124 }
125
126 return clip_mask;
127 }
128
129 static void
130 gdk_quartz_gc_set_values (GdkGC *gc,
131 GdkGCValues *values,
132 GdkGCValuesMask mask)
133 {
134 GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
135
136 if (mask & GDK_GC_FONT)
137 {
138 /* FIXME: implement font */
139 }
140
141 if (mask & GDK_GC_FUNCTION)
142 private->function = values->function;
143
144 if (mask & GDK_GC_SUBWINDOW)
145 private->subwindow_mode = values->subwindow_mode;
146
147 if (mask & GDK_GC_EXPOSURES)
148 private->graphics_exposures = values->graphics_exposures;
149
150 if (mask & GDK_GC_CLIP_MASK)
151 {
152 private->have_clip_region = FALSE;
153 private->have_clip_mask = values->clip_mask != NULL;
154 if (private->clip_mask)
155 CGImageRelease (private->clip_mask);
156
157 if (values->clip_mask)
158 private->clip_mask = create_clip_mask (values->clip_mask);
159 else
160 private->clip_mask = NULL;
161 }
162
163 if (mask & GDK_GC_LINE_WIDTH)
164 private->line_width = values->line_width;
165
166 if (mask & GDK_GC_LINE_STYLE)
167 private->line_style = values->line_style;
168
169 if (mask & GDK_GC_CAP_STYLE)
170 private->cap_style = values->cap_style;
171
172 if (mask & GDK_GC_JOIN_STYLE)
173 private->join_style = values->join_style;
174 }
175
176 static void
177 gdk_quartz_gc_set_dashes (GdkGC *gc,
178 gint dash_offset,
179 gint8 dash_list[],
180 gint n)
181 {
182 GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
183 gint i;
184
185 private->dash_count = n;
186 g_free (private->dash_lengths);
187 private->dash_lengths = g_new (CGFloat, n);
188 for (i = 0; i < n; i++)
189 private->dash_lengths[i] = (CGFloat) dash_list[i];
190 private->dash_phase = (CGFloat) dash_offset;
191 }
192
193 static void
194 gdk_gc_quartz_finalize (GObject *object)
195 {
196 GdkGCQuartz *private = GDK_GC_QUARTZ (object);
197
198 if (private->clip_mask)
199 CGImageRelease (private->clip_mask);
200
201 if (private->ts_pattern)
202 CGPatternRelease (private->ts_pattern);
203
204 G_OBJECT_CLASS (parent_class)->finalize (object);
205 }
206
207 static void
208 gdk_gc_quartz_class_init (GdkGCQuartzClass *klass)
209 {
210 GObjectClass *object_class = G_OBJECT_CLASS (klass);
211 GdkGCClass *gc_class = GDK_GC_CLASS (klass);
212
213 parent_class = g_type_class_peek_parent (klass);
214
215 object_class->finalize = gdk_gc_quartz_finalize;
216
217 gc_class->get_values = gdk_quartz_gc_get_values;
218 gc_class->set_values = gdk_quartz_gc_set_values;
219 gc_class->set_dashes = gdk_quartz_gc_set_dashes;
220 }
221
222 static void
223 gdk_gc_quartz_init (GdkGCQuartz *gc_quartz)
224 {
225 gc_quartz->function = GDK_COPY;
226 gc_quartz->subwindow_mode = GDK_CLIP_BY_CHILDREN;
227 gc_quartz->graphics_exposures = TRUE;
228 gc_quartz->line_width = 0;
229 gc_quartz->line_style = GDK_LINE_SOLID;
230 gc_quartz->cap_style = GDK_CAP_BUTT;
231 gc_quartz->join_style = GDK_JOIN_MITER;
232 }
233
234 GType
235 _gdk_gc_quartz_get_type (void)
236 {
237 static GType object_type = 0;
238
239 if (!object_type)
240 {
241 const GTypeInfo object_info =
242 {
243 sizeof (GdkGCQuartzClass),
244 (GBaseInitFunc) NULL,
245 (GBaseFinalizeFunc) NULL,
246 (GClassInitFunc) gdk_gc_quartz_class_init,
247 NULL, /* class_finalize */
248 NULL, /* class_data */
249 sizeof (GdkGCQuartz),
250 0, /* n_preallocs */
251 (GInstanceInitFunc) gdk_gc_quartz_init,
252 };
253
254 object_type = g_type_register_static (GDK_TYPE_GC,
255 "GdkGCQuartz",
256 &object_info, 0);
257 }
258
259 return object_type;
260 }
261
262 GdkGC *
263 _gdk_quartz_gc_new (GdkDrawable *drawable,
264 GdkGCValues *values,
265 GdkGCValuesMask values_mask)
266 {
267 GdkGC *gc;
268
269 gc = g_object_new (GDK_TYPE_GC_QUARTZ, NULL);
270
271 _gdk_gc_init (gc, drawable, values, values_mask);
272
273 gdk_quartz_gc_set_values (gc, values, values_mask);
274
275 return gc;
276 }
277
278 void
279 _gdk_windowing_gc_set_clip_region (GdkGC *gc,
280 const GdkRegion *region,
281 gboolean reset_origin)
282 {
283 GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
284
285 if ((private->have_clip_region && ! region) || private->have_clip_mask)
286 {
287 if (private->clip_mask)
288 {
289 CGImageRelease (private->clip_mask);
290 private->clip_mask = NULL;
291 }
292 private->have_clip_mask = FALSE;
293 }
294
295 private->have_clip_region = region != NULL;
296
297 if (reset_origin)
298 {
299 gc->clip_x_origin = 0;
300 gc->clip_y_origin = 0;
301 }
302 }
303
304 void
305 _gdk_windowing_gc_copy (GdkGC *dst_gc,
306 GdkGC *src_gc)
307 {
308 GdkGCQuartz *dst_quartz_gc = GDK_GC_QUARTZ (dst_gc);
309 GdkGCQuartz *src_quartz_gc = GDK_GC_QUARTZ (src_gc);
310
311 if (dst_quartz_gc->font)
312 gdk_font_unref (dst_quartz_gc->font);
313 dst_quartz_gc->font = src_quartz_gc->font;
314 if (dst_quartz_gc->font)
315 gdk_font_ref (dst_quartz_gc->font);
316
317 dst_quartz_gc->function = src_quartz_gc->function;
318 dst_quartz_gc->subwindow_mode = src_quartz_gc->subwindow_mode;
319 dst_quartz_gc->graphics_exposures = src_quartz_gc->graphics_exposures;
320
321 dst_quartz_gc->have_clip_region = src_quartz_gc->have_clip_region;
322 dst_quartz_gc->have_clip_mask = src_quartz_gc->have_clip_mask;
323
324 if (dst_quartz_gc->clip_mask)
325 {
326 CGImageRelease (dst_quartz_gc->clip_mask);
327 dst_quartz_gc->clip_mask = NULL;
328 }
329
330 if (src_quartz_gc->clip_mask)
331 dst_quartz_gc->clip_mask = _gdk_pixmap_get_cgimage (GDK_PIXMAP (src_quartz_gc->clip_mask));
332
333 dst_quartz_gc->line_width = src_quartz_gc->line_width;
334 dst_quartz_gc->line_style = src_quartz_gc->line_style;
335 dst_quartz_gc->cap_style = src_quartz_gc->cap_style;
336 dst_quartz_gc->join_style = src_quartz_gc->join_style;
337
338 g_free (dst_quartz_gc->dash_lengths);
339 dst_quartz_gc->dash_lengths = g_memdup (src_quartz_gc->dash_lengths,
340 sizeof (CGFloat) * src_quartz_gc->dash_count);
341 dst_quartz_gc->dash_count = src_quartz_gc->dash_count;
342 dst_quartz_gc->dash_phase = src_quartz_gc->dash_phase;
343 }
344
345 GdkScreen *
346 gdk_gc_get_screen (GdkGC *gc)
347 {
348 return _gdk_screen;
349 }
350
351 struct PatternCallbackInfo
352 {
353 GdkGCQuartz *private_gc;
354 GdkDrawable *drawable;
355 };
356
357 static void
358 pattern_callback_info_release (void *info)
359 {
360 g_free (info);
361 }
362
363 static void
364 gdk_quartz_draw_tiled_pattern (void *info,
365 CGContextRef context)
366 {
367 struct PatternCallbackInfo *pinfo = info;
368 GdkGC *gc = GDK_GC (pinfo->private_gc);
369 CGImageRef pattern_image;
370 size_t width, height;
371
372 if (!context)
373 return;
374
375 pattern_image = _gdk_pixmap_get_cgimage (GDK_PIXMAP (_gdk_gc_get_tile (gc)));
376
377 width = CGImageGetWidth (pattern_image);
378 height = CGImageGetHeight (pattern_image);
379
380 CGContextDrawImage (context,
381 CGRectMake (0, 0, width, height),
382 pattern_image);
383 CGImageRelease (pattern_image);
384 }
385
386 static void
387 gdk_quartz_draw_stippled_pattern (void *info,
388 CGContextRef context)
389 {
390 struct PatternCallbackInfo *pinfo = info;
391 GdkGC *gc = GDK_GC (pinfo->private_gc);
392 CGImageRef pattern_image;
393 CGRect rect;
394 CGColorRef color;
395
396 if (!context)
397 return;
398
399 pattern_image = _gdk_pixmap_get_cgimage (GDK_PIXMAP (_gdk_gc_get_stipple (gc)));
400 rect = CGRectMake (0, 0,
401 CGImageGetWidth (pattern_image),
402 CGImageGetHeight (pattern_image));
403
404 CGContextClipToMask (context, rect, pattern_image);
405 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (pinfo->drawable,
406 _gdk_gc_get_fg_pixel (gc));
407 CGContextSetFillColorWithColor (context, color);
408 CGColorRelease (color);
409
410 CGContextFillRect (context, rect);
411
412 CGImageRelease (pattern_image);
413 }
414
415 static void
416 gdk_quartz_draw_opaque_stippled_pattern (void *info,
417 CGContextRef context)
418 {
419 struct PatternCallbackInfo *pinfo = info;
420 GdkGC *gc = GDK_GC (pinfo->private_gc);
421 CGImageRef pattern_image;
422 CGRect rect;
423 CGColorRef color;
424
425 if (!context)
426 return;
427
428 pattern_image = _gdk_pixmap_get_cgimage (GDK_PIXMAP (_gdk_gc_get_stipple (gc)));
429 rect = CGRectMake (0, 0,
430 CGImageGetWidth (pattern_image),
431 CGImageGetHeight (pattern_image));
432
433 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (pinfo->drawable,
434 _gdk_gc_get_bg_pixel (gc));
435 CGContextSetFillColorWithColor (context, color);
436 CGColorRelease (color);
437
438 CGContextFillRect (context, rect);
439
440 CGContextClipToMask (context, rect, pattern_image);
441 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (pinfo->drawable,
442 _gdk_gc_get_fg_pixel (gc));
443 CGContextSetFillColorWithColor (context, color);
444 CGColorRelease (color);
445
446 CGContextFillRect (context, rect);
447
448 CGImageRelease (pattern_image);
449 }
450
451 gboolean
452 _gdk_quartz_gc_update_cg_context (GdkGC *gc,
453 GdkDrawable *drawable,
454 CGContextRef context,
455 GdkQuartzContextValuesMask mask)
456 {
457 GdkGCQuartz *private;
458 guint32 fg_pixel;
459 guint32 bg_pixel;
460
461 g_return_val_if_fail (gc == NULL || GDK_IS_GC (gc), FALSE);
462
463 if (!gc || !context)
464 return FALSE;
465
466 private = GDK_GC_QUARTZ (gc);
467
468 if (private->have_clip_region)
469 {
470 CGRect rect;
471 CGRect *cg_rects;
472 GdkRectangle *rects;
473 gint n_rects, i;
474
475 gdk_region_get_rectangles (_gdk_gc_get_clip_region (gc),
476 &rects, &n_rects);
477
478 if (!n_rects)
479 return FALSE;
480
481 if (n_rects == 1)
482 cg_rects = &rect;
483 else
484 cg_rects = g_new (CGRect, n_rects);
485
486 for (i = 0; i < n_rects; i++)
487 {
488 cg_rects[i].origin.x = rects[i].x + gc->clip_x_origin;
489 cg_rects[i].origin.y = rects[i].y + gc->clip_y_origin;
490 cg_rects[i].size.width = rects[i].width;
491 cg_rects[i].size.height = rects[i].height;
492 }
493
494 CGContextClipToRects (context, cg_rects, n_rects);
495
496 g_free (rects);
497 if (cg_rects != &rect)
498 g_free (cg_rects);
499 }
500 else if (private->have_clip_mask && private->clip_mask)
501 {
502 /* Note: This is 10.4 only. For lower versions, we need to transform the
503 * mask into a region.
504 */
505 CGContextClipToMask (context,
506 CGRectMake (gc->clip_x_origin, gc->clip_y_origin,
507 CGImageGetWidth (private->clip_mask),
508 CGImageGetHeight (private->clip_mask)),
509 private->clip_mask);
510 }
511
512 fg_pixel = _gdk_gc_get_fg_pixel (gc);
513 bg_pixel = _gdk_gc_get_bg_pixel (gc);
514
515 {
516 CGBlendMode blend_mode = kCGBlendModeNormal;
517
518 switch (private->function)
519 {
520 case GDK_COPY:
521 blend_mode = kCGBlendModeNormal;
522 break;
523
524 case GDK_INVERT:
525 case GDK_XOR:
526 blend_mode = kCGBlendModeExclusion;
527 fg_pixel = 0xffffffff;
528 bg_pixel = 0xffffffff;
529 break;
530
531 case GDK_CLEAR:
532 case GDK_AND:
533 case GDK_AND_REVERSE:
534 case GDK_AND_INVERT:
535 case GDK_NOOP:
536 case GDK_OR:
537 case GDK_EQUIV:
538 case GDK_OR_REVERSE:
539 case GDK_COPY_INVERT:
540 case GDK_OR_INVERT:
541 case GDK_NAND:
542 case GDK_NOR:
543 case GDK_SET:
544 blend_mode = kCGBlendModeNormal; /* FIXME */
545 break;
546 }
547
548 CGContextSetBlendMode (context, blend_mode);
549 }
550
551 /* FIXME: implement subwindow mode */
552
553 /* FIXME: implement graphics exposures */
554
555 if (mask & GDK_QUARTZ_CONTEXT_STROKE)
556 {
557 CGLineCap line_cap = kCGLineCapButt;
558 CGLineJoin line_join = kCGLineJoinMiter;
559 CGColorRef color;
560
561 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
562 fg_pixel);
563 CGContextSetStrokeColorWithColor (context, color);
564 CGColorRelease (color);
565
566 CGContextSetLineWidth (context, MAX (1.0, private->line_width));
567
568 switch (private->line_style)
569 {
570 case GDK_LINE_SOLID:
571 CGContextSetLineDash (context, 0.0, NULL, 0);
572 break;
573
574 case GDK_LINE_DOUBLE_DASH:
575 /* FIXME: Implement; for now, fall back to GDK_LINE_ON_OFF_DASH */
576
577 case GDK_LINE_ON_OFF_DASH:
578 CGContextSetLineDash (context, private->dash_phase,
579 private->dash_lengths, private->dash_count);
580 break;
581 }
582
583 switch (private->cap_style)
584 {
585 case GDK_CAP_NOT_LAST:
586 /* FIXME: Implement; for now, fall back to GDK_CAP_BUTT */
587 case GDK_CAP_BUTT:
588 line_cap = kCGLineCapButt;
589 break;
590 case GDK_CAP_ROUND:
591 line_cap = kCGLineCapRound;
592 break;
593 case GDK_CAP_PROJECTING:
594 line_cap = kCGLineCapSquare;
595 break;
596 }
597
598 CGContextSetLineCap (context, line_cap);
599
600 switch (private->join_style)
601 {
602 case GDK_JOIN_MITER:
603 line_join = kCGLineJoinMiter;
604 break;
605 case GDK_JOIN_ROUND:
606 line_join = kCGLineJoinRound;
607 break;
608 case GDK_JOIN_BEVEL:
609 line_join = kCGLineJoinBevel;
610 break;
611 }
612
613 CGContextSetLineJoin (context, line_join);
614 }
615
616 if (mask & GDK_QUARTZ_CONTEXT_FILL)
617 {
618 GdkFill fill = _gdk_gc_get_fill (gc);
619 CGColorSpaceRef baseSpace;
620 CGColorSpaceRef patternSpace;
621 CGFloat alpha = 1.0;
622
623 if (fill == GDK_SOLID)
624 {
625 CGColorRef color;
626
627 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
628 fg_pixel);
629 CGContextSetFillColorWithColor (context, color);
630 CGColorRelease (color);
631 }
632 else
633 {
634 struct PatternCallbackInfo *info;
635
636 if (!private->ts_pattern)
637 {
638 gfloat width, height;
639 gboolean is_colored = FALSE;
640 CGPatternCallbacks callbacks = { 0, NULL, NULL };
641 CGPoint phase;
642 GdkPixmapImplQuartz *pix_impl = NULL;
643
644 info = g_new (struct PatternCallbackInfo, 1);
645 private->ts_pattern_info = info;
646
647 /* Won't ref to avoid circular dependencies */
648 info->drawable = drawable;
649 info->private_gc = private;
650
651 callbacks.releaseInfo = pattern_callback_info_release;
652
653 switch (fill)
654 {
655 case GDK_TILED:
656 pix_impl = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_tile (gc))->impl);
657 width = pix_impl->width;
658 height = pix_impl->height;
659 is_colored = TRUE;
660 callbacks.drawPattern = gdk_quartz_draw_tiled_pattern;
661 break;
662 case GDK_STIPPLED:
663 pix_impl = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl);
664 width = pix_impl->width;
665 height = pix_impl->height;
666 is_colored = FALSE;
667 callbacks.drawPattern = gdk_quartz_draw_stippled_pattern;
668 break;
669 case GDK_OPAQUE_STIPPLED:
670 pix_impl = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl);
671 width = pix_impl->width;
672 height = pix_impl->height;
673 is_colored = TRUE;
674 callbacks.drawPattern = gdk_quartz_draw_opaque_stippled_pattern;
675 break;
676 default:
677 break;
678 }
679
680 phase = CGPointApplyAffineTransform (CGPointMake (gc->ts_x_origin, gc->ts_y_origin), CGContextGetCTM (context));
681 CGContextSetPatternPhase (context, CGSizeMake (phase.x, phase.y));
682
683 private->ts_pattern = CGPatternCreate (info,
684 CGRectMake (0, 0, width, height),
685 CGAffineTransformIdentity,
686 width, height,
687 kCGPatternTilingConstantSpacing,
688 is_colored,
689 &callbacks);
690 }
691 else
692 info = (struct PatternCallbackInfo *)private->ts_pattern_info;
693
694 /* Update drawable in the pattern callback info. Again, we
695 * won't ref to avoid circular dependencies.
696 */
697 info->drawable = drawable;
698
699 baseSpace = (fill == GDK_STIPPLED) ? CGColorSpaceCreateDeviceRGB () : NULL;
700 patternSpace = CGColorSpaceCreatePattern (baseSpace);
701
702 CGContextSetFillColorSpace (context, patternSpace);
703 CGColorSpaceRelease (patternSpace);
704 CGColorSpaceRelease (baseSpace);
705
706 if (fill == GDK_STIPPLED)
707 {
708 CGColorRef color;
709 const CGFloat *components;
710
711 color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
712 fg_pixel);
713 components = CGColorGetComponents (color);
714
715 CGContextSetFillPattern (context, private->ts_pattern,
716 components);
717 CGColorRelease (color);
718 }
719 else
720 CGContextSetFillPattern (context, private->ts_pattern, &alpha);
721 }
722 }
723
724 if (mask & GDK_QUARTZ_CONTEXT_TEXT)
725 {
726 /* FIXME: implement text */
727 }
728
729 if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
730 private->is_window = TRUE;
731 else
732 private->is_window = FALSE;
733
734 return TRUE;
735 }