Author: spouliot
Date: 2007-09-20 10:48:50 -0400 (Thu, 20 Sep 2007)
New Revision: 86060
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/brush.cpp
trunk/moon/src/brush.h
Log:
brush.cpp|h: Implemented MappingMode for RadialGradientBrush. Bubbles from
bubblemark.com are now rendered correctly.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-09-20 14:47:40 UTC (rev 86059)
+++ trunk/moon/src/ChangeLog 2007-09-20 14:48:50 UTC (rev 86060)
@@ -1,3 +1,8 @@
+2007-09-20 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * brush.cpp|h: Implemented MappingMode for RadialGradientBrush.
+ Bubbles from bubblemark.com are now rendered correctly.
+
2007-09-19 Sebastien Pouliot <[EMAIL PROTECTED]>
* shape.cpp|h: Remove dead code.
Modified: trunk/moon/src/brush.cpp
===================================================================
--- trunk/moon/src/brush.cpp 2007-09-20 14:47:40 UTC (rev 86059)
+++ trunk/moon/src/brush.cpp 2007-09-20 14:48:50 UTC (rev 86060)
@@ -260,10 +260,6 @@
this->SetValue (GradientBrush::GradientStopsProperty,
Value::CreateUnref (new GradientStopCollection ()));
}
-GradientBrush::~GradientBrush ()
-{
-}
-
void
GradientBrush::OnPropertyChanged (DependencyProperty *prop)
{
@@ -301,8 +297,6 @@
cairo_pattern_set_extend (pattern, convert_gradient_spread_method
(gsm));
Collection::Node *node;
- // TODO - BrushMappingMode is ignore (use a matrix)
-
// TODO - ColorInterpolationModeProperty is ignored (map to ?)
double opacity = GetTotalOpacity (uielement);
@@ -383,13 +377,26 @@
cairo_pattern_t *pattern = cairo_pattern_create_linear (x0, y0, x1, y1);
+ cairo_matrix_t matrix;
+ switch (gradient_brush_get_mapping_mode (this)) {
+ case BrushMappingModeAbsolute:
+ cairo_matrix_init_identity (&matrix);
+ break;
+ case BrushMappingModeRelativeToBoundingBox:
+ // FIXME - need test case
+ cairo_matrix_init_identity (&matrix);
+ break;
+ }
+
Transform *transform = brush_get_transform (this);
if (transform) {
- cairo_matrix_t matrix;
- transform_get_transform (transform, &matrix);
- cairo_matrix_invert (&matrix);
- cairo_pattern_set_matrix (pattern, &matrix);
+ cairo_matrix_t tm;
+ transform_get_transform (transform, &tm);
+ // TODO - optimization, check for empty/identity matrix too ?
+ cairo_matrix_multiply (&matrix, &matrix, &tm);
}
+ cairo_matrix_invert (&matrix);
+ cairo_pattern_set_matrix (pattern, &matrix);
bool visible = GradientBrush::SetupGradient (pattern, uielement);
@@ -510,7 +517,14 @@
}
cairo_matrix_t matrix;
- cairo_matrix_init (&matrix, w * rx / ry, 0, 0, h, 0, 0);
+ switch (gradient_brush_get_mapping_mode (this)) {
+ case BrushMappingModeAbsolute:
+ cairo_matrix_init_identity (&matrix);
+ break;
+ case BrushMappingModeRelativeToBoundingBox:
+ cairo_matrix_init (&matrix, w * rx / ry, 0, 0, h, 0, 0);
+ break;
+ }
Transform *transform = brush_get_transform (this);
if (transform) {
@@ -1144,7 +1158,7 @@
/* GradientBrush fields */
GradientBrush::ColorInterpolationModeProperty =
DependencyObject::Register (Type::GRADIENTBRUSH, "ColorInterpolationMode", new
Value (0));
GradientBrush::GradientStopsProperty = DependencyObject::Register
(Type::GRADIENTBRUSH, "GradientStops", Type::GRADIENTSTOP_COLLECTION);
- GradientBrush::MappingModeProperty = DependencyObject::Register
(Type::GRADIENTBRUSH, "MappingMode", new Value (0));
+ GradientBrush::MappingModeProperty = DependencyObject::Register
(Type::GRADIENTBRUSH, "MappingMode", new Value
(BrushMappingModeRelativeToBoundingBox));
GradientBrush::SpreadMethodProperty = DependencyObject::Register
(Type::GRADIENTBRUSH, "SpreadMethod", new Value (0));
/* LinearGradientBrush fields */
Modified: trunk/moon/src/brush.h
===================================================================
--- trunk/moon/src/brush.h 2007-09-20 14:47:40 UTC (rev 86059)
+++ trunk/moon/src/brush.h 2007-09-20 14:48:50 UTC (rev 86060)
@@ -101,7 +101,6 @@
static DependencyProperty* SpreadMethodProperty;
GradientBrush ();
- ~GradientBrush ();
virtual Type::Kind GetObjectType () { return Type::GRADIENTBRUSH; }
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches