public override void RenderStaticImage(Graphics gfx, bool printer) { BackgroundMode bgMode = (printer) ? BackgroundMode.bmImage : BackgroundMode.bmAny; fRenderer.SetTarget(gfx, false); RenderStatic(bgMode); }
private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background) { // drawing relative offset of tree on graphics int spx = 0; int spy = 0; Size clientSize = ClientSize; ExtPoint scrollPos = new ExtPoint(Math.Abs(AutoScrollPosition.X), Math.Abs(AutoScrollPosition.Y)); if (drawMode == ChartDrawMode.dmInteractive) { spx += -scrollPos.X; spy += -scrollPos.Y; Rectangle viewPort = GetImageViewPort(); fModel.VisibleArea = ExtRect.CreateBounds(scrollPos.X, scrollPos.Y, viewPort.Width, viewPort.Height); } else { fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight); } if (drawMode == ChartDrawMode.dmInteractive || drawMode == ChartDrawMode.dmStaticCentered) { if (fModel.ImageWidth < clientSize.Width) { spx += (clientSize.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < clientSize.Height) { spy += (clientSize.Height - fModel.ImageHeight) / 2; } } fModel.SetOffsets(spx, spy); DrawBackground(background); #if DEBUG_IMAGE using (Pen pen = new Pen(Color.Red)) { fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight); } #endif bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null); if (hasDeep && fOptions.DeepMode == DeepMode.Background) { DrawDeep(fOptions.DeepMode, spx, spy); } fRenderer.SetTranslucent(0.0f); fModel.Draw(drawMode); if (hasDeep && fOptions.DeepMode == DeepMode.Foreground) { DrawDeep(fOptions.DeepMode, spx, spy); } }
public Tick(IStreamReader reader, GraphRecordNumber id, ushort length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.tktMajor = (MarkLocation)reader.ReadByte(); this.tktMinor = (MarkLocation)reader.ReadByte(); this.tlt = (MarkLabelLocation)reader.ReadByte(); this.wBkgMode = (BackgroundMode)reader.ReadByte(); this.rgb = new RGBColor(reader.ReadInt32(), RGBColor.ByteOrder.RedFirst); reader.ReadBytes(16); // rerserved ushort flags = reader.ReadUInt16(); this.fAutoCo = Utils.BitmaskToBool(flags, 0x1); this.fAutoMode = Utils.BitmaskToBool(flags, 0x2); this.rot = (TextRotation)Utils.BitmaskToInt(flags, 0x1C); this.fAutoRot = Utils.BitmaskToBool(flags, 0x10); this.iReadingOrder = (ReadingOrder)Utils.BitmaskToInt(flags, 0xC000); this.icv = reader.ReadUInt16(); this.trot = reader.ReadUInt16(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _capture = new VideoCapture(); _videoTimer = new DispatcherTimer(); _videoTimer.Tick += VideoTimerTick; _videoTimer.Interval = new TimeSpan(0, 0, 0, 0, 30); _videoTimer.Start(); _mouseOverTimer = new DispatcherTimer(); _mouseOverTimer.Tick += MauseOverTimer_Tick; _mouseOverTimer.Interval = new TimeSpan(0, 0, 0, 0, MillisecondsPerTick); SelectedColorRectangle.Fill = _selectedBrush; SelectedModeTextBox.Text = _mode.ToString(); _currentBackgroundMode = BackgroundMode.Camera; _detectionEnabled = false; _minHsv = handDetection.hsv_min; _maxHsv = handDetection.hsv_max; SizeTextBlock.Text = "Size: " + _strokeThickness; _detectorThread = new Thread(handDetection.Run); _detectorThread.SetApartmentState(ApartmentState.STA); _detectorThread.Start(); handDetection.HandDetectorEvent += OnActionChanged; }
private void DrawBackground(BackgroundMode background) { if (background == BackgroundMode.bmNone) { return; } bool bgImage = ((BackgroundImage != null) && (background == BackgroundMode.bmAny || background == BackgroundMode.bmImage)); if (bgImage) { /*var imgRect = new Rectangle(0, 0, fImageWidth, fImageHeight); * * using (Brush textureBrush = new TextureBrush(BackgroundImage, WrapMode.Tile)) { * gfx.FillRectangle(textureBrush, imgRect); * }*/ } else { bool bgFill = (background == BackgroundMode.bmAny || background == BackgroundMode.bmImage); if (bgFill) { fRenderer.DrawRectangle(null, UIHelper.ConvertColor(BackColor), 0, 0, fModel.ImageWidth, fModel.ImageHeight); } } }
public override void RenderImage(RenderTarget target, bool forciblyCentered = false) { BackgroundMode bgMode = (target == RenderTarget.Printer) ? BackgroundMode.bmImage : BackgroundMode.bmAny; ChartDrawMode drawMode = (!forciblyCentered) ? ChartDrawMode.dmStatic : ChartDrawMode.dmStaticCentered; InternalDraw(drawMode, bgMode); }
/// <summary> /// Renders some text to a graphics device. /// </summary> /// <param name="graphics">Graphics device to render the text into.</param> /// <param name="text">Text to render.</param> /// <param name="rect">Bounding rectangle for the text to fit into.</param> /// <param name="font">Font in which the text is rendered.</param> /// <param name="color">Text color.</param> /// <param name="dtf">Formatting flags.</param> public static void DrawText(Graphics graphics, string text, Rectangle rect, Font font, Color color, DrawTextFormatFlags dtf) { IntPtr hdc = graphics.GetHdc(); try { // Font IntPtr hFont = _fontCache.GetHFont(font); IntPtr oldFont = Win32Declarations.SelectObject(hdc, hFont); // Bounding rectangle RECT rc = new RECT(rect.Left, rect.Top, rect.Right, rect.Bottom); // Color int textColor = Win32Declarations.ColorToRGB(color); int oldColor = Win32Declarations.SetTextColor(hdc, textColor); BackgroundMode oldMode = Win32Declarations.SetBkMode(hdc, BackgroundMode.TRANSPARENT); // Render the text Win32Declarations.DrawText(hdc, text, text.Length, ref rc, dtf); // Do deinit Win32Declarations.SetBkMode(hdc, oldMode); Win32Declarations.SetTextColor(hdc, oldColor); Win32Declarations.SelectObject(hdc, oldFont); } finally { graphics.ReleaseHdc(hdc); } }
public override void RenderStaticImage(Graphics gfx, OutputType outputType) { BackgroundMode bgMode = (outputType == OutputType.Printer) ? BackgroundMode.bmImage : BackgroundMode.bmAny; fRenderer.SetTarget(gfx, false); RenderStatic(bgMode); }
public MainMenu() { background = new BackgroundModeDefault(); Children = new Drawable[] { new ParallaxContainer { ParallaxAmount = 0.01f, Children = new Drawable[] { buttons = new ButtonSystem() { OnChart = delegate { Push(new ChartListing()); }, OnDirect = delegate { Push(new OnlineListing()); }, OnEdit = delegate { Push(new EditSongSelect()); }, OnSolo = delegate { Push(new PlaySongSelect()); }, OnMulti = delegate { Push(new Lobby()); }, OnTest = delegate { Push(new TestBrowser()); }, OnExit = delegate { Scheduler.AddDelayed(Exit, ButtonSystem.EXIT_DELAY); }, } } } }; }
public static object Convert(Type type, UnityEngine.Object reference, string value) { if (type.IsSubclassOf(typeof(UnityEngine.Object)) || type == typeof(UnityEngine.Object)) { return(reference); } else if (type == typeof(AColor)) { return(ColorExtension.Parse(value)); } else if (type == typeof(Vector2)) { return((object)Vector2Extension.Parse(value)); } else if (type == typeof(Vector2Int)) { Vector2 vect = Vector2Extension.Parse(value); return(new Vector2Int((int)vect.x, (int)vect.y)); } else if (type.IsSubclassOf(typeof(BackgroundMode))) { return(BackgroundMode.Parse(type, value)); } else { return(System.Convert.ChangeType(value, type)); } }
public MainMenu() { background = new BackgroundModeDefault(); Children = new Drawable[] { new ParallaxContainer { ParallaxAmount = 0.01f, Children = new Drawable[] { buttons = new ButtonSystem() { OnChart = delegate { Push(new ChartListing()); }, OnDirect = delegate { Push(new OnlineListing()); }, OnEdit = delegate { Push(new EditSongSelect()); }, OnSolo = delegate { Push(new PlaySongSelect()); }, OnMulti = delegate { Push(new Lobby()); }, OnTest = delegate { Push(new TestBrowser()); }, OnExit = delegate { Exit(); }, } } } }; }
private void DrawTab(Graphics g, int index) { Rectangle rc = GetTabRect(index); if (rc.IsEmpty) { return; } GraphicsPath gp = BuildBorderPath(rc); using ( gp ) { if (index == _activeTabIndex) { g.FillPath(GUIControls.ColorScheme.GetBrush(_colorScheme, "ResourceTypeTabs.ActiveBackground", rc, SystemBrushes.Control), gp); } else { g.FillPath(GUIControls.ColorScheme.GetBrush(_colorScheme, "ResourceTypeTabs.InactiveBackground", rc, SystemBrushes.Control), gp); Rectangle rcGradient = new Rectangle(rc.Left, rc.Bottom - 6, rc.Width, 6); g.FillRectangle(GUIControls.ColorScheme.GetBrush(_colorScheme, "ResourceTypeTabs.InactiveBackgroundBottom", rcGradient, SystemBrushes.Control), rcGradient); } g.DrawPath(GUIControls.ColorScheme.GetPen(_colorScheme, (index == _activeTabIndex) ? "PaneCaption.Border" : "ResourceTypeTabs.Border", Pens.Black), gp); } string tabText = ((TabBarTab)_tabs [index]).Text; IntPtr hdc = g.GetHdc(); try { Color clrText = (index == _activeTabIndex) ? GUIControls.ColorScheme.GetColor(_colorScheme, "ResourceTypeTabs.ActiveText", Color.Black) : GUIControls.ColorScheme.GetColor(_colorScheme, "ResourceTypeTabs.InactiveText", Color.Black); int oldColor = Win32Declarations.SetTextColor(hdc, ColorTranslator.ToWin32(clrText)); IntPtr oldFont = Win32Declarations.SelectObject(hdc, _fontHandle); BackgroundMode oldBkMode = Win32Declarations.SetBkMode(hdc, BackgroundMode.TRANSPARENT); RECT rect = Win32Declarations.RectangleToRECT(rc); Win32Declarations.DrawText(hdc, tabText, tabText.Length, ref rect, DrawTextFormatFlags.DT_CENTER | DrawTextFormatFlags.DT_VCENTER | DrawTextFormatFlags.DT_NOPREFIX | DrawTextFormatFlags.DT_END_ELLIPSIS | DrawTextFormatFlags.DT_SINGLELINE); Win32Declarations.SetBkMode(hdc, oldBkMode); Win32Declarations.SelectObject(hdc, oldFont); Win32Declarations.SetTextColor(hdc, oldColor); } finally { g.ReleaseHdc(hdc); } }
public WindowInfo(string path, ShowMode showMode, OpenAction openAct, BackgroundMode bgMode) { this.prefabPath = path; this.name = path.Substring(path.LastIndexOf('/') + 1); this.showMode = showMode; this.openAction = openAct; this.backgroundMode = bgMode; }
private void InternalDraw(ChartDrawMode drawMode, BackgroundMode background) { // drawing relative offset of tree on graphics int spx = 0; int spy = 0; if (drawMode == ChartDrawMode.dmInteractive) { var imageViewport = base.ImageViewport; spx = imageViewport.Left; spy = imageViewport.Top; fModel.VisibleArea = UIHelper.Rt2Rt(base.Viewport); } else { if (drawMode == ChartDrawMode.dmStaticCentered) { Size clientSize = CanvasRectangle.Size; if (fModel.ImageWidth < clientSize.Width) { spx += (clientSize.Width - fModel.ImageWidth) / 2; } if (fModel.ImageHeight < clientSize.Height) { spy += (clientSize.Height - fModel.ImageHeight) / 2; } } fModel.VisibleArea = ExtRect.CreateBounds(0, 0, fModel.ImageWidth, fModel.ImageHeight); } fModel.SetOffsets(spx, spy); DrawBackground(background); #if DEBUG_IMAGE using (Pen pen = new Pen(Color.Red)) { fRenderer.DrawRectangle(pen, Color.Transparent, fSPX, fSPY, fImageWidth, fImageHeight); } #endif bool hasDeep = (fSelected != null && fSelected != fModel.Root && fSelected.Rec != null); if (hasDeep && fOptions.DeepMode == DeepMode.Background) { DrawDeep(fOptions.DeepMode, spx, spy); } fRenderer.SetTranslucent(0.0f); fModel.Draw(drawMode); if (hasDeep && fOptions.DeepMode == DeepMode.Foreground) { DrawDeep(fOptions.DeepMode, spx, spy); } }
public ShowCyberInspectorAttribute( CyberObjectMode cyberObjectMode = CyberObjectMode.Expandable, BackgroundMode backgroundMode = BackgroundMode.None, bool nameIn = false) { NameIn = nameIn; CyberObjectMode = cyberObjectMode; BackgroundMode = backgroundMode; }
protected override void OnPaint(PaintEventArgs e) { // Paint background if (BackColor != Color.Transparent) { using (Brush brush = new SolidBrush(BackColor)) e.Graphics.FillRectangle(brush, ClientRectangle); } base.OnPaint(e); // Paint foreground IntPtr hdc = e.Graphics.GetHdc(); try { IntPtr hFont = _fontCache.GetHFont(_underline ? _underlineFont : Font); IntPtr oldFont = Win32Declarations.SelectObject(hdc, hFont); RECT rc = new RECT(0, 0, Bounds.Width, Bounds.Height); int textColor = Enabled ? Win32Declarations.ColorToRGB(ForeColor) : Win32Declarations.ColorToRGB(SystemColors.GrayText); int oldColor = Win32Declarations.SetTextColor(hdc, textColor); BackgroundMode oldMode = Win32Declarations.SetBkMode(hdc, BackgroundMode.TRANSPARENT); int postfixLeft = 0; if (_postfixText.Length > 0) { Win32Declarations.DrawText(hdc, Text, Text.Length, ref rc, GetTextFormatFlags() | DrawTextFormatFlags.DT_CALCRECT); postfixLeft = rc.right; } Win32Declarations.DrawText(hdc, Text, Text.Length, ref rc, GetTextFormatFlags()); if (_postfixText.Length > 0) { Win32Declarations.SetTextColor(hdc, ColorTranslator.ToWin32(Color.Black)); if (_underline) { Win32Declarations.SelectObject(hdc, _fontCache.GetHFont(Font)); } rc.left = postfixLeft; rc.right = Bounds.Width; Win32Declarations.DrawText(hdc, _postfixText, _postfixText.Length, ref rc, GetTextFormatFlags()); } Win32Declarations.SetBkMode(hdc, oldMode); Win32Declarations.SetTextColor(hdc, oldColor); Win32Declarations.SelectObject(hdc, oldFont); } finally { e.Graphics.ReleaseHdc(hdc); } }
protected override void OnDrawItem(DrawItemEventArgs e) { base.OnDrawItem(e); e.DrawBackground(); object obj = (e.Index >= 0) ? Items [e.Index] : null; IResource res = obj as IResource; int textOffset = 0; // don't apply indent when drawing the item in the combo box itself - // only for drop-down items if (e.Bounds.X != 3 && e.Bounds.Y != 3) { if (obj != null && _resourceIndents.Contains(obj)) { textOffset = (int)_resourceIndents [obj]; } } string text = null; if (res != null) { int imageIndex = Core.ResourceIconManager.GetIconIndex(res); if (imageIndex >= 0 && imageIndex < Core.ResourceIconManager.ImageList.Images.Count) { Core.ResourceIconManager.ImageList.Draw(e.Graphics, e.Bounds.X + textOffset, e.Bounds.Y, imageIndex); textOffset += 18; } text = res.DisplayName; } else if (obj != null) { text = obj.ToString(); textOffset += 2; } else { text = ""; } IntPtr hdc = e.Graphics.GetHdc(); try { RECT rc = new RECT(e.Bounds.Left + textOffset, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom); int oldColor = Win32Declarations.SetTextColor(hdc, Win32Declarations.ColorToRGB(e.ForeColor)); BackgroundMode oldMode = Win32Declarations.SetBkMode(hdc, BackgroundMode.TRANSPARENT); Win32Declarations.DrawText(hdc, text, text.Length, ref rc, DrawTextFormatFlags.DT_NOPREFIX); Win32Declarations.SetBkMode(hdc, oldMode); Win32Declarations.SetTextColor(hdc, oldColor); } finally { e.Graphics.ReleaseHdc(hdc); } }
private void btnGetImages_Click(object sender, EventArgs e) { if (bw.IsBusy) { MessageBox.Show("Task already running !", "Warning"); return; } if (!Directory.Exists(dataPathWork)) { ShowError("No data found. Run the Extract jar before"); return; } if (!int.TryParse(txtPixelsW.Text, out pixelsWidth)) { ShowError("Invalid value for Pixel X"); return; } if (!int.TryParse(txtPixelsH.Text, out pixelsHeight)) { ShowError("Invalid value for Pixel Y"); return; } indexRnd = chbRnd.Checked; if (!indexRnd) { if (!int.TryParse(txtImgIndex.Text, out defaultIndex)) { ShowError("Invalid value for default index. Must be an integer between 1 and 20"); return; } if (defaultIndex < 1 || defaultIndex > maxImagePerPage) { ShowError("Invalid value for default index. Must be an integer between 1 and 20"); return; } defaultIndex--; } mode = (ResizeMode)cbResizeMode.SelectedIndex; tagEnabled = chbTag.Checked; tag = txtTag.Text; pbStatus.Value = 0; transOnly = chbTrans.Checked; backgroundMode = (BackgroundMode)cbBackground.SelectedIndex; queryTags = txtTags.Text; if (folders.Count == 0) { btnUpdate.PerformClick(); } // Run worker bw.RunWorkerAsync(1); }
public void DrawGroup(IGrouping <string, MemberInfo> groups) { BackgroundMode mode = BackgroundMode.Box; if (TheEditor.DrawBeforeGroup <CustomBackgrounGroupDrawer>(groups.Key) != null) { mode = BackgroundMode.None; } CyberEdit.Current.DrawBasicGroup(groups, mode); TheEditor.DrawAfteGroup <CustomBackgrounGroupDrawer>(groups.Key); }
/// <summary> /// Draws the formatted string on a given graphics /// </summary> /// <param name="hdc">The device context to draw the string in.</param> /// <param name="parameters">Text formatting parameters</param> /// <exception cref="ArgumentNullException"><i>g</i> is null</exception> /// <exception cref="ArgumentNullException"><i>font</i> is null</exception> public int Draw(IntPtr hdc, Rectangle rect, RichTextParameters parameters) { Font hFont = GetParametrizedFont(parameters); RECT rc = new RECT(); rc.left = rect.Left; rc.top = rect.Top; rc.bottom = rect.Bottom; RectangleF bounds; IntPtr oldFont = Win32Declarations.SelectObject(hdc, ourFontCache.GetHFont(hFont)); int oldColor = Win32Declarations.SetTextColor(hdc, Win32Declarations.ColorToRGB(myStyle.ForegroundColor)); int oldBkColor = Win32Declarations.SetBkColor(hdc, Win32Declarations.ColorToRGB(myStyle.BackgroundColor)); BackgroundMode oldBkMode = Win32Declarations.SetBkMode(hdc, myStyle.BackgroundColor == Color.Transparent ? BackgroundMode.TRANSPARENT : BackgroundMode.OPAQUE); Win32Declarations.DrawText(hdc, PartText, PartText.Length, ref rc, DrawTextFormatFlags.DT_CALCRECT | DrawTextFormatFlags.DT_SINGLELINE | DrawTextFormatFlags.DT_NOPREFIX | DrawTextFormatFlags.DT_VCENTER | DrawTextFormatFlags.DT_NOCLIP); if (rc.bottom > rect.Bottom) { rc.bottom = rect.Bottom; } if (rc.right > rect.Right) { rc.right = rect.Right; } bounds = new RectangleF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); Win32Declarations.DrawText(hdc, PartText, PartText.Length, ref rc, DrawTextFormatFlags.DT_SINGLELINE | DrawTextFormatFlags.DT_NOPREFIX | DrawTextFormatFlags.DT_VCENTER | DrawTextFormatFlags.DT_NOCLIP); Win32Declarations.SetBkMode(hdc, oldBkMode); Win32Declarations.SetBkColor(hdc, oldBkColor); Win32Declarations.SetTextColor(hdc, oldColor); Win32Declarations.SelectObject(hdc, oldFont); switch (myStyle.Effect) { case TextStyle.EffectStyle.StrikeOut: StrikeOut(hdc, bounds); break; case TextStyle.EffectStyle.StraightUnderline: UnderlineStraight(hdc, bounds); break; case TextStyle.EffectStyle.WeavyUnderline: UnderlineWeavy(hdc, bounds); break; } return(rc.right - rc.left); }
/// <summary> /// Set the backmode in the selected DC /// </summary> /// <param name="hdc"></param> /// <param name="iBkMode"></param> /// <returns></returns> public static BackgroundMode SetBkMode(IntPtr hdc, BackgroundMode iBkMode) { int prevMode; OpenNETCF.Win32.Core.CheckHandle(hdc); prevMode = SetBkModeCE(hdc, (int)iBkMode); if (prevMode == 0) { throw new WinAPIException("Failed to set BackgroundMode"); } return((BackgroundMode)prevMode); }
public MainWindow() { InitializeComponent(); SaverSettings.Refresh(); mailSend.Text = cfg.recipientOfLetters; //TimePicker.SelectedTime = new DataGridViewCellToolTipTextNeededEventArgs,e; // фоновый режим BackgroundMode.Start(Purser.Start, UseDB.GetList, UseDB.AddRange, SendMail.Send); // иконка в трее IconTray.InitializeNotifyIcon(this, "tree.ico", new ToolStripItem[] { }); }
private void ChangeBackgroundMethod() { if (_currentBackgroundMode == BackgroundMode.Camera) { _currentBackgroundMode = BackgroundMode.White; Canvas.Background = Brushes.White; return; } if (_currentBackgroundMode == BackgroundMode.White) { _currentBackgroundMode = BackgroundMode.Camera; return; } }
/// <summary> /// Set the backmode in the selected DC /// </summary> /// <param name="hdc"></param> /// <param name="iBkMode"></param> /// <returns></returns> public static BackgroundMode SetBkMode(IntPtr hdc, BackgroundMode iBkMode) { int prevMode; CheckHandle(hdc); prevMode = SetBkModeCE(hdc, (int)iBkMode); if (prevMode == 0) { throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error(), "Failed to set BackgroundMode"); } return((BackgroundMode)prevMode); }
public void DrawGroup(IGrouping <string, MemberInfo> groups, string[] usedFolder) { BackgroundMode mode = BackgroundMode.None; EditorGUILayout.BeginHorizontal(); CyberEdit.Current.PushHorizontalStack(); if (TheEditor.DrawBeforeGroup <CustomBackgrounGroupDrawer>(groups.Key) != null) { mode = BackgroundMode.None; } CyberEdit.Current.DrawBasicGroup(groups, mode, usedGroup: usedFolder, drawPrefix: false); TheEditor.DrawAfteGroup <CustomBackgrounGroupDrawer>(groups.Key); EditorGUILayout.EndHorizontal(); CyberEdit.Current.PopHorizontalStack(); }
private Bitmap ConvertBitmap(Bitmap original, BackgroundMode mode) { switch (mode) { case BackgroundMode.None: return(original.Copy()); case BackgroundMode.Blur: return(original.Blur(3)); case BackgroundMode.Pixelate: return(original.Pixelate(3)); case BackgroundMode.Dark: return(original.Dark()); case BackgroundMode.BlackAndWhite: return(original.BlackAndWhite()); case BackgroundMode.Grayscale: return(original.Grayscale()); default: return(original.Copy()); } }
public void DrawGroup(IGrouping <string, MemberInfo> groupToDraw, string[] usedFolder) { FieldInfo first = groupToDraw.First() as FieldInfo; SerializedProperty firstProp = CyberEdit.Current.GetPropByName(first.Name); bool any = (TheEditor.DrawBeforeGroup <CustomBackgrounGroupDrawer>(groupToDraw.Key)) != null; BackgroundMode mode = any ? BackgroundMode.None :(BackgroundMode.Box); TheEditor.BeginVertical(mode); CyberEdit.Current.DrawProperty(first); Rect rect = EditorGUILayout.GetControlRect(false, 0); rect = new Rect(rect.x, rect.y - 20, rect.width, 20); bool[] good = (from item in groupToDraw.Skip(1) let attribute = item.GetCustomAttribute <ExtendetFoldoutGroupAttribute>() select TheEditor.CheckEquals(firstProp, attribute.Value, attribute.Equaler)).ToArray(); if (good.Contains(true)) { bool isFoldout = firstProp.isExpanded = EditorGUI.Foldout(rect, firstProp.isExpanded, new string(' ', 100), true); if (isFoldout) { EditorGUI.indentLevel++; foreach (MemberInfo item in groupToDraw.Skip(1)) { ExtendetFoldoutGroupAttribute currentElementAttribute = item.GetCustomAttribute <ExtendetFoldoutGroupAttribute>(); if (TheEditor.CheckEquals(firstProp, currentElementAttribute.Value, currentElementAttribute.Equaler)) { CyberEdit.Current.DrawMember(item); } } EditorGUI.indentLevel--; } TheEditor.DrawAfteGroup <CustomBackgrounGroupDrawer>(groupToDraw.Key); } TheEditor.EndVertical(mode); }
public Text(IStreamReader reader, RecordType id, UInt16 length) : base(reader, id, length) { // assert that the correct record type is instantiated Debug.Assert(this.Id == ID); // initialize class members from stream this.at = (HorizontalAlignment)reader.ReadByte(); this.vat = (VerticalAlignment)reader.ReadByte(); this.wBkgMode = (BackgroundMode)reader.ReadUInt16(); this.rgbText = new RGBColor(reader.ReadInt32(), RGBColor.ByteOrder.RedFirst); this.x = reader.ReadInt32(); this.y = reader.ReadInt32(); this.dx = reader.ReadInt32(); this.dy = reader.ReadInt32(); UInt16 flags = reader.ReadUInt16(); this.fAutoColor = Utils.BitmaskToBool(flags, 0x1); this.fShowKey = Utils.BitmaskToBool(flags, 0x2); this.fShowValue = Utils.BitmaskToBool(flags, 0x4); // 0x8 is unused this.fAutoText = Utils.BitmaskToBool(flags, 0x10); this.fGenerated = Utils.BitmaskToBool(flags, 0x20); this.fDeleted = Utils.BitmaskToBool(flags, 0x40); this.fAutoMode = Utils.BitmaskToBool(flags, 0x80); // 0x100, 0x200, 0x400 are unused this.fShowLabelAndPerc = Utils.BitmaskToBool(flags, 0x800); this.fShowPercent = Utils.BitmaskToBool(flags, 0x1000); this.fShowBubbleSizes = Utils.BitmaskToBool(flags, 0x2000); this.fShowLabel = Utils.BitmaskToBool(flags, 0x4000); //0x8000 is reserved this.icvText = reader.ReadUInt16(); UInt16 values = reader.ReadUInt16(); this.dlp = Utils.BitmaskToInt(values, 0xF); this.iReadingOrder = (ReadingOrder)Utils.BitmaskToInt(values, 0xC000); this.trot = reader.ReadUInt16(); // assert that the correct number of bytes has been read from the stream Debug.Assert(this.Offset + this.Length == this.Reader.BaseStream.Position); }
public static extern BackgroundMode SetBkMode(HDC hdc, BackgroundMode mode);
public override bool Equals(BackgroundMode other) { return(base.Equals(other) && beatmap == ((BackgroundModeBeatmap)other).Beatmap); }
/// <summary> /// Sets the background mode for the session. /// Make sure to choose the appropriate background mode for a better hand detection. /// </summary> /// <param name="newMode">Requires a background mode.</param> internal void SetBackgroundMode(BackgroundMode newMode) { manomotion_Session.background_mode = newMode; }
public override bool Equals(BackgroundMode other) { return base.Equals(other) && textureName == ((BackgroundModeCustom)other).textureName; }
/// <summary> /// Set the backmode in the selected DC /// </summary> /// <param name="hdc"></param> /// <param name="iBkMode"></param> /// <returns></returns> public static BackgroundMode SetBkMode(IntPtr hdc, BackgroundMode iBkMode) { int prevMode; OpenNETCF.Win32.Core.CheckHandle(hdc); prevMode = SetBkModeCE(hdc, (int)iBkMode); if(prevMode == 0) { throw new WinAPIException("Failed to set BackgroundMode"); } return (BackgroundMode)prevMode; }
public static extern BackgroundMode SetBkMode( IntPtr hdc, BackgroundMode iBkMode );
public override bool Equals(BackgroundMode other) { return base.Equals(other) && beatmap == ((BackgroundModeBeatmap)other).Beatmap; }
public static extern int SetBkMode(IntPtr hDC, BackgroundMode mode);
public void SetMode(BackgroundMode aMode) { if (aMode != _currentMode) { //detach if (_currentMode == BackgroundMode.Color) { _needColor = false; } else if (_currentMode == BackgroundMode.Infrared) { _needInfrared = false; } else if (_currentMode == BackgroundMode.BodyIndex) { _needBodyIndex = false; } else { Debug.WriteLine("LiveBackground - ERROR - Unknown background mode"); } _currentMode = aMode; if (_currentMode == BackgroundMode.Color) { _needColor = true; } else if (_currentMode == BackgroundMode.Infrared) { _needInfrared = true; } else if (_currentMode == BackgroundMode.BodyIndex) { _needBodyIndex = true; } else { Debug.WriteLine("LiveBackground - ERROR - Unknown background mode"); } } }
private FrameDescription GetFrameDescriptionForMode(BackgroundMode aMode) { FrameDescription result = null; if (aMode == BackgroundMode.Color) { result = _kinectManager.KinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra); } else if (aMode == BackgroundMode.Infrared) { result = _kinectManager.KinectSensor.InfraredFrameSource.FrameDescription; } else if (aMode == BackgroundMode.BodyIndex) { result = _kinectManager.KinectSensor.BodyIndexFrameSource.FrameDescription; } else { Debug.WriteLine("LiveBackground - ERROR - Unknown background mode for get frame description"); } return result; }