private void DrawWithChildren(DrawInfo drawInfo) { children.RemoveExpired(); lock (syncRoot) { children.AddPending(); } children.CheckZOrder(); hasChildren = children.Items.Count > 0; PreDraw(drawInfo); int index = 0; List <Graphic> children2 = children.Items; for (; index < children2.Count && children2[index].ZOrder < this.ZOrder; ++index) { Gl.glPushMatrix(); children2[index].Draw(drawInfo); Gl.glPopMatrix(); } drawable.Draw(drawInfo, drawableState); for (; index < children2.Count; ++index) { Gl.glPushMatrix(); children2[index].Draw(drawInfo); Gl.glPopMatrix(); } PostDraw(drawInfo); }
// For GraphicalWatch public static bool Draw(Graphics graphics, IDrawable drawable, Geometry.Traits traits, Settings settings, Colors colors) { if (drawable == null) { return(false); } if (traits != null && traits.CoordinateSystem == Geometry.CoordinateSystem.SphericalPolar) { throw new Exception("This coordinate system is not yet supported."); } if (settings.color == Color.Empty) { settings.color = DefaultColor(drawable, colors); } Geometry.Box aabb = drawable.Aabb(traits, true); if (aabb.IsValid()) { Geometry.Unit unit = (traits != null) ? traits.Unit : Geometry.Unit.None; bool fill = (traits == null); Drawer.DrawAxes(graphics, aabb, unit, colors, fill); drawable.Draw(aabb, graphics, settings, traits); } return(true); }
public Matrix <char> Draw(Matrix <char> canvas) { if (maze.IsActive()) { canvas = maze.Draw(canvas); } foreach (IDrawable item in items) { if (item.IsActive()) { canvas = item.Draw(canvas); } } foreach (IDrawable door in doors) { if (door.IsActive()) { canvas = door.Draw(canvas); } } if (player.IsActive()) { canvas = player.Draw(canvas); } return(canvas); }
protected virtual void OnGUI() { if (drawableObject != null) { drawableObject.Draw(); } }
public void Draw(RLConsole mapConsole, RLConsole statConsole) { foreach (Cell cell in this.GetAllCells()) { this.SetConsoleSymbolForCell(mapConsole, cell); } int i = 0; foreach (MonsterDTO monster in this.Monsters) { var orc = (OrcDTO)monster; orc.Draw(mapConsole, this); if (this.IsInFov(orc.X, orc.Y)) { orc.DrawStats(statConsole, i); i++; } } foreach (TreasurePile treasurePile in this.treasurePiles) { IDrawable drawableTreasure = treasurePile.Treasure as IDrawable; drawableTreasure?.Draw(mapConsole, this); } foreach (TunelDTO tunel in this.Tunels) { tunel.Door.Draw(mapConsole, this); } }
// ReSharper disable once UnusedMember.Local // ReSharper disable once InconsistentNaming private void OnGUI() { if (AnyNull) { Initialize(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUI.skin.box); if (GUILayout.Button("Generate DLL")) { AssetDatabase.SaveAssets(); DllGenerator.Execute(EnumerableCollectionProcessor, ExtensionMethodGenerators, Dependencies); Close(); } whetherToIncludeEnumerableOrNotView.Draw(ref scrollPosition); whetherToUseApiOrNotView.Draw(ref scrollPosition); { var enable = EditorGUILayout.ToggleLeft("Enable Null Check", settings.EnableNullCheckOnRuntime, "button"); if (enable ^ settings.EnableNullCheckOnRuntime) { settings.EnableNullCheckOnRuntime = enable; EditorUtility.SetDirty(settings); } } EditorGUILayout.EndScrollView(); }
public static void CallDrawing(IDrawable drawableElement, GPUContext context, RenderTarget output, RenderTarget depthBuffer, ref Matrix viewProjection) { if (context == null || output == null || drawableElement == null) { throw new ArgumentNullException(); } if (depthBuffer != null) { if (!depthBuffer.IsAllocated) { throw new InvalidOperationException("Depth buffer is not allocated. Use RenderTarget.Init before rendering."); } if (output.Size != depthBuffer.Size) { throw new InvalidOperationException("Output buffer and depth buffer dimensions must be equal."); } } #if UNIT_TEST_COMPILANT throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set."); #else if (Internal_DrawBegin2(context.unmanagedPtr, output.unmanagedPtr, Object.GetUnmanagedPtr(depthBuffer), ref viewProjection)) { throw new InvalidOperationException("Cannot perform GUI rendering."); } try { drawableElement.Draw(); } finally { Internal_DrawEnd(); } #endif }
public override void Draw() { G.PushMatrix(); G.SetTransform(this.Position, this.Orientation); bxt.Draw(); G.PopMatrix(); }
/// <summary> /// Calls drawing GUI to the texture using custom View*Projection matrix. /// If depth buffer texture is provided there will be depth test performed during rendering. /// </summary> /// <param name="drawableElement">The root container for Draw methods.</param> /// <param name="context">The GPU context to handle graphics commands.</param> /// <param name="output">The output render target.</param> /// <param name="depthBuffer">The depth buffer render target. It's optional parameter but if provided must match output texture.</param> /// <param name="viewProjection">The View*Projection matrix used to transform all rendered vertices.</param> public static void CallDrawing(IDrawable drawableElement, GPUContext context, GPUTexture output, GPUTexture depthBuffer, ref Matrix viewProjection) { if (context == null || output == null || drawableElement == null) { throw new ArgumentNullException(); } if (depthBuffer != null) { if (!depthBuffer.IsAllocated) { throw new InvalidOperationException("Depth buffer is not allocated. Use GPUTexture.Init before rendering."); } if (output.Size != depthBuffer.Size) { throw new InvalidOperationException("Output buffer and depth buffer dimensions must be equal."); } } Begin(context, output, depthBuffer, ref viewProjection); try { drawableElement.Draw(); } finally { End(); } }
/// <summary> /// Draws out the particle with the given drawable at the /// particle's position. /// </summary> public void Draw(IDrawable drawable, DrawingArgs args) { double ratio = secondsRemaining / Constants.MaxSwarmParticleLife; Color c = Color.FromArgb((int) (ratio * 255.0), Color.White); PointF p = new PointF(CurrentX, CurrentY); drawable.Draw(p, c, args.BackendDrawingArgs); }
/// <returns>false if drawing should stop after this object, true if drawing should continue</returns> public virtual bool DrawChild(Rectangle view, SpriteBatch spriteBatch, GameTime gameTime, IDrawable child, int index) { bool ret = GetRectangleFor(ref view, child, index); child.Draw(view, spriteBatch, gameTime); return(ret); }
static void Main(string[] args) { Console.WriteLine("***** Fun with Interface Inheritance *****"); Console.WriteLine("\n-> Using SuperImage"); SuperImage si = new SuperImage(); // Get IDrawable. IDrawable itfDraw = (IDrawable)si; itfDraw.Draw(); // Now get IMetaFileRender which exposes all methods up // the chain of inheritance. if (itfDraw is IMetaFileRender) { IMetaFileRender itfMF = (IMetaFileRender)itfDraw; itfMF.Render(); itfMF.Print(); } Console.WriteLine("\n-> Using JamesBondCar"); JamesBondCar j = new JamesBondCar(); j.Drive(); j.TurboBoost(); j.Dive(); Console.ReadLine(); }
protected void DrawCursor(IDrawable cursorPatch, Graphics graphics, BitmapFont font, float x, float y) { cursorPatch.Draw(graphics, x + textOffset + glyphPositions[cursor] - glyphPositions[visibleTextStart] + fontOffset - 1 /*font.getData().cursorX*/, y - font.Padding.Bottom / 2, cursorPatch.MinWidth, textHeight, color); }
static void Main(string[] args) { Console.WriteLine("***** Simple Interface Hierarchy *****"); // Call from object level. Console.WriteLine("Using bitmap uses IAdvancedDrawable implements IDrawable"); BitmapImage bitmap = new BitmapImage(); bitmap.Draw(); bitmap.DrawInBoundingBox(10, 10, 100, 150); bitmap.DrawUpsideDown(); // Call as IDrawable Console.WriteLine("Using drawableItem = bitmap as IDrawable"); IDrawable drawableItem = bitmap as IDrawable; drawableItem.Draw(); // Call as IAdvancedDrawable Console.WriteLine("Using advancedDrawableItem = bitmap as IAdvancedDrawable"); IAdvancedDrawable advancedDrawableItem = bitmap as IAdvancedDrawable; advancedDrawableItem.DrawUpsideDown(); Console.ReadLine(); }
public void DrawFigure(IDrawable figure, IRenderer renderer) { if (figure != null) { figure.Draw(renderer); } }
private static Image CreateFrame(IDrawable watchFace, Bitmap[] resources, WatchState state, Size size) { var preview = new Bitmap(size.Width, size.Height, format: System.Drawing.Imaging.PixelFormat.Format32bppArgb); var graphics = Graphics.FromImage(preview); watchFace.Draw(graphics, resources, state); return(preview); }
public static void Draw(this Graphics g, IDrawable drawable) { if (drawable != null) { drawable.Draw(g); g.ResetTransform(); } }
/// <summary> /// Draws out the particle with the given drawable at the /// particle's position. /// </summary> public void Draw(IDrawable drawable, DrawingArgs args) { double ratio = secondsRemaining / Constants.MaxSwarmParticleLife; Color c = Color.FromArgb((int)(ratio * 255.0), Color.White); PointF p = new PointF(CurrentX, CurrentY); drawable.Draw(p, c, args.BackendDrawingArgs); }
private static Image CreateFrame(IDrawable watchFace, Bitmap[] resources, WatchState state) { var preview = new Bitmap(176, 176); var graphics = Graphics.FromImage(preview); watchFace.Draw(graphics, resources, state); return(preview); }
public void Draw() { Background.Draw(); foreach (var text in _textDrawables) { text?.Draw(); } }
private void GlControl_Paint(object sender, PaintEventArgs e) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); CurrentEvent.Draw(); GL.Flush(); }
public void Draw(IDrawable drawable) { if (_window == null) { return; } drawable.Draw(_window.CommandList); }
static void Main(string[] args) { Gamemap gamemap = new Gamemap(); IDrawable d = gamemap; d.Draw(); Console.ReadKey(); }
private void OnAnchorPointChanged(object sender, IndexEventArgs e) { IDrawable reslicedResult = this.Reslice(); if (reslicedResult != null) { reslicedResult.Draw(); } }
public void Draw(Graphics graphics) { var dx = _currentDrawableSize.Width * _relativePosition.X; var dy = _currentDrawableSize.Height * _relativePosition.Y; graphics.TranslateTransform(dx, dy); SourceDrawable.Draw(graphics); graphics.TranslateTransform(-dx, -dy); }
public override void Update(D3D11Device device) { SetRenderTarget(device); if (_drawable != null) { _drawable.Update(device); _drawable.Draw(device, 0, 0); } }
/// <summary> /// Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable. /// </summary> /// <param name="batcher">Batcher.</param> /// <param name="parentAlpha">Parent alpha.</param> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> protected void DrawBackground(Batcher batcher, float parentAlpha, float x, float y) { if (_background == null) { return; } _background.Draw(batcher, x, y, GetWidth(), GetHeight(), ColorExt.Create(color, (int)(color.A * parentAlpha))); }
/// <summary> /// Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable. /// </summary> /// <param name="graphics">Graphics.</param> /// <param name="parentAlpha">Parent alpha.</param> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> protected void DrawBackground(Graphics graphics, float parentAlpha, float x, float y) { if (_background == null) { return; } _background.Draw(graphics, x, y, GetWidth(), GetHeight(), new Color(color, (int)(color.A * parentAlpha))); }
private void ButtonMove_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < DrawableObjects.Count; i++) { IDrawable x = DrawableObjects[i].MoveTo(DrawableObjects[i].Position.X + 10, DrawableObjects[i].Position.Y + 10); DrawableObjects[i] = x; x.Draw(); } }
private void DrawModel(ref Matrix4 view, ref Matrix4 projection) { mDefaultShader.Use(); mDefaultShader.SetUniform("uView", view); mDefaultShader.SetUniform("uProjection", projection); mDefaultShader.SetUniform("uViewPosition", mCamPosition); mDefaultShader.SetUniform("uLightPosition", mCamPosition); mModel.Draw(mDefaultShader); }
/// <summary> /// Forces the <see cref="ProgressGraphic"/> to remove and dispose itself immediately. /// </summary> /// <remarks> /// Calling this method will invoke <see cref="IDrawable.Draw"/> on the scene graph, so do not call this method from a drawing operation. /// </remarks> public void Close() { if (base.ParentGraphic != null) { IDrawable parent = base.ParentGraphic; ((CompositeGraphic)base.ParentGraphic).Graphics.Remove(this); parent.Draw(); } this.Dispose(); }
public static void Draw(IDrawable obj) { obj.Draw(); }
public void Draw(IDrawable renderable) { renderable.Draw(this); }
// TODO: We need a parameter here because not all the views are games // we need to extend the concept of view to include Widgets public bool CreateImage(IDrawable drawable, string file) { Cairo.ImageSurface cairo_image = null; gbrainy.Core.Main.CairoContextEx cr = null; try { file = Path.GetFullPath (file); cairo_image = new Cairo.ImageSurface (Cairo.Format.ARGB32, IMAGE_WIDTH, IMAGE_HEIGHT); cr = new gbrainy.Core.Main.CairoContextEx (cairo_image, "sans 12", 96); // Draw Image drawable.Draw (cr, IMAGE_WIDTH, IMAGE_WIDTH, false); cairo_image.WriteToPng (file); if (File.Exists (file) == false) Logger.Error ("Game.CreateImage. Error writting {0}", file); else Logger.Debug ("Game.CreateImage. Wrote image {0}", file); } catch (Exception e) { Logger.Error ("Game.CreateImage. Error writting {0} {1}", file, e); return false; } finally { if (cr != null) ((IDisposable) cr).Dispose (); if (cairo_image != null) ((IDisposable) cairo_image).Dispose (); } return true; }
public static void Draw(IDrawable obj, Object surface) { obj.Draw(surface); }
public Clock() { InitializeComponent(); InitializeMenu(); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); _mathService = new MathService(ClientRectangle); _background = new Background(Properties.Settings.Default.backgroundColor); _hands = new Hands(_mathService, new DateTimeService(), Properties.Settings.Default.handColor); _numerals = new Numerals(_mathService, Properties.Settings.Default.foreColor); _ticks = new Tick(_mathService, Properties.Settings.Default.tickColor); _center = new Center(_mathService, Properties.Settings.Default.handColor); _resizeGrip = new ResizeGrip(_mathService); if (!Properties.Settings.Default.lastWindowSize.IsEmpty) { Size = Properties.Settings.Default.lastWindowSize; } if (!Properties.Settings.Default.lastWindowLocation.IsEmpty) { Location = Properties.Settings.Default.lastWindowLocation; } MouseDown += (object o, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { Win32.NativeMethods.ReleaseCapture(); Win32.NativeMethods.SendMessage(Handle, Win32.Constants.WM_NCLBUTTONDOWN, Win32.Constants.HTCAPTION, 0); } }; ResizeBegin += (o, e) => { _timer.Stop(); }; ResizeEnd += (o, e) => { _timer.Start(); }; Resize += (o, e) => { _mathService.Rectangle = ClientRectangle; }; Properties.Settings.Default.PropertyChanged += (o, e) => { _hands.Color = Properties.Settings.Default.handColor; _numerals.Color = Properties.Settings.Default.foreColor; _ticks.Color = Properties.Settings.Default.tickColor; _background.Color = Properties.Settings.Default.backgroundColor; _center.Color = Properties.Settings.Default.handColor; _resizeGrip.Color = Properties.Settings.Default.backgroundColor; Invalidate(); }; Paint += (object o, PaintEventArgs e) => { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; _graphicsService.Graphics = e.Graphics; _background.Draw(_graphicsService); _hands.Draw(_graphicsService); _numerals.Draw(_graphicsService); _ticks.Draw(_graphicsService); _center.Draw(_graphicsService); _resizeGrip.Draw(_graphicsService); }; FormClosing += (o, e) => { Properties.Settings.Default.lastWindowLocation = Location; Properties.Settings.Default.lastWindowSize = Size; Properties.Settings.Default.Save(); }; OnResize(EventArgs.Empty); _timer = new Timer(); _timer.Interval = 1000; _timer.Tick += (o, e) => { Invalidate(); }; _timer.Start(); }