GNOME Bugzilla – Bug 328853
Not all GdkGC value setters are implemented.
Last modified: 2006-09-21 17:06:23 UTC
GdkGC only handles the clip mask setter.
Created attachment 58217 [details] [review] Implements almost all GdkGC value setters + _gdk_window_gc_copy Implements almost all GdkGC value setters and getters + _gdk_window_gc_copy(GdkGC*, GdkGC*) Not yet implemented: font, function, subwindow mode and graphics exposures. This patch does not update _gdk_update_context_from_gc, this one should probably take an additional parameter serving as a mask for values to set (merely stroke and/or fill attributes).
Created attachment 58379 [details] [review] Updated patch, now with gdk_quartz_update_context_from_gc 2006-01-30 Thomas Broyer <t.broyer@gmail.com> * gdk/quartz/gdkquartz.h: Added some public Quartz-specific functions (FIXME: need documentation) * gdk/quartz/gdkprivate-quartz.h: Added fields to GdkGCQuartz and reflected some method changes (see other changed files) * gdk/quartz/gdkdrawable-quartz.h (_gdk_quartz_drawable_get_context, _gdk_quartz_drawable_release_context): made public in gdkquartz.h * gdk/quartz/gdkgc-quartz.c: Implemented more value setters. (gdk_update_context_from_gc): made public in gdkquartz.h and added a mask parameter to filter out values to be reflected from the GdkGC onto the CGContext. * gdk/quartz/gdkcolor-quartz.c: (_gdk_quartz_set_context_fill_color_from_pixel, (_gdk_quartz_set_context_stroke_color_from_pixel): Removed. (_gdk_quartz_get_rgba_from_pixel): Added. * gdk/quartz/GdkQuartzView.c (drawRect): replaced _gdk_quartz_set_context_{stroke,fill}_color_from_pixel with _gdk_quartz_get_rgba_from_pixel and CGContextSetRGB{Stroke,Fill}Color. * gdk/quartz/gdkdrawable-quartz.c: removed _gdk_quartz_set_context_{stroke,fill}_color_from_pixel as this is done in gdk_quartz_update_context_from_gc, used now with the appropriate mask argument. Some methods rewritten to use "batch" Quartz functions (e.g. CGContextStrokeLineSegments) instead of paths. (gdk_quartz_draw_points): rewritten and improved
Oops, forgot to say that I still don't have a dev environment yet, so the code has not be tested nor even compiled; sorry for the inconvenience...
I wonder if we can make gdk_quartz_update_context_from_gc actually set both the fill and the stroke color. I have yet to come across a case where a gdk function needs them to be different. What do you think?
*** Bug 350826 has been marked as a duplicate of this bug. ***
I'm about to manually apply this patch and adding some missing properties like the drawing function (see #350826).
Fixed in CVS: 2006-09-21 Michael Natterer <mitch@imendio.com> Implement lots of value setters for GdkGC, based on a heavily modified patch from Thomas Broyer (bug #328853): * gdk/quartz/gdkcolor-quartz.c: removed functions which set colors on the CGContext. Instead, added gdk_quartz_get_rgba_from_pixel() which simply returns RGBA values from a GdkColor's pixel value. See gdk_quartz_update_context_from_gc() below. * gdk/quartz/gdkprivate-quartz.h (struct GdkGCQuartz): added lots of members for the newly suppored GC values. Added enum GdkQuartzContextValuesMask which is used for setting up the CGContext for filling and/or stroking. * gdk/quartz/gdkgc-quartz.c (gdk_quartz_gc_get_values) (gdk_quartz_gc_set_values) (_gdk_windowing_gc_copy): support a lot more GC values. (gdk_quartz_update_context_from_gc): added GdkQuartzContextValuesMask parameter and set filling/stroking parameters accordingly. This function also gained full control over the FG and BG colors (they can't be set separately any more). The stipple mask part of the patch doesn't work but seems to take the right approach and doesn't make things worse, so I applied it. Did *not* apply the clipping part of the patch since I don't understand it (I don't understand the version in CVS either, but it at least works :-) * gdk/quartz/gdkdrawable-quartz.c: pass the right masks to gdk_quartz_update_context_from_gc() and removed separate color setting calls. Some minor fixes. * gdk/quartz/gdkwindow-quartz.c (gdk_window_impl_quartz_begin_paint_region): set the CGContext's fill color manually. We don't have/need a GC here.