public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BrushMappingMode mode = (BrushMappingMode)values[0]; double value = (double)values[1]; if (mode == BrushMappingMode.Absolute) { return(new GridLength(value, GridUnitType.Pixel)); } // 相对模式需要计算出对应的图片像素宽高 var image = (ImageSource)values[2]; if (image == null) { return(null); } var viewbox = (System.Windows.Rect)values[3]; switch ((string)parameter) { case "left": case "right": return(new GridLength(image.Width * (viewbox.Right - viewbox.Left) * value, GridUnitType.Pixel)); case "top": case "bottom": return(new GridLength(image.Width * (viewbox.Bottom - viewbox.Top) * value, GridUnitType.Pixel)); } return(null); }
/// <summary> /// Returns whether or not an enumeration instance a valid value. /// This method is designed to be used with ValidateValueCallback, and thus /// matches it's prototype. /// </summary> /// <param name="valueObject"> /// Enumeration value to validate. /// </param> /// <returns> 'true' if the enumeration contains a valid value, 'false' otherwise. </returns> public static bool IsBrushMappingModeValid(object valueObject) { BrushMappingMode value = (BrushMappingMode)valueObject; return((value == BrushMappingMode.Absolute) || (value == BrushMappingMode.RelativeToBoundingBox)); }
public ImageBrushTool(ImageSource i, TileMode m, Rect v, BrushMappingMode u, double o = 1) : this() { Image = i; Mode = m; Viewport = v; ViewportUnits = u; Opacity = o; }
public LinearGradientBrush(Color startColor, Color endColor, int startX, int startY, int endX, int endY) { this.MappingMode = BrushMappingMode.RelativeToBoundingBox; this.StartColor = startColor; this.EndColor = endColor; this.StartX = startX; this.StartY = startY; this.EndX = endX; this.EndY = endY; }
protected override void OnRenderResourceCreated(object renderResource) { base.OnRenderResourceCreated(renderResource); this.renderResource = (ITileBrushRenderResource)renderResource; this.renderResource.TileMode = TileMode; this.renderResource.Stretch = Stretch; this.renderResource.Viewport = Viewport; this.renderResource.ViewportUnits = ViewportUnits; }
public string ToGradientUnitsString(BrushMappingMode mappingMode) { switch (mappingMode) { case BrushMappingMode.Absolute: return("userSpaceOnUse"); case BrushMappingMode.RelativeToBoundingBox: return("objectBoundingBox"); } throw new Granular.Exception("Unexpected BrushMappingMode \"{0}\"", mappingMode); }
private static CompositionMappingMode ConvertBrushMappingMode(BrushMappingMode mappingMode) { switch (mappingMode) { case BrushMappingMode.Absolute: return(CompositionMappingMode.Absolute); case BrushMappingMode.RelativeToBoundingBox: default: return(CompositionMappingMode.Relative); } }
/// <summary> /// Updates the brush mapping mode if in high contrast. /// </summary> /// <param name="obj">The dependency object.</param> /// <param name="args">Dependency Property Changed Event Args.</param> private static void BrushMappingMode_Changed(DependencyObject obj, DependencyPropertyChangedEventArgs args) { if (SystemParameters.HighContrast) { LinearGradientBrush linearGradientBrush = obj as LinearGradientBrush; BrushMappingMode brushMappingMode = (BrushMappingMode)args.NewValue; if (linearGradientBrush != null) { linearGradientBrush.MappingMode = brushMappingMode; } } }
protected override void ModifyValue(PropertyReference propertyReference, object valueToSet, SceneNode.Modification modification, int index) { if (propertyReference.LastStep.Equals((object)GradientBrushNode.MappingModeProperty)) { object obj = this.ConvertToWpfValue(valueToSet); if (obj is BrushMappingMode) { BrushMappingMode mappingMode = (BrushMappingMode)obj; this.UpdateBrushForMappingModeChange(propertyReference.Subreference(0, propertyReference.Count - 2), mappingMode); } } base.ModifyValue(propertyReference, valueToSet, modification, index); }
private Rect GetRealViewbox(BrushMappingMode mode, Thickness slicedRect, Rect viewbox, int part) { switch (part) { case 0: if (mode == BrushMappingMode.Absolute) { var rect = new Rect(viewbox.Left, viewbox.Top, slicedRect.Left, slicedRect.Top); return rect; } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; var rect = new Rect(viewbox.Left, viewbox.Top, slicedRect.Left * dx, slicedRect.Top * dy); return rect; } case 1: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Left + slicedRect.Left, viewbox.Top, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, slicedRect.Top); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Top, (1 - slicedRect.Right - slicedRect.Left) * dx, slicedRect.Top * dy); } case 2: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Right - slicedRect.Right, viewbox.Top, slicedRect.Right, slicedRect.Top); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Top, slicedRect.Right * dx, slicedRect.Top * dy); } case 3: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Left, viewbox.Top + slicedRect.Top, slicedRect.Left, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Left, viewbox.Top + slicedRect.Top * dy, slicedRect.Left * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy); } case 4: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Left + slicedRect.Left, viewbox.Top + slicedRect.Top, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Top + slicedRect.Top * dy, (1 - slicedRect.Right - slicedRect.Left) * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy); } case 5: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Right - slicedRect.Right, viewbox.Top + slicedRect.Top, slicedRect.Right, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Top + slicedRect.Top * dy, slicedRect.Right * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy); } case 6: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Left, viewbox.Bottom - slicedRect.Bottom, slicedRect.Left, slicedRect.Bottom); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Left, viewbox.Bottom - slicedRect.Bottom * dy, slicedRect.Left * dx, slicedRect.Bottom * dy); } case 7: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Left + slicedRect.Left, viewbox.Bottom - slicedRect.Bottom, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, slicedRect.Bottom); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Bottom - slicedRect.Right * dy, (1 - slicedRect.Right - slicedRect.Left) * dx, slicedRect.Bottom * dy); } case 8: if (mode == BrushMappingMode.Absolute) { return new Rect(viewbox.Right - slicedRect.Right, viewbox.Bottom - slicedRect.Bottom, slicedRect.Right, slicedRect.Bottom); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return new Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Bottom - slicedRect.Bottom * dy, slicedRect.Right * dx, slicedRect.Bottom * dy); } default: return Rect.Empty; } }
public static void SetSvgMappingMode(this HtmlElement element, BrushMappingMode mappingMode, SvgValueConverter converter) { element.SetAttribute("gradientUnits", converter.ToGradientUnitsString(mappingMode)); }
/// <summary> /// Sets the brush mapping mode. /// </summary> /// <param name="obj">The depedency object.</param> /// <param name="value">The brush mapping mode.</param> public static void SetBrushMappingMode(DependencyObject obj, BrushMappingMode value) { obj.SetValue(BrushMappingModeProperty, value); }
private void UpdateBrushForMappingModeChange(PropertyReference brushPropertyReference, BrushMappingMode mappingMode) { GradientBrush gradientBrush = this.GetComputedValueAsWpf(brushPropertyReference) as GradientBrush; if (gradientBrush == null || gradientBrush.MappingMode == mappingMode) { return; } Rect computedTightBounds = this.GetComputedTightBounds(); if (computedTightBounds.IsEmpty) { return; } Matrix identity = Matrix.Identity; Matrix matrix = Matrix.Identity; if (BrushAdorner.IsAdorningFillProperty((SceneElement)this)) { matrix = BrushAdorner.GetStrokeTransform((SceneElement)this); } if (mappingMode == BrushMappingMode.Absolute) { identity *= matrix; identity.Scale(computedTightBounds.Width, computedTightBounds.Height); identity.Translate(computedTightBounds.X, computedTightBounds.Y); } else if (mappingMode == BrushMappingMode.RelativeToBoundingBox) { identity.Translate(-computedTightBounds.X, -computedTightBounds.Y); identity.Scale(computedTightBounds.Width == 0.0 ? 1.0 : 1.0 / computedTightBounds.Width, computedTightBounds.Height == 0.0 ? 1.0 : 1.0 / computedTightBounds.Height); matrix.Invert(); identity *= matrix; } if (identity.IsIdentity) { return; } LinearGradientBrush linearGradientBrush; if ((linearGradientBrush = gradientBrush as LinearGradientBrush) != null) { Point point1 = RoundingHelper.RoundPosition(linearGradientBrush.StartPoint * identity); Point point2 = RoundingHelper.RoundPosition(linearGradientBrush.EndPoint * identity); this.SetValueAsWpf(brushPropertyReference.Append(LinearGradientBrushNode.StartPointProperty), (object)point1); this.SetValueAsWpf(brushPropertyReference.Append(LinearGradientBrushNode.EndPointProperty), (object)point2); } else { RadialGradientBrush radialGradientBrush; if ((radialGradientBrush = gradientBrush as RadialGradientBrush) == null) { return; } Point point1 = RoundingHelper.RoundPosition(radialGradientBrush.Center * identity); Point point2 = RoundingHelper.RoundPosition(radialGradientBrush.GradientOrigin * identity); double num1 = RoundingHelper.RoundLength(radialGradientBrush.RadiusX * identity.M11); double num2 = RoundingHelper.RoundLength(radialGradientBrush.RadiusY * identity.M22); this.SetValueAsWpf(brushPropertyReference.Append(RadialGradientBrushNode.CenterProperty), (object)point1); this.SetValueAsWpf(brushPropertyReference.Append(RadialGradientBrushNode.GradientOriginProperty), (object)point2); this.SetValue(brushPropertyReference.Append(RadialGradientBrushNode.RadiusXProperty), (object)num1); this.SetValue(brushPropertyReference.Append(RadialGradientBrushNode.RadiusYProperty), (object)num2); } }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BrushMappingMode mode = (BrushMappingMode)values[0]; Thickness slicedRect = (Thickness)values[1]; System.Windows.Rect viewbox = (System.Windows.Rect)values[2]; try { switch ((string)parameter) { case "part0": if (mode == BrushMappingMode.Absolute) { var rect = new System.Windows.Rect(viewbox.Left, viewbox.Top, slicedRect.Left, slicedRect.Top); return(rect); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; var rect = new System.Windows.Rect(viewbox.Left, viewbox.Top, slicedRect.Left * dx, slicedRect.Top * dy); return(rect); } case "part1": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Left + slicedRect.Left, viewbox.Top, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, slicedRect.Top)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Top, (1 - slicedRect.Right - slicedRect.Left) * dx, slicedRect.Top * dy)); } case "part2": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Right - slicedRect.Right, viewbox.Top, slicedRect.Right, slicedRect.Top)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Top, slicedRect.Right * dx, slicedRect.Top * dy)); } case "part3": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Left, viewbox.Top + slicedRect.Top, slicedRect.Left, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Left, viewbox.Top + slicedRect.Top * dy, slicedRect.Left * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy)); } case "part4": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Left + slicedRect.Left, viewbox.Top + slicedRect.Top, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Top + slicedRect.Top * dy, (1 - slicedRect.Right - slicedRect.Left) * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy)); } case "part5": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Right - slicedRect.Right, viewbox.Top + slicedRect.Top, slicedRect.Right, viewbox.Bottom - viewbox.Top - slicedRect.Bottom - slicedRect.Top)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Top + slicedRect.Top * dy, slicedRect.Right * dx, (1 - slicedRect.Bottom - slicedRect.Top) * dy)); } case "part6": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Left, viewbox.Bottom - slicedRect.Bottom, slicedRect.Left, slicedRect.Bottom)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Left, viewbox.Bottom - slicedRect.Bottom * dy, slicedRect.Left * dx, slicedRect.Bottom * dy)); } case "part7": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Left + slicedRect.Left, viewbox.Bottom - slicedRect.Bottom, viewbox.Right - viewbox.Left - slicedRect.Right - slicedRect.Left, slicedRect.Bottom)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Left + slicedRect.Left * dx, viewbox.Bottom - slicedRect.Right * dy, (1 - slicedRect.Right - slicedRect.Left) * dx, slicedRect.Bottom * dy)); } case "part8": if (mode == BrushMappingMode.Absolute) { return(new System.Windows.Rect(viewbox.Right - slicedRect.Right, viewbox.Bottom - slicedRect.Bottom, slicedRect.Right, slicedRect.Bottom)); } else { var dx = viewbox.Right - viewbox.Left; var dy = viewbox.Bottom - viewbox.Top; return(new System.Windows.Rect(viewbox.Right - slicedRect.Right * dx, viewbox.Bottom - slicedRect.Bottom * dy, slicedRect.Right * dx, slicedRect.Bottom * dy)); } } } catch { // 可能会先修改模式,然后再设计值,就导致Rect中出现负值 return(null); } return(null); }
public static ImageBrush getImageBrush(ImageSource source, Rect viewport, TileMode tileMode = TileMode.Tile, BrushMappingMode viewportUnits = BrushMappingMode.Absolute) { return(new ImageBrush { ImageSource = source, Viewport = viewport, ViewportUnits = viewportUnits, TileMode = tileMode }.frozen()); }
public static ImageBrush getImageBrush(Geometry geometry, Brush brush, Pen pen, Rect viewport, TileMode tileMode = TileMode.Tile, BrushMappingMode viewportUnits = BrushMappingMode.Absolute) { return(getImageBrush(getImage(geometry, brush, pen), viewport, tileMode, viewportUnits)); }
public static DrawingBrush getDrawingBrush(Drawing drawing, Rect viewport, TileMode tileMode = TileMode.Tile, BrushMappingMode viewportUnits = BrushMappingMode.Absolute) { return(new DrawingBrush { Drawing = drawing, Viewport = viewport, ViewportUnits = viewportUnits, TileMode = tileMode }.frozen()); }
public static T MappingMode <T>(this T gradientBrush, BrushMappingMode value) where T : IGradientBrush { gradientBrush.MappingMode = value; return(gradientBrush); }
public static IntPtr Box_BrushMappingMode(BrushMappingMode val) { IntPtr ret = NoesisGUI_PINVOKE.Box_BrushMappingMode((int)val); return(ret); }
public static BrushMappingMode Unbox_BrushMappingMode(IntPtr val) { BrushMappingMode ret = (BrushMappingMode)NoesisGUI_PINVOKE.Unbox_BrushMappingMode(val); return(ret); }
public wpf::System.Windows.Media.BrushMappingMode Convert(BrushMappingMode mappingMode) { return((wpf::System.Windows.Media.BrushMappingMode)((int)mappingMode)); }
private void Update() { if (this.Bitmap == null || this.width <= 0 || this.height <= 0) return; BrushMappingMode mode = this.SlicedRectUnits; Thickness slicedRect = this.SlicedRect; Rect viewbox = this.Viewbox; var bitmap = this.Bitmap; // 目标区域的宽高 double width1, width2, width3, height1, height2, height3; if (mode == BrushMappingMode.Absolute) { width1 = slicedRect.Left; width3 = slicedRect.Right; width2 = this.width - width1 - width3; height1 = slicedRect.Top; height3 = slicedRect.Bottom; height2 = this.height - height1 - height3; } else { double dw = bitmap.width * (viewbox.Right - viewbox.Left); double dh = bitmap.width * (viewbox.Bottom - viewbox.Top); width1 = slicedRect.Left * dw; width3 = slicedRect.Right * dw; width2 = this.width - width1 - width3; height1 = slicedRect.Top * dh; height3 = slicedRect.Bottom * dh; height2 = this.height - height1 - height3; } var destWidth = new double[9] { width1, width2, width3, width1, width2, width3, width1, width2, width3, }; var destHeight = new double[9] { height1, height1, height1, height2, height2, height2, height3, height3, height3, }; var destX = new double[9] { 0, width1, width2 + width1, 0, width1, width2 + width1, 0, width1, width2 + width1, }; var destY = new double[9] { 0, 0, 0, height1, height1, height1, height1 + height2, height1 + height2,height1 + height2, }; using (var dc = this.visual.RenderOpen()) { for (int i = 0; i < 4; i++) { var brush = new VisualBrush(bitmap) { ViewboxUnits = mode, Viewbox = GetRealViewbox(mode, slicedRect, viewbox, i) }; dc.DrawRectangle(brush, null, new Rect(destX[i], destY[i], destWidth[i], destHeight[i])); } if (ShowCenterPart) { var brush = new VisualBrush(bitmap) { ViewboxUnits = mode, Viewbox = GetRealViewbox(mode, slicedRect, viewbox, 4) }; dc.DrawRectangle(brush, null, new Rect(destX[4], destY[4], destWidth[4], destHeight[4])); } for (int i = 5; i < 9; i++) { var brush = new VisualBrush(bitmap) { ViewboxUnits = mode, Viewbox = GetRealViewbox(mode, slicedRect, viewbox, i) }; dc.DrawRectangle(brush, null, new Rect(destX[i], destY[i], destWidth[i], destHeight[i])); } } }
unsafe internal static extern void MilUtility_GetTileBrushMapping( D3DMATRIX* transform, D3DMATRIX* relativeTransform, Stretch stretch, AlignmentX alignmentX, AlignmentY alignmentY, BrushMappingMode viewPortUnits, BrushMappingMode viewBoxUnits, Rect* shapeFillBounds, Rect* contentBounds, ref Rect viewport, ref Rect viewbox, out D3DMATRIX contentToShape, out int brushIsEmpty );
/// <summary> /// Obtains a matrix that maps the TileBrush's content to the coordinate /// space of the shape it is filling. /// </summary> /// <param name="shapeFillBounds"> /// Fill-bounds of the shape this brush is stroking/filling /// </param> /// <param name="tileBrushMapping"> /// Output matrix that maps the TileBrush's content to the coordinate /// space of the shape it is filling /// </param> internal void GetTileBrushMapping( Rect shapeFillBounds, out Matrix tileBrushMapping ) { Rect contentBounds = Rect.Empty; BrushMappingMode viewboxUnits = ViewboxUnits; bool brushIsEmpty = false; // Initialize out-param tileBrushMapping = Matrix.Identity; // Obtain content bounds for RelativeToBoundingBox ViewboxUnits // // If ViewboxUnits is RelativeToBoundingBox, then the tile-brush // transform is also dependent on the bounds of the content. if (viewboxUnits == BrushMappingMode.RelativeToBoundingBox) { GetContentBounds(out contentBounds); // If contentBounds is Rect.Empty then this brush renders nothing. // Set the empty flag & early-out. if (contentBounds == Rect.Empty) { brushIsEmpty = true; } } // // Pass the properties to MilUtility_GetTileBrushMapping to calculate // the mapping, unless the brush is already determined to be empty // if (!brushIsEmpty) { // // Obtain properties that must be set into local variables // Rect viewport = Viewport; Rect viewbox = Viewbox; Matrix transformValue; Matrix relativeTransformValue; Transform.GetTransformValue( Transform, out transformValue ); Transform.GetTransformValue( RelativeTransform, out relativeTransformValue ); unsafe { D3DMATRIX d3dTransform; D3DMATRIX d3dRelativeTransform; D3DMATRIX d3dContentToShape; int brushIsEmptyBOOL; // Call MilUtility_GetTileBrushMapping, converting Matrix's to // D3DMATRIX's when needed. MILUtilities.ConvertToD3DMATRIX(&transformValue, &d3dTransform); MILUtilities.ConvertToD3DMATRIX(&relativeTransformValue, &d3dRelativeTransform); MS.Win32.PresentationCore.UnsafeNativeMethods.MilCoreApi.MilUtility_GetTileBrushMapping( &d3dTransform, &d3dRelativeTransform, Stretch, AlignmentX, AlignmentY, ViewportUnits, viewboxUnits, &shapeFillBounds, &contentBounds, ref viewport, ref viewbox, out d3dContentToShape, out brushIsEmptyBOOL ); // Convert the brushIsEmpty flag from BOOL to a bool. brushIsEmpty = (brushIsEmptyBOOL != 0); // Set output matrix if the brush isn't empty. Otherwise, the // output of MilUtility_GetTileBrushMapping must be ignored. if (!brushIsEmpty) { Matrix contentToShape; MILUtilities.ConvertFromD3DMATRIX(&d3dContentToShape, &contentToShape); // Set the out-param to the computed tile brush mapping tileBrushMapping = contentToShape; } } } }