public static NSImage createGradientImageWidth(CGFloat pixelsWide) height(CGFloat pixelsHigh) fromColor(NSColor fromColor) toColor(NSColor toColor) { CGImageRef theCGImage = null; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // create the bitmap context CGContextRef gradientBitmapContext = CGBitmapContextCreate(null, (size_t)pixelsWide, (size_t)pixelsHigh, 8, 0, colorSpace, CGImageAlphaInfo.kCGImageAlphaNoneSkipFirst as CGBitmapInfo); // define the start and end grayscale values (with the alpha, even though // our bitmap context doesn't support alpha the gradient requires it) CGColorRef start = fromColor.CGColor(); CGColorRef end = toColor.CGColor(); CGColorRef[] colors = new [] {start, end}; // CGFloat locations[2] = { 0.0, 1.0 }; CFArrayRef colorArray = CFArrayCreate(null, &colors, 2, null); // create the CGGradient and then release the gray color space CGGradientRef grayScaleGradient = CGGradientCreateWithColors(null, colorArray, null); CGColorSpaceRelease(colorSpace); CFRelease(colorArray); // create the start and end points for the gradient vector (straight down) CGPoint gradientStartPoint = CGPointZero; CGPoint gradientEndPoint = CGPointMake(pixelsWide / 2, pixelsHigh); // draw the gradient into the gray bitmap context CGContextDrawLinearGradient(gradientBitmapContext, grayScaleGradient, gradientStartPoint, gradientEndPoint, kCGGradientDrawsAfterEndLocation); CGGradientRelease(grayScaleGradient); // convert the context into a CGImageRef and release the context theCGImage = CGBitmapContextCreateImage(gradientBitmapContext); CGContextRelease(gradientBitmapContext); // return the imageref containing the gradient NSImage theImage = this.imageFromCGImageRef(theCGImage); // [NSImage imageWithCGImage:theCGImage]; CGImageRelease(theCGImage); return theImage; }
private void AddBox (string title, CGRect frame, int level, NSColor color) { var node = Utils.SCBoxNode (title, frame, color, 2.0f, true); node.Scale = new SCNVector3 (0.02f, 0.02f, 0.02f); node.Position = new SCNVector3 (-5, 1.5f * level, 10); ContentNode.AddChildNode (node); }
public WarningWindow() { // Interface Builder won't allow us to create a window with no title bar // so we have to create it manually. But we could use IB if we display // the window with a sheet... NSRect rect = new NSRect(0, 0, 460, 105); m_window = NSWindow.Alloc().initWithContentRect_styleMask_backing_defer(rect, 0, Enums.NSBackingStoreBuffered, false); m_window.setHasShadow(false); // Initialize the text attributes. var dict = NSMutableDictionary.Create(); NSFont font = NSFont.fontWithName_size(NSString.Create("Georgia"), 64.0f); dict.setObject_forKey(font, Externs.NSFontAttributeName); NSMutableParagraphStyle style = NSMutableParagraphStyle.Create(); style.setAlignment(Enums.NSCenterTextAlignment); dict.setObject_forKey(style, Externs.NSParagraphStyleAttributeName); m_attrs = dict.Retain(); // Initialize the background bezier. m_background = NSBezierPath.Create().Retain(); m_background.appendBezierPathWithRoundedRect_xRadius_yRadius(m_window.contentView().bounds(), 20.0f, 20.0f); m_color = NSColor.colorWithDeviceRed_green_blue_alpha(250/255.0f, 128/255.0f, 114/255.0f, 1.0f).Retain(); ActiveObjects.Add(this); }
public MyView (CGRect frame) : base (frame) { lineColor = NSColor.Blue; path = new NSBezierPath (); path.MoveTo (Bounds.Location); path.LineTo (new CGPoint (Bounds.GetMaxX (),Bounds.GetMaxY ())); }
/// <summary> /// Initializes a new instance of the <see cref="AppKit.TextKit.Formatter.KeywordDescriptor"/> class. /// </summary> /// <param name="type">Specifies the <c>KeywordType</c>.</param> /// <param name="color">Specifies the <c>NSColor</c> that this keyword will be set to.</param> /// <param name="toolTip">Defines the tool tip for this keyword.</param> public KeywordDescriptor (KeywordType type, NSColor color, string toolTip) { // Initialize this.Type = type; this.Color = color; this.Tooltip = toolTip; }
public override void SetupSlide (PresentationViewController presentationViewController) { RedColor = NSColor.FromDeviceRgba (168.0f / 255.0f, 21.0f / 255.0f, 0.0f / 255.0f, 1); GreenColor = NSColor.FromDeviceRgba (154.0f / 255.0f, 197.0f / 255.0f, 58.0f / 255.0f, 1); BlueColor = NSColor.FromDeviceRgba (49.0f / 255.0f, 80.0f / 255.0f, 201.0f / 255.0f, 1); PurpleColor = NSColor.FromDeviceRgba (190.0f / 255.0f, 56.0f / 255.0f, 243.0f / 255.0f, 1); // Create the diagram but hide it DiagramNode = CloningDiagramNode (); DiagramNode.Opacity = 0.0f; ContentNode.AddChildNode (DiagramNode); }
public override void DrawRect (CGRect dirtyRect) { CGRect bounds = Bounds; CGSize stripeSize = bounds.Size; stripeSize.Width = bounds.Width / 10.0f; CGRect stripe = bounds; stripe.Size = stripeSize; NSColor[] colors = new NSColor[2] { NSColor.White, NSColor.Blue }; for (int i = 0; i < 10; i++){ colors [i % 2].Set (); NSGraphics.RectFill (stripe); CGPoint origin = stripe.Location; origin.X += stripe.Size.Width; stripe.Location = origin; } }
public override void PresentStep (int index, PresentationViewController presentationViewController) { switch (index) { case 0: // Hide everything (in case the user went backward) for (var i = 1; i < 4; i++) { var teapot = GroundNode.FindChildNode ("Teapot" + i, true); teapot.Opacity = 0.0f; } break; case 1: // Move the camera and adjust the clipping plane SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 3; presentationViewController.CameraNode.Position = new SCNVector3 (0, 0, 200); presentationViewController.CameraNode.Camera.ZFar = 500.0f; SCNTransaction.Commit (); break; case 2: // Revert to original position SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; presentationViewController.CameraNode.Position = new SCNVector3 (0, 0, 0); presentationViewController.CameraNode.Camera.ZFar = 100.0f; SCNTransaction.Commit (); break; case 3: var numberNodes = new SCNNode[] { AddNumberNode ("64k", -17), AddNumberNode ("6k", -9), AddNumberNode ("3k", -1), AddNumberNode ("1k", 6.5f), AddNumberNode ("256", 14) }; SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; // Move the camera and the text presentationViewController.CameraHandle.Position = new SCNVector3 (presentationViewController.CameraHandle.Position.X, presentationViewController.CameraHandle.Position.Y + 6, presentationViewController.CameraHandle.Position.Z); TextManager.TextNode.Position = new SCNVector3 (TextManager.TextNode.Position.X, TextManager.TextNode.Position.Y + 6, TextManager.TextNode.Position.Z); // Show the remaining resolutions for (var i = 0; i < 5; i++) { var numberNode = numberNodes [i]; numberNode.Position = new SCNVector3 (numberNode.Position.X, 7, -5); var teapot = GroundNode.FindChildNode ("Teapot" + i, true); teapot.Opacity = 1.0f; teapot.Rotation = new SCNVector4 (0, 0, 1, (float)(Math.PI / 4)); teapot.Position = new SCNVector3 ((i - 2) * 8, 5, teapot.Position.Z); } SCNTransaction.Commit (); break; case 4: presentationViewController.ShowsNewInSceneKitBadge (true); // Remove the numbers RemoveNumberNodes (); SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; // Add some text and code TextManager.SetSubtitle ("SCNLevelOfDetail"); TextManager.AddCode ("#var lod1 = SCNLevelOfDetail.#CreateWithWorldSpaceDistance# (aGeometry, aDistance); \n" + "geometry.#LevelsOfDetail# = new SCNLevelOfDetail { lod1, lod2, ..., lodn };#"); // Animation the merge for (int i = 0; i < 5; i++) { var teapot = GroundNode.FindChildNode ("Teapot" + i, true); teapot.Opacity = i == 0 ? 1.0f : 0.0f; teapot.Rotation = new SCNVector4 (0, 0, 1, 0); teapot.Position = new SCNVector3 (0, -5, teapot.Position.Z); } // Move the camera and the text presentationViewController.CameraHandle.Position = new SCNVector3 (presentationViewController.CameraHandle.Position.X, presentationViewController.CameraHandle.Position.Y - 3, presentationViewController.CameraHandle.Position.Z); TextManager.TextNode.Position = new SCNVector3 (TextManager.TextNode.Position.X, TextManager.TextNode.Position.Y - 3, TextManager.TextNode.Position.Z); SCNTransaction.Commit (); break; case 5: presentationViewController.ShowsNewInSceneKitBadge (false); SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 3; // Change the lighting to remove the front light and rise the main light presentationViewController.UpdateLightingWithIntensities (new float[] { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.3f }); presentationViewController.RiseMainLight (true); // Remove some text TextManager.FadeOutText (SlideTextManager.TextType.Title); TextManager.FadeOutText (SlideTextManager.TextType.Subtitle); TextManager.FadeOutText (SlideTextManager.TextType.Code); SCNTransaction.Commit (); // Retrieve the main teapot var maintTeapot = GroundNode.FindChildNode ("Teapot0", true); // The distances to use for each LOD var distances = new float [4] { 30, 50, 90, 150 }; // An array of SCNLevelOfDetail instances that we will build var levelsOfDetail = new SCNLevelOfDetail[4]; for (var i = 1; i < 5; i++) { var teapotNode = GroundNode.FindChildNode ("Teapot" + i, true); var teapot = teapotNode.Geometry; // Unshare the material because we will highlight the different levels of detail with different colors in the next step teapot.FirstMaterial = (SCNMaterial)teapot.FirstMaterial.Copy (); // Build the SCNLevelOfDetail instance var levelOfDetail = SCNLevelOfDetail.CreateWithWorldSpaceDistance (teapot, distances [i - 1]); levelsOfDetail [i - 1] = levelOfDetail; } maintTeapot.Geometry.LevelsOfDetail = levelsOfDetail; // Duplicate and move the teapots var startTime = CAAnimation.CurrentMediaTime (); var delay = 0.2; var rowCount = 9; var columnCount = 12; SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 0; // Change the far clipping plane to be able to see far away presentationViewController.CameraNode.Camera.ZFar = 1000.0; for (var j = 0; j < columnCount; j++) { for (var i = 0; i < rowCount; i++) { // Clone var clone = maintTeapot.Clone (); maintTeapot.ParentNode.AddChildNode (clone); // Animate var animation = CABasicAnimation.FromKeyPath ("position"); animation.Additive = true; animation.Duration = 1.0; animation.To = NSValue.FromVector (new SCNVector3 ((i - rowCount / 2.0f) * 12.0f, 5 + (columnCount - j) * 15.0f, 0)); animation.From = NSValue.FromVector (new SCNVector3 (0, 0, 0)); animation.BeginTime = startTime + delay; // desynchronize // Freeze at the end of the animation animation.RemovedOnCompletion = false; animation.FillMode = CAFillMode.Forwards; clone.AddAnimation (animation, new NSString ("cloneAnimation")); // Animate the hidden property to automatically show the node when the position animation starts animation = CABasicAnimation.FromKeyPath ("hidden"); animation.Duration = delay + 0.01; animation.FillMode = CAFillMode.Both; animation.From = new NSNumber (1); animation.To = new NSNumber (0); clone.AddAnimation (animation, new NSString ("cloneAnimation2")); delay += 0.05; } } SCNTransaction.Commit (); // Animate the camera while we duplicate the nodes SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1.0 + rowCount * columnCount * 0.05; var position = presentationViewController.CameraHandle.Position; presentationViewController.CameraHandle.Position = new SCNVector3 (position.X, position.Y + 5, position.Z); presentationViewController.CameraPitch.Rotation = new SCNVector4 (1, 0, 0, presentationViewController.CameraPitch.Rotation.W - ((float)(Math.PI / 4) * 0.1f)); SCNTransaction.Commit (); break; case 6: // Highlight the levels of detail with colors var teapotChild = GroundNode.FindChildNode ("Teapot0", true); var colors = new NSColor[] { NSColor.Red, NSColor.Orange, NSColor.Yellow, NSColor.Green }; SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 1; for (var i = 0; i < 4; i++) { var levelOfDetail = teapotChild.Geometry.LevelsOfDetail [i]; levelOfDetail.Geometry.FirstMaterial.Multiply.Contents = colors [i]; } SCNTransaction.Commit (); break; } }
static Cairo.Color ConvertColor (NSColor color) { nfloat r, g, b, a; if (color.ColorSpaceName == NSColorSpace.DeviceWhite) { a = 1.0f; r = g = b = color.WhiteComponent; } else { color.GetRgba (out r, out g, out b, out a); } return new Cairo.Color (r, g, b, a); }
bool LoadText (string message, bool isMarkup, MessageType statusType) { message = message ?? ""; message = message.Replace (Environment.NewLine, " ").Replace ("\n", " ").Trim (); if (message == text) return false; text = message; messageType = statusType; textColor = ColorForType (statusType); return true; }
NSAttributedString GetStatusString (string text, NSColor color) { nfloat fontSize = NSFont.SystemFontSize; if (Window != null && Window.Screen != null) { fontSize -= Window.Screen.BackingScaleFactor == 2 ? 2 : 1; } else { fontSize -= 1; } return new NSAttributedString (text, new NSStringAttributes { ForegroundColor = color, ParagraphStyle = new NSMutableParagraphStyle { HeadIndent = imageView.Frame.Width, LineBreakMode = NSLineBreakMode.TruncatingMiddle, }, Font = NSFont.SystemFontOfSize (fontSize), }); }
public void ShowMessage (IconId image, string message, bool isMarkup, NSColor color) { DispatchService.AssertGuiThread (); LoadText (message, isMarkup, color); LoadPixbuf (image); ReconstructString (); }
public ThreadedFile(string fullPath, string relativePath, NSColor color) : this() { FullPath = fullPath; RelativePath = relativePath; FileName = System.IO.Path.GetFileName(relativePath); Color = color; }
private static void DoSetTempAttrs() { NSUserDefaults defaults = NSUserDefaults.standardUserDefaults(); var data = defaults.objectForKey(NSString.Create("selected line color")).To<NSData>(); if (!NSObject.IsNullOrNil(data)) ms_selectedLineColor = NSUnarchiver.unarchiveObjectWithData(data).To<NSColor>().Retain(); else ms_selectedLineColor = NSColor.yellowColor().Retain(); ms_errorColor = NSColor.redColor().Retain(); }
public void ShowMessage (IconId image, string message, bool isMarkup, NSColor color) { DispatchService.AssertGuiThread (); bool changed = LoadText (message, isMarkup, color); LoadPixbuf (image); if (changed) ReconstructString (updateTrackingAreas: true); }
bool LoadText (string message, bool isMarkup, NSColor color) { message = message ?? ""; message = message.Replace (Environment.NewLine, " ").Replace ("\n", " ").Trim (); if (message == text) return false; text = message; currentTextIsMarkup = isMarkup; textColor = color; return true; }
public static SCNNode SCBoxNode (string title, CGRect frame, NSColor color, float cornerRadius, bool centered) { NSMutableDictionary titleAttributes = null; NSMutableDictionary centeredTitleAttributes = null; // create and extrude a bezier path to build the box var path = NSBezierPath.FromRoundedRect (frame, cornerRadius, cornerRadius); path.Flatness = 0.05f; var shape = SCNShape.Create (path, 20); shape.ChamferRadius = 0.0f; var node = SCNNode.Create (); node.Geometry = shape; // create an image and fill with the color and text var textureSize = new CGSize (); textureSize.Width = NMath.Ceiling (frame.Size.Width * 1.5f); textureSize.Height = NMath.Ceiling (frame.Size.Height * 1.5f); var texture = new NSImage (textureSize); texture.LockFocus (); var drawFrame = new CGRect (0, 0, textureSize.Width, textureSize.Height); nfloat hue, saturation, brightness, alpha; (color.UsingColorSpace (NSColorSpace.DeviceRGBColorSpace)).GetHsba (out hue, out saturation, out brightness, out alpha); var lightColor = NSColor.FromDeviceHsba (hue, saturation - 0.2f, brightness + 0.3f, alpha); lightColor.Set (); NSGraphics.RectFill (drawFrame); NSBezierPath fillpath = null; if (cornerRadius == 0 && centered == false) { //special case for the "labs" slide drawFrame.Offset (0, -2); fillpath = NSBezierPath.FromRoundedRect (drawFrame, cornerRadius, cornerRadius); } else { drawFrame.Inflate (-3, -3); fillpath = NSBezierPath.FromRoundedRect (drawFrame, cornerRadius, cornerRadius); } color.Set (); fillpath.Fill (); // draw the title if any if (title != null) { if (titleAttributes == null) { var paraphStyle = new NSMutableParagraphStyle (); paraphStyle.LineBreakMode = NSLineBreakMode.ByWordWrapping; paraphStyle.Alignment = NSTextAlignment.Center; paraphStyle.MinimumLineHeight = 38; paraphStyle.MaximumLineHeight = 38; var font = NSFont.FromFontName ("Myriad Set Semibold", 34) != null ? NSFont.FromFontName ("Myriad Set Semibold", 34) : NSFont.FromFontName ("Avenir Medium", 34); var shadow = new NSShadow (); shadow.ShadowOffset = new CGSize (0, -2); shadow.ShadowBlurRadius = 4; shadow.ShadowColor = NSColor.FromDeviceWhite (0.0f, 0.5f); titleAttributes = new NSMutableDictionary (); titleAttributes.SetValueForKey (font, NSAttributedString.FontAttributeName); titleAttributes.SetValueForKey (NSColor.White, NSAttributedString.ForegroundColorAttributeName); titleAttributes.SetValueForKey (shadow, NSAttributedString.ShadowAttributeName); titleAttributes.SetValueForKey (paraphStyle, NSAttributedString.ParagraphStyleAttributeName); var centeredParaphStyle = (NSMutableParagraphStyle)paraphStyle.MutableCopy (); centeredParaphStyle.Alignment = NSTextAlignment.Center; centeredTitleAttributes = new NSMutableDictionary (); centeredTitleAttributes.SetValueForKey (font, NSAttributedString.FontAttributeName); centeredTitleAttributes.SetValueForKey (NSColor.White, NSAttributedString.ForegroundColorAttributeName); centeredTitleAttributes.SetValueForKey (shadow, NSAttributedString.ShadowAttributeName); centeredTitleAttributes.SetValueForKey (paraphStyle, NSAttributedString.ParagraphStyleAttributeName); } var attrString = new NSAttributedString (title, centered ? centeredTitleAttributes : titleAttributes); var textSize = attrString.Size; //check if we need two lines to draw the text var twoLines = title.Contains ("\n"); if (!twoLines) twoLines = textSize.Width > frame.Size.Width && title.Contains (" "); //if so, we need to adjust the size to center vertically if (twoLines) textSize.Height += 38; if (!centered) drawFrame.Inflate (-15, 0); //center vertically var dy = (drawFrame.Size.Height - textSize.Height) * 0.5f; var drawFrameHeight = drawFrame.Size.Height; drawFrame.Size = new CGSize (drawFrame.Size.Width, drawFrame.Size.Height - dy); attrString.DrawString (drawFrame); } texture.UnlockFocus (); //set the created image as the diffuse texture of our 3D box var front = SCNMaterial.Create (); front.Diffuse.Contents = texture; front.LocksAmbientWithDiffuse = true; //use a lighter color for the chamfer and sides var sides = SCNMaterial.Create (); sides.Diffuse.Contents = lightColor; node.Geometry.Materials = new SCNMaterial[] { front, sides, sides, sides, sides }; return node; }
private void DoReadPrefs() { // Release the old stuff (if any). if (m_pathColor != null) { m_pathColor.release(); m_pathColor = null; } for (int i = 0; i < FilesCount; ++i) { if (m_fileColors[i] != null) { m_fileColors[i].release(); m_fileColors[i] = null; } } // Load the new stuff. NSUserDefaults defaults = NSUserDefaults.standardUserDefaults(); var data = defaults.objectForKey(NSString.Create(m_path + "-path color")).To<NSData>(); m_pathColor = NSUnarchiver.unarchiveObjectWithData(data).To<NSColor>().Retain(); for (int i = 1; i <= FilesCount; ++i) { data = defaults.objectForKey(NSString.Create(m_path + "-files" + i + " color")).To<NSData>(); m_fileColors[i - 1] = NSUnarchiver.unarchiveObjectWithData(data).To<NSColor>().Retain(); string globs = defaults.stringForKey(NSString.Create(m_path + "-files" + i + " globs")).description(); m_fileGlobs[i - 1] = Glob.Split(globs); } }
NSAttributedString GetStatusString (string text, NSColor color) { return new NSAttributedString (text, new NSStringAttributes { ForegroundColor = color, ParagraphStyle = new NSMutableParagraphStyle { HeadIndent = imageView.Frame.Width, LineBreakMode = NSLineBreakMode.TruncatingMiddle, }, Font = NSFont.SystemFontOfSize (NSFont.SystemFontSize - 2), }); }
internal static NSColor GetFileColor(string fileName, string[][] fileGlobs, NSColor[] fileColors) { for (int i = 0; i < FilesCount; ++i) { if (fileGlobs[i] != null) { foreach (string glob in fileGlobs[i]) { if (Glob.Match(glob, fileName)) { return fileColors[i] ?? NSColor.blackColor(); } } } } return NSColor.blackColor(); }
void LoadText (string message, bool isMarkup, NSColor color) { message = message ?? ""; text = message.Replace (Environment.NewLine, " ").Replace ("\n", " ").Trim (); currentTextIsMarkup = isMarkup; textColor = color; }
static NSDictionary ColorAttrs(NSColor color) { return NSDictionary.FromObjectsAndKeys ( new NSObject[] { color }, new NSObject[] { NSAttributedString.ForegroundColorAttributeName }); }
void LoadStyles (object sender = null, EventArgs args = null) { if (IdeApp.Preferences.UserInterfaceTheme == Theme.Dark) { Appearance = NSAppearance.GetAppearance (NSAppearance.NameVibrantDark); } else { Appearance = NSAppearance.GetAppearance (NSAppearance.NameAqua); } UpdateApplicationNamePlaceholderText (); textColor = ColorForType (messageType); ReconstructString (); }
static NSDictionary FontColorAttrs(string name, float size, NSColor color) { return NSDictionary.FromObjectsAndKeys ( new NSObject[] { NSFont.FromFontName (name, size), color }, new NSObject[] { NSAttributedString.FontAttributeName, NSAttributedString.ForegroundColorAttributeName }); }
private NSMutableAttributedString DoCreateString(string newValue, NSColor color) { var attrs = NSMutableDictionary.Create(); attrs.setObject_forKey(color, Externs.NSForegroundColorAttributeName); var result = NSMutableAttributedString.Create(newValue, attrs).Retain(); return result; }
public void OnStartup() { DoLoadPrefs(); if (ms_resolvedColor == null) { ms_resolvedColor = NSColor.colorWithDeviceRed_green_blue_alpha(0.86f, 0.08f, 0.24f, 1.0f).Retain(); // crimson ms_unresolvedColor = NSColor.colorWithDeviceRed_green_blue_alpha(1.0f, 0.84f, 0.0f, 1.0f).Retain(); // gold // ms_unresolvedColor = NSColor.colorWithDeviceRed_green_blue_alpha(1.0f, 0.63f, 0.48f, 1.0f).Retain(); // light salmon } Broadcaster.Register("opening document window", this); Broadcaster.Register("swapping code view", this); Broadcaster.Register("swapped code view", this); Broadcaster.Register("closing document window", this); Broadcaster.Register("debugger resumed", this); Broadcaster.Register("debugger started", this); Broadcaster.Register("debugger stopped", this); Broadcaster.Register("debugger resolved breakpoint", this); Broadcaster.Register("debugger unresolved breakpoint", this); }
static string ConvertColorToHex (NSColor color) { nfloat r, g, b, a; if (color.ColorSpaceName == NSColorSpace.DeviceWhite) { a = 1.0f; r = g = b = color.WhiteComponent; } else { color.GetRgba (out r, out g, out b, out a); } return String.Format ("#{0}{1}{2}", ((int)(r * 255)).ToString ("x2"), ((int)(g * 255)).ToString ("x2"), ((int)(b * 255)).ToString ("x2") ); }
private AnnotateView(IntPtr obj) : base(obj) { m_color = NSColor.whiteColor().Retain(); ActiveObjects.Add(this); }
public CustomCatTextAttachmentCell (NSImage image) : base (image) { borderColor = NSColor.FromDeviceHsba ((float)random.NextDouble (), 1f, 1f, 1f); }
public void ShowMessage (IconId image, string message, bool isMarkup, NSColor color) { Runtime.AssertMainThread (); bool changed = LoadText (message, isMarkup, color); LoadPixbuf (image); if (changed) ReconstructString (); }