protected internal override void Render(Graphics graphics, IRender render) { if (GetPathInternal() == null) { return; } //Translate by offset graphics.TranslateTransform(mOffset.X, mOffset.Y); //Fill and draw the port RenderPort(graphics, render); //Render image if (Image != null) { Image.Render(graphics, render); } //Render label if (Label != null) { Label.Render(graphics, render); } graphics.TranslateTransform(-mOffset.X, -mOffset.Y); }
public void RenderShapes(IRender render, IGame game) { var shape = game.ShapeInPlay; try { var shapeGridWidth = shape.ShapeGrid.GetLength(0); for (int i = 0; i < shapeGridWidth; i++) { for (int j = 0; j < shapeGridWidth; j++) { if (shape.ShapeGrid[i, j]) { render.Draw(i + shape.GameGridXPosition, j + shape.GameGridYPosition, shape.ShapeColor); } } } foreach (var block in game.GameGrid.Blocks) { render.Draw(block.X, block.Y, block.ShapeColor); } } catch (NullReferenceException) { } }
public Frame(IRender content, BorderType border) { fill = content == null; this.content = content; borderType = border; this.border = BoxArt.Border[border]; }
/// <summary> /// Constructor. /// </summary> /// <remarks>Every initial values come from <see cref="Constants.Player"/>.</remarks> internal Player() : base( 0, Constants.Player.INITIAL_X, Constants.Player.INITIAL_Y, Constants.Player.SPRITE_WIDTH, Constants.Player.SPRITE_HEIGHT, Constants.Player.MAXIMAL_LIFE_POINTS, Constants.Player.HIT_LIFE_POINT_COST, Constants.Player.INITIAL_SPEED, Constants.Player.RECOVERY_TIME, nameof(Filename.Player), nameof(Filename.PlayerRecovery), Direction.Right) { NewScreenEntrance = null; Inventory = new Inventory(); SwordHitSprite = null; _hitElapser = null; _currentWeaponHitDelay = Constants.Player.SWORD_HIT_DELAY; _movementTimeManager = new Elapser(this, ElapserUse.PlayerMovement); _renderShield = DefaultRender.BasicImage(this, nameof(Filename.PlayerShield)); _renderRecoveryShield = DefaultRender.AnimatedBasicImage(this, nameof(Filename.PlayerRecoveryShield), ElapserUse.LifeSpriteRecovery, Constants.RECOVERY_BLINK_DELAY); _renderSword = DefaultRender.BasicImage(this, nameof(Filename.PlayerSword)); _renderRecoverySword = DefaultRender.AnimatedBasicImage(this, nameof(Filename.PlayerRecoverySword), ElapserUse.LifeSpriteRecovery, Constants.RECOVERY_BLINK_DELAY); }
protected internal override void Render(Graphics graphics, IRender render) { //Render this shape base.Render(graphics, render); Region current = null; //Set up clipping if required if (Clip) { Region region = new Region(GetPathInternal()); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render the children if (Children != null) { foreach (SolidElement solid in RenderList) { graphics.TranslateTransform(solid.Rectangle.X, solid.Rectangle.Y); solid.Render(graphics, render); graphics.TranslateTransform(-solid.Rectangle.X, -solid.Rectangle.Y); } } if (Clip) { graphics.Clip = current; } }
public Engine(IRender render, IStatisticFactory statisticFactory, IStatisticStorage statisticStorage) { if (render == null) { throw new ArgumentNullException("render"); } if (statisticFactory == null) { throw new ArgumentNullException("statisticFactory"); } if (statisticStorage == null) { throw new ArgumentNullException("statisticStorage"); } this.Render = render; this.StatisticFactory = statisticFactory; this.StatisticStorage = statisticStorage; this.State = new StartState(this); this.CommandFactory = new CommandFactory(this); this.Statistic = StatisticFactory.CreateStatistic(); }
//Add custom rendered status "icon" protected override void Render(Graphics graphics, IRender render) { base.Render(graphics, render); //Save value of smoothign mode SmoothingMode smoothing = graphics.SmoothingMode; //Set up pens and brushes Pen pen = new Pen(Color.FromArgb(128, Color.Gray), 1); SolidBrush brush = new SolidBrush(Color.White); //Move the drawing origin to the icon location graphics.TranslateTransform(Width - 20, 5); //Set up the circle path GraphicsPath path = new GraphicsPath(); path.AddEllipse(0, 0, 16, 16); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.FillPath(brush, path); //Fill Circle graphics.DrawPath(pen, path); //Outline //Set up the cross path if (Available) { //Set up the tick path GraphicsPath tick = new GraphicsPath(); tick.AddLine(3, 8, 5, 6); tick.AddLine(5, 6, 8, 8); tick.AddLine(8, 8, 12, 3); tick.AddLine(12, 3, 13, 4); tick.AddLine(13, 4, 9, 13); tick.AddLine(9, 13, 3, 8); graphics.FillPath(new SolidBrush(BorderColor), tick); } else { GraphicsPath cross = new GraphicsPath(); cross.AddLine(3, 5, 5, 3); cross.AddLine(5, 3, 8, 6); cross.AddLine(8, 6, 11, 3); cross.AddLine(11, 3, 13, 5); cross.AddLine(13, 5, 10, 8); cross.AddLine(10, 8, 13, 11); cross.AddLine(13, 11, 11, 13); cross.AddLine(11, 13, 8, 10); cross.AddLine(8, 10, 5, 13); cross.AddLine(5, 13, 3, 11); cross.AddLine(3, 11, 6, 8); graphics.FillPath(new SolidBrush(Color.DarkRed), cross); } //Reset the translate and smoothing mode graphics.TranslateTransform(-(Width - 20), -(Height - 20)); graphics.SmoothingMode = SmoothingMode; }
void OnAddItem_AddItem(ItemObject item) { //BagItemObject _container = Global.Component.GetPlayerBag(); ContainerPack _containerPack = GetContainerPack(); if (_containerPack == null) { //TODO все забито } IItemList <ItemObject> _innerItems = _containerPack.GetInnerItems(); IRender _render = _containerPack.GetRender(); GameObject _container = _containerPack.GetContainer(); if (_innerItems != null) { //if (_container.IsFuLL() == false) //{ if (IsOpen(_container) == true) { _innerItems.Add(item); _render.Add(item); } else { item.inventoryData.SetSlotID(_render.GetFreeSlotID((ItemObject)_innerItems)); _innerItems.Add(item); } //} } }
public static void Run(IControl controller, IRender renderer, World world) { var controllerLock = new object(); Thread setControlCommand = new Thread(() => { while (controller.Command != ControlCommand.End) { controller.ReadCommand(); lock (controllerLock) { controller.SetCurrentCommand(); } } }); setControlCommand.Start(); Thread renderSimulation = new Thread(() => { while (controller.Command != ControlCommand.End) { Thread.Sleep(300); lock (controllerLock) { renderer.Render(world.CloneGrid(), controller.Command); if (controller.Command == ControlCommand.Running) { world.Tick(); } } } }); renderSimulation.Start(); }
//fill the marker background protected internal override void RenderShadow(Graphics graphics, IRender render) { Layer layer = render.CurrentLayer; Color shadowColor = render.AdjustColor(layer.ShadowColor, BorderWidth, Opacity); if (DrawBackground) { SolidBrush brush = new SolidBrush(shadowColor); //Draw soft shadows if (layer.SoftShadows) { shadowColor = Color.FromArgb(10, shadowColor); graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.SmoothingMode = SmoothingMode.HighQuality; } graphics.FillPath(brush, GetPathInternal()); if (layer.SoftShadows) { graphics.CompositingQuality = render.CompositingQuality; graphics.SmoothingMode = SmoothingMode; } } base.RenderShadow(graphics, render); }
public void Draw(IRender render, Vector2 position) { render.AddViewRect(new ViewRect((int)Math.Round(position.X, 0), (int)Math.Round(position.Y, 0), Width, Height)); if (currentAnimation == null) { return; } render.Begin(); for (int n = 0; n < currentAnimation.Textures.Length; n++) { if (textureTimes[n] <= CurrentTime && textureTimeToEnd[n] >= CurrentTime) { Vector2 pos = position; if (SpriteEffect == SpriteEffects.FlipHorizontally) { pos.X += currentAnimation.Width; } if (SpriteEffect == SpriteEffects.FlipVertically) { pos.Y += currentAnimation.Height; } currentAnimation.Textures[n].Draw(render, position, SpriteEffect); } } render.End(); }
protected override void format(TextWriter writer, IRender render, object state) { if (render != null) { render.Render(writer, state); } }
//Implement a base rendering of an element selection protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderTable(graphics, render); //Render the ports if (Ports != null) { foreach (Port port in Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-Rectangle.X + port.Rectangle.X, -Rectangle.Y + port.Rectangle.Y); port.SuspendValidation(); port.Render(graphics, render); port.ResumeValidation(); graphics.TranslateTransform(Rectangle.X - port.Rectangle.X, Rectangle.Y - port.Rectangle.Y); } } } } else { base.RenderAction(graphics, render, renderDesign); } }
public EarthApplication(ApplicationWindow window) { Window = window; Window.Resized += HandleWindowResize; Window.GraphicsDeviceCreated += OnGraphicsDeviceCreated; Window.GraphicsDeviceDestroyed += OnDeviceDestroyed; Window.Rendering += PreDraw; Window.Rendering += Draw; //首先创建一个场景对象 _scene = new Scene.Scene(window.Width, window.Height); globeRender = new RayCastedGlobe(_scene); var path = @"E:\swyy\Lib\PongGlobe\PongGlobe\assets\Vector\NaturalEarth\110m-admin-0-countries\110m_admin_0_countries.shp"; vectorLayerRender = new Renders.VectorLayerRender(path, _scene); var shareRender = new ShareRender(_scene); renders.Add(shareRender); renders.Add(globeRender); renders.Add(vectorLayerRender); var pat2h = @"E:\swyy\Lib\PongGlobe\PongGlobe\assets\Vector\NaturalEarth\110m-populated-places-simple\110m_populated_places_simple.shp"; var vectorPoint = new PointVectorLayerRender(pat2h, _scene); //renders.Add(vectorPoint); //var drawline = new DrawLineTool(_scene); // renders.Add(drawline); }
public override void Draw(IRender render) { render.SetPixel(X, Y, ConsoleColor.White); Y = Y % 80 + 2; //base.Draw(render); }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); int railAddX = Pointer.Width / 2; int railY = y + (Pointer.Height / 2) - (RailEdge.Height / 2); render.DrawSprite(RailEdge, new Vector2(x + railAddX, railY), Color.White); render.DrawSprite(RailEdge, new Vector2(x + railAddX + Width - RailEdge.Width, railY), Color.White); render.DrawSprite(RailMiddle, new Rectangle(x + railAddX + RailEdge.Width, railY, Width - RailEdge.Width * 2 - railAddX * 2, RailMiddle.Height), Color.White); render.DrawSprite(Pointer, new Vector2(PointerX, y), Color.White); //Dras milestones double stepPixelWidth = Math.Max((Width - RailEdge.Width * 2 - railAddX) * (StepValue / MaxValue), 1F); double stepX = x + railAddX; while (stepX < (x + Width - RailEdge.Width * 2 - railAddX)) { render.DrawSprite(Milestone, new Vector2((int)Math.Round(stepX, 0), y + Pointer.Height + PointerMilestoneMargin), Color.White); stepX += stepPixelWidth; } render.End(); }
protected override void CreateHandles() { if (Container == null) { return; } SetHandles(new Handles()); //Get the default graphics path and scale it IRender render = RenderFromContainer(); GraphicsPath defaultPath = (GraphicsPath)Component.Instance.DefaultHandlePath.Clone(); Matrix matrix = new Matrix(); matrix.Scale(render.ZoomFactor, render.ZoomFactor); defaultPath.Transform(matrix); RectangleF pathRectangle = defaultPath.GetBounds(); RectangleF halfRectangle = new RectangleF(0, 0, pathRectangle.Width / 2, pathRectangle.Height / 2); //Loop through each point and add an offset handle GraphicsPath path; foreach (PointF point in Points) { path = (GraphicsPath)defaultPath.Clone(); matrix.Reset(); matrix.Translate(point.X - Rectangle.X - halfRectangle.Width, point.Y - Rectangle.Y - halfRectangle.Height); path.Transform(matrix); Handles.Add(new Handle(path, HandleType.Origin)); } Handles[0].CanDock = true; Handles[Handles.Count - 1].CanDock = true; }
//Implement a base rendering of an element selection protected internal override void RenderSelection(Graphics graphics, IRender render, IRenderDesign renderDesign) { CreateHandles(); SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Handle previousHandle = null; SolidBrush brushWhite = new SolidBrush(Color.White); Pen pen = Component.Instance.SelectionStartPen; SolidBrush brush = Component.Instance.SelectionStartBrush; foreach (Handle handle in Handles) { if (previousHandle != null) { graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(brush, previousHandle.Path); graphics.DrawPath(pen, previousHandle.Path); pen = Component.Instance.SelectionPen; //Set to normal brush brush = Component.Instance.SelectionBrush; //Set to normal pen } previousHandle = handle; } graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(Component.Instance.SelectionEndBrush, previousHandle.Path); graphics.DrawPath(Component.Instance.SelectionEndPen, previousHandle.Path); graphics.SmoothingMode = smoothing; }
/// <summary> /// 处理后操作 /// </summary> /// <param name="context">上下文</param> /// <param name="render">渲染器</param> protected virtual void ProcessAfter(Context context, IRender render) { if (WriteLog) { WriteTraceLog(render, "渲染TagHelper组件"); } }
public override void Project(GameTime gameTime, int x, int y, IRender render) { render.Begin(); render.DrawBody(new Rectangle(x, y, Width, Height), Color.White, TopBorder, TopRightCorner, RightBorder, BottomRightCorner, BottomBorder, BottomLeftCorner, LeftBorder, TopLeftCorner, Inside); string textToDraw = Text; if (HasFocus) { textToDraw = Text.Insert(CursorPosition, "|"); } Font.DrawString(textToDraw, new Point(x + LeftBorder.Width + textMargin, y + base.Height / 2 - Font.CharHeight / 2), FontColor, render); render.End(); }
//Implement a base rendering of an element protected internal virtual void RenderShadow(Graphics graphics, IRender render) { if (this.Layer == null) { return; } Layer layer = Layer; Pen shadowPen = new Pen(render.AdjustColor(layer.ShadowColor, BorderWidth, Opacity)); GraphicsPath shadowPath = GetPathInternal(); graphics.TranslateTransform(layer.ShadowOffset.X, layer.ShadowOffset.Y); if (layer.SoftShadows) { graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.DrawPath(shadowPen, shadowPath); graphics.CompositingQuality = render.CompositingQuality; graphics.SmoothingMode = SmoothingMode; } else { graphics.DrawPath(shadowPen, shadowPath); } //Restore graphics graphics.TranslateTransform(-layer.ShadowOffset.X, -layer.ShadowOffset.Y); }
public SymmetricSpectrum(IEffectApi api, int width, int height) : base(width, height) { _api = api; _color = new SKColor(0, 255, 128); _render = _api.CreateRender(); _featureCache = _api.CreateAudioFeatureCache(); }
public static bool Show(IRender render, Screen screen) { var handle = render.ShowRender(); var core = GetCore(screen); if (core == null) { return(false); } Close(core.Render);//清理旧Render render.SetCore(core); core.Render = render; //处理alt+tab可以看见本程序 //https://stackoverflow.com/questions/357076/best-way-to-hide-a-window-from-the-alt-tab-program-switcher int exStyle = User32Wrapper.GetWindowLong(handle, WindowLongFlags.GWL_EXSTYLE); exStyle |= (int)WindowStyles.WS_EX_TOOLWINDOW; User32Wrapper.SetWindowLong(handle, WindowLongFlags.GWL_EXSTYLE, exStyle); bool ok = core.SendToBackground(handle); return(ok); }
private void RenderElement(Graphics graphics, IRender render) { Pen pen = null; if (CustomPen == null) { pen = new Pen(BorderColor, BorderWidth); pen.DashStyle = BorderStyle; //Check if winforms renderer and adjust color as required pen.Color = render.AdjustColor(BorderColor, BorderWidth, Opacity); } else { pen = CustomPen; } //Can throw an out of memory exception in System.Drawing try { graphics.SmoothingMode = SmoothingMode; graphics.DrawPath(pen, mPath); } catch { } }
public override void Render(Graphics graphics, IRender render) { byte opacity = 100; if (Table != null) opacity = Table.Opacity; //Draw indent SolidBrush brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity)); brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color); graphics.FillRectangle(brush,0,Rectangle.Top,Indent,Rectangle.Height); //Draw image float imageWidth = 0; if (Image != null) { System.Drawing.Image bitmap = Image.Bitmap; //Work out position of image float imageTop = (Rectangle.Height - bitmap.Height) / 2; if (imageTop < 0) imageTop = 0; imageWidth = bitmap.Width; graphics.DrawImageUnscaled(bitmap,Convert.ToInt32(Indent),Convert.ToInt32(Rectangle.Top+imageTop)); } //Draw text RectangleF textRectangle = new RectangleF(Indent+imageWidth+4,Rectangle.Top,Rectangle.Width - Indent -4,Rectangle.Height); brush = new SolidBrush(render.AdjustColor(Forecolor,1,opacity)); StringFormat format = new StringFormat(); format.LineAlignment = StringAlignment.Center; format.FormatFlags = StringFormatFlags.NoWrap; graphics.DrawString(Text,Component.Instance.GetFont(FontName,FontSize,FontStyle),brush,textRectangle,format); }
/// <summary> /// Constructor /// </summary> public VMR9Util() { _useVmr9 = true; if (!GUIGraphicsContext.VMR9Allowed) { Log.Info("VMR9: ctor() - VMR9 not allowed"); _useVmr9 = false; return; } _renderFrame = GUIGraphicsContext.RenderGUI; if (GUIGraphicsContext.DX9Device == null) { _useVmr9 = false; Log.Warn("VMR9: ctor() - DX9Device == null!"); } if (_renderFrame == null) { _useVmr9 = false; Log.Debug("VMR9: ctor() _renderFrame == null"); } if (g_vmr9 != null || GUIGraphicsContext.Vmr9Active) { _useVmr9 = false; Log.Info("VMR9: ctor() VMR9 already active"); } }
public void WaitRendingStart() { List <Task> tasklist = new List <Task>(); foreach (KeyValuePair <int, IRender> CRK in clist) { Task t = Task.Factory.StartNew((object prm) => { IRender CRV = (IRender)prm; while (CRV.getRendingFile() == "" || !System.IO.File.Exists(CRV.getRendingFile())) { System.Threading.Thread.Sleep(100); } }, CRK.Value); tasklist.Add(t); } Task.WaitAll(tasklist.ToArray()); mwsp.InputMap.Clear(); FormatHelper fh = new FormatHelper(IOHelper.NormalPcmMono16_Format); long TailLength = fh.Ms2Bytes(1000); foreach (KeyValuePair <int, IRender> CRK in clist) { WaveStreamType wst = new WaveStreamType(); wst.UnreadableTail = TailLength; wst.WaveStream = new FileStream(CRK.Value.getRendingFile(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite); mwsp.InputMap.Add(CRK.Key, wst); } }
public override void Draw(IRender render) { render.SetPixel(X, Y, Color); render.SetPixel(X - 1, Y, Color); render.SetPixel(X + 1, Y, Color); render.SetPixel(X, Y - 1, Color); render.SetPixel(X, Y + 1, Color); render.SetPixel(X, Y - 2, Color); render.SetPixel(X + 1, Y + 2, Color); render.SetPixel(X + 1, Y + 3, Color); render.SetPixel(X + 1, Y + 1, Color); render.SetPixel(X + 1, Y + 2, Color); render.SetPixel(X + 1, Y + 3, Color); render.SetPixel(X - 1, Y + 1, Color); render.SetPixel(X - 1, Y + 2, Color); render.SetPixel(X - 1, Y + 3, Color); render.SetPixel(X + 2, Y + 2, Color); render.SetPixel(X + 2, Y + 3, Color); render.SetPixel(X - 2, Y + 2, Color); render.SetPixel(X - 2, Y + 3, Color); render.SetPixel(X, Y + 1, Color); render.SetPixel(X, Y + 2, Color); render.SetPixel(X, Y + 3, Color); render.SetPixel(X - 1, Y + 4, Color); render.SetPixel(X + 1, Y + 4, Color); render.SetPixel(X + 3, Y + 3, Color); render.SetPixel(X - 3, Y + 3, Color); }
public void DrawChar(char c, Point position, Vector2 origin, Color color, IRender render) { int addX = 0; int addY = 0; if (origin.X != 0 && origin.Y != 0) { addX = -(int)Math.Round(CharWidth * origin.X, 0); addY = -(int)Math.Round(CharHeight * origin.Y, 0); } Rectangle sourceRect = GetCharRect(c); if (sourceRect.IsEmpty) { return; } render.DrawSprite(FontSprite, new Rectangle(position.X + addX, position.Y + addY, CharWidth, CharHeight), sourceRect, color); }
/// <summary> /// Initializes a new instance of the <see cref="Engine"/> class. /// </summary> /// <param name="render">The render.</param> /// <param name="statisticFactory">The statisticFactory.</param> /// <param name="statisticStorage">The statisticStorage.</param> public Engine(IRender render, IStatisticFactory statisticFactory, IStatisticStorage statisticStorage) { if (render == null) { throw new ArgumentNullException(nameof(render)); } if (statisticFactory == null) { throw new ArgumentNullException(nameof(statisticFactory)); } if (statisticStorage == null) { throw new ArgumentNullException(nameof(statisticStorage)); } this.Render = render; this.StatisticFactory = statisticFactory; this.StatisticStorage = statisticStorage; this.State = new StartState(this); this.CommandFactory = new CommandFactory(this); this.Statistic = this.StatisticFactory.CreateStatistic(); }
public FilterLineControl(IRender render, IExecutor exec) { this.render = render ?? throw new ArgumentNullException(nameof(render)); this.exec = exec ?? throw new ArgumentNullException(nameof(exec)); InitializeComponent(); }
protected override void Render(Graphics graphics, IRender render) { if (this.m_flash) { // Get Path GraphicsPath path = base.GetPath(); // Draw Fill LinearGradientBrush brush = new LinearGradientBrush( new RectangleF(0f, 0f, base.Rectangle.Width, base.Rectangle.Height), base.BackColor, Color.Yellow, base.GradientMode); graphics.FillPath(brush, path); // Draw Outline Pen pen = new Pen(base.BorderColor, base.BorderWidth); pen.DashStyle = DashStyle.Solid; pen.Color = Color.Yellow; graphics.DrawPath(pen, path); } else { base.Render(graphics, render); } }
/// <summary> /// Creates new descriptor over given action /// </summary> /// <param name="render"> </param> public RenderDescriptor(IRender render) { Render = render; Name = RenderAttribute.GetName(render); DirectRole = RenderAttribute.GetRole(render); var contextualRender = render as IContextualRender; if (contextualRender != null) { contextualRender.SetDescriptor(this); } }
public VideoProcessorJobMsg(String name, String forAnswer, IRender render, IEnumerator<WorkId> workIter) { if ((name == null) || (forAnswer == null) || (render == null)) throw new ArgumentNullException("Null parameter in VideoProcessorJobMsg"); this.name = name; this.forAnswer = forAnswer; this.render = render; workIter.Reset(); while (workIter.MoveNext()) this.workList.Add(workIter.Current); }
public SendWorkAction(ManagerVideoJob job, IRender render, int quantity, IEnumerator<String> tasksAddr, IEnumerator<WorkId> initWorkIter) { this.job = job; tasksAddr.Reset(); while (tasksAddr.MoveNext()) this.tasksAddr.Add(tasksAddr.Current); initWorkIter.Reset(); while (initWorkIter.MoveNext()) this.initWork.Enqueue(initWorkIter.Current); this.quantity = quantity; this.render = render; }
static void Init(IntPtr pParam) { IEngineSubSystem subSys = null; core.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out subSys); resman = (IResourceManager)subSys; core.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out subSys); render = (IRender)subSys; core.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out subSys); input = (IInput)subSys; }
public GameScreen() { InitializeComponent(); _controller = new GameController(new GameServer()); _renderer = new WinformsRenderer(); _inputRouter = new WinformsInputRouter(); _renderer.OnGameboardInput = _inputRouter.HandleGameboardInteraction; newToolStripMenuItem.Click += (sender, args) => { var viewModel = _controller.StartNewGame(); _renderer.Render(viewModel, renderTarget); }; }
public MainWindow() { InitializeComponent(); var bmp = new WriteableBitmap( 640, 480, 96, 96, PixelFormats.Bgra32, null); device = new Device(bmp); FrontBuffer.Source = bmp; meshes = new List<Mesh>(); #if false var m = new Mesh("triangle", 4, 4); m.Vertices[0] = new Vector3(0, 1f, 0f); m.Vertices[1] = new Vector3(1f, -1f, 0f); m.Vertices[2] = new Vector3(-1f, -1f, 0f); m.Vertices[3] = new Vector3(-0f, 0.0f, -1f); m.Faces[0] = new Face(0, 1, 2); m.Faces[1] = new Face(0, 3, 1); m.Faces[2] = new Face(0, 3, 2); m.Faces[3] = new Face(1, 3, 2); meshes.Add(m); #else var mesh1 = Mesh.LoadMesh(@"resources\monkey.babylon", 0); mesh1.Position = new Vector3(-0.0f,0f,0f); mesh1.Rotation = new Vector3(-3.2f, 0f, 0f); meshes.Add(mesh1); //meshes.Add(Mesh.LoadMesh(@"resources\monkey.babylon", 0)); //meshes.Add(Mesh.LoadMesh(@"resources\monkey.babylon", 0)); //meshes.Add(Mesh.LoadMesh(@"resources\monkey.babylon", 0)); //meshes.Add(Mesh.LoadMesh(@"resources\monkey.babylon", 0)); #endif camera = new Camera(); camera.Position = new Vector3(0, 0, 10.0f); camera.Target = Vector3.Zero; render = new CompositeRender(new FaceRender()); CompositionTarget.Rendering += CompositionTargetRendering; }
public HuiZhaoMeshView3D() : base(new OpenTK.Graphics.GraphicsMode(32,24,8,1,32,2,true)) // public HuiZhaoMeshView3D() { this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.MeshView3D_KeyUp); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MeshView3D_KeyDown); ToolPool.Instance.Width = this.Width; ToolPool.Instance.Height = this.Height; ToolPool.Instance.Tool = new ToolView(Width,Height); ToolPool.Instance.ChangedTool += new MeshChangedDelegate(Instance_ChangedTool); render = new RenderBasic(); }
void Init(IntPtr pParam) { IEngineSubSystem pSubSys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out pSubSys); pRender = (IRender)pSubSys; pRender.GetRender2D(out pRender2D); pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys); pInput = (IInput)pSubSys; pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR); IResourceManager pResMan; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys); pResMan = (IResourceManager)pSubSys; IEngineBaseObject pBaseObj; pResMan.Load(RESOURCE_PATH + "sounds\\bug_death.wav", out pBaseObj, 0); pSndDeath = (ISoundSample)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\light.jpg", out pBaseObj, 0); pTexLight = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\smoke.png", out pBaseObj, 0); pTexSmoke = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\bug.png", out pBaseObj, 0); pTexBug = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\bug_corpse.png", out pBaseObj, 0); pTexBugCorpse = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\blood.png", out pBaseObj, 0); pTexBlood = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "textures\\cartoon_grass.tga", out pBaseObj, (uint)(E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_REPEAT)); pTexBg = (ITexture)pBaseObj; pTexBug.SetFrameSize(52, 42); for (uint i = 0; i < 3; i++) { pResMan.CreateTexture(out pTexTarget[i], null, ScreenWidth, ScreenHeight, E_TEXTURE_DATA_FORMAT.TDF_RGB8, E_TEXTURE_CREATE_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_CLAMP); } Clear(); }
/// <summary> /// Initializes a new instance of the <see cref="Engine"/> class. /// </summary> /// <param name="render">The render.</param> public Engine(IRender render) : this(render, new StatisticFactory(), new StatisticStorageDummy()) { }
private void RenderSolid(Graphics graphics,IRender render) { //Create a brush if no custom brush defined if (DrawBackground) { if (CustomBrush == null) { //Use a linear gradient brush if gradient requested if (DrawGradient) { LinearGradientBrush brush; brush = new LinearGradientBrush(new RectangleF(0,0,Rectangle.Width,Rectangle.Height),render.AdjustColor(BackColor,0,Opacity),render.AdjustColor(GradientColor,0,Opacity),mGradientMode); brush.GammaCorrection = true; if (Blend != null) brush.Blend = Blend; graphics.FillPath(brush, GetPathInternal()); } //Draw normal solid brush else { SolidBrush brush; brush = new SolidBrush(render.AdjustColor(BackColor,0,this.Opacity)); graphics.FillPath(brush,GetPathInternal()); } } else { graphics.FillPath(CustomBrush, GetPathInternal()); } } // //Render internal rectangle // Pen tempPen = new Pen(Color.Red,1); // graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height); // // tempPen = new Pen(Color.Green,1); // graphics.DrawRectangle(tempPen,mTransformInternalRectangle.X,mTransformInternalRectangle.Y,mTransformInternalRectangle.Width,mTransformInternalRectangle.Height); }
private void RenderTableRows(Graphics graphics, IRender render,TableItems rows,ref float iHeight) { foreach (TableRow tableRow in rows) { tableRow.SuspendEvents = true; tableRow.SetRectangle(new RectangleF(0,iHeight,Width,RowHeight)); tableRow.Render(graphics,render); iHeight+=RowHeight; tableRow.SuspendEvents = false; } }
void Init(IntPtr pParam) { TMatrix4x4 mat = TMatrix4x4.MatrixIdentity; transform = new TTransformStack(ref mat); rand = new Random(); IEngineSubSystem p_sub_sys = null; IResourceManager p_res_man = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys); p_res_man = (IResourceManager)p_sub_sys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys); p_render = (IRender)p_sub_sys; p_render.GetRender3D(out pRender3D); IEngineBaseObject p_obj = null; p_res_man.Load(RESOURCE_PATH + "textures\\floor.dds", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); pTexFloor = (ITexture)p_obj; p_res_man.Load(RESOURCE_PATH + "sprites\\light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pTexLight = (ITexture)p_obj; // some global lighting pRender3D.ToggleLighting(true); TColor4 col = TColor4.ColorBlack(); pRender3D.SetGlobalAmbientLighting(ref col); // turn off ambient lighting // setup lights // use single directional light to simulate ambient lighting p_res_man.CreateLight(out pLightDirect); pLightDirect.SetType(E_LIGHT_TYPE.LT_DIRECTIONAL); col = TColor4.ColorGray(); pLightDirect.SetColor(ref col); // dim light TPoint3 p3 = new TPoint3(-0.5f, 0.5f, 0.75f); pLightDirect.SetDirection(ref p3); pLightDirect.SetEnabled(true); // Position is ignored for direction lights but is used by engine for debug drawing. // Use "rnd3d_draw_lights 1" console command to debug lights. p3 = new TPoint3(0f, 7.5f, 0f); pLightDirect.SetPosition(ref p3); // create light for the table-lamp p_res_man.CreateLight(out pLightSpot); pLightSpot.SetType(E_LIGHT_TYPE.LT_SPOT); col = TColor4.ColorYellow(); pLightSpot.SetColor(ref col); pLightSpot.SetSpotAngle(100f); p3 = new TPoint3(0.15f, 0f, -1f); pLightSpot.SetDirection(ref p3); pLightSpot.SetEnabled(true); // create and setup materials and load models ITexture p_tex; IMaterial p_mat; // desk p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\desk\\desk_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\desk\\desk.dmd", out p_obj, 0); pMdlDesk = (IModel)p_obj; pMdlDesk.SetModelMaterial(p_mat); // table-lamp p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\table_lamp\\lamp_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\table_lamp\\lamp.dmd", out p_obj, 0); pMdlLamp = (IModel)p_obj; pMdlLamp.SetModelMaterial(p_mat); // chair p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\chair\\chair_diff.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\chair\\chair.dmd", out p_obj, 0); pMdlChair = (IModel)p_obj; pMdlChair.SetModelMaterial(p_mat); // music box p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\music_box\\mbox_d.dds", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); p_res_man.Load(RESOURCE_PATH + "meshes\\furniture\\music_box\\music_box.dmd", out p_obj, 0); pMdlMusicBox = (IModel)p_obj; pMdlMusicBox.SetModelMaterial(p_mat); // church p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church.dmd", out p_obj, 0); pModelChurch = (IModel)p_obj; pModelChurch.SetModelMaterial(p_mat); p_res_man.CreateMaterial(out p_mat); col = TColor4.ColorSilver(); p_mat.SetDiffuseColor(ref col); col = TColor4.ColorWhite(); p_mat.SetSpecularColor(ref col); p_mat.SetShininess(25f); pModelChurch.SetMeshMaterial(0, p_mat); p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church_roof.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); pModelChurch.SetMeshMaterial(1, p_mat); p_res_man.CreateMaterial(out p_mat); p_res_man.Load(RESOURCE_PATH + "meshes\\church\\church_main.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D); p_tex = (ITexture)p_obj; p_mat.SetDiffuseTexture(p_tex); pModelChurch.SetMeshMaterial(2, p_mat); // snow globe p_res_man.Load(RESOURCE_PATH + "meshes\\snow_globe.dmd", out p_obj, 0); pSnowGlobe = (IModel)p_obj; p_res_man.CreateMaterial(out p_mat); col = TColor4.ColorWhite(); p_mat.SetDiffuseColor(ref col); pSnowGlobe.SetMeshMaterial(0, p_mat); p_res_man.CreateMaterial(out p_mat); col = TColor4.ColorBrown(); p_mat.SetDiffuseColor(ref col); col = TColor4.ColorWhite(); p_mat.SetSpecularColor(ref col); p_mat.SetShininess(25f); pSnowGlobe.SetMeshMaterial(2, p_mat); p_res_man.CreateMaterial(out p_mat); col = TColor4.ColorWhite(100); p_mat.SetDiffuseColor(ref col); col = TColor4.ColorWhite(); p_mat.SetSpecularColor(ref col); p_mat.SetShininess(50f); p_mat.SetBlending(true, E_BLENDING_EFFECT.BE_NORMAL); // When material with blending is set model will sort mesh order for meshes with blending to be the last. pSnowGlobe.SetMeshMaterial(1, p_mat); // We will use black fog to simulate darkness. col = TColor4.ColorBlack(); pRender3D.SetFogColor(ref col); pRender3D.SetLinearFogBounds(12.5f, 20f); pRender3D.ToggleFog(true); }
public void Render(Camera camera, Mesh[] meshes, IRender render) { var viewMatrix = Matrix.LookAtLH(camera.Position, camera.Target, Vector3.UnitY); var projectionMatrix = Matrix.PerspectiveFovLH( 0.5f, (float)renderWidth / renderHeight, 0.01f, 1.0f); foreach (var mesh in meshes) { var worldMatrex = Matrix.RotationYawPitchRoll( mesh.Rotation.X, mesh.Rotation.Y, mesh.Rotation.Z)* Matrix.Translation(mesh.Position); var transformMatrix = worldMatrex*viewMatrix*projectionMatrix; render.Render(this,mesh,transformMatrix); } }
void Init(IntPtr pParam) { // get subsystems pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys); pResMan = (IResourceManager)p_sub_sys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out p_sub_sys); pInput = (IInput)p_sub_sys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys); pRender = (IRender)p_sub_sys; pRender.GetRender2D(out pRender2D); // create arrays IEngineBaseObject pObj = null; pTextures = new ITexture[TexCount]; pShadows = new ITexture[ShadowCount]; pMeshes = new IMesh[MeshCount]; // loading data pResMan.Load(RESOURCE_PATH + "sounds\\helicopter.wav", out pObj, 0); pSound = (ISoundSample)pObj; pSound.PlayEx(out pSoundChannel, E_SOUND_SAMPLE_PARAMS.SSP_LOOPED); for (int i = 0; i < TexCount; i++) { uint flags = TexNames[i].Contains("grass") ? (uint)(E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_REPEAT) : (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D; pResMan.Load(RESOURCE_PATH + TexNames[i], out pObj, flags); pTextures[i] = (ITexture)pObj; } pTextures[6].SetFrameSize(256, 256); // zombie sprite splitting for (int i = 0; i < MeshCount; i++) { pResMan.Load(RESOURCE_PATH + MeshNames[i], out pObj, (uint)E_MESH_MODEL_LOAD_FLAGS.MMLF_FORCE_MODEL_TO_MESH); pMeshes[i] = (IMesh)pObj; } // render shadows for (int i = 0; i < MeshCount; i++) { RenderMeshToTexture(out pShadows[i], pMeshes[i], pTextures[i]); } // render rotor shadow pResMan.CreateTexture(out pShadows[5], null, 256, 256, E_TEXTURE_DATA_FORMAT.TDF_RGBA8, E_TEXTURE_CREATE_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR); pRender.SetRenderTarget(pShadows[5]); TPoint2 coords = new TPoint2(128f, 128f); TColor4 col = TColor4.ColorWhite(); pRender2D.DrawCircle(ref coords, 100, 64, ref col, E_PRIMITIVE2D_FLAGS.PF_FILL); pRender.SetRenderTarget(null); // gather, fill and init 3d-objects data MyMeshes = new MyMesh[8] { new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2( 900f, 500f), new TPoint3(400f, 400f, 500f), 225), new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2(-250f, 300f), new TPoint3(400f, 400f, 500f), 225), new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2( 800f, 200f), new TPoint3(400f, 400f, 400f), 225), new MyMesh(pMeshes[1], pTextures[1], pShadows[1], new TPoint2( 0f, 450f), new TPoint3(300f, 300f, 400f), 175), new MyMesh(pMeshes[1], pTextures[1], pShadows[1], new TPoint2( 50f, 750f), new TPoint3(300f, 300f, 300f), 175), new MyMesh(pMeshes[2], pTextures[2], pShadows[2], new TPoint2( 500f, 150f), new TPoint3(400f, 400f, 500f), 225), new MyMesh(pMeshes[3], pTextures[3], pShadows[3], new TPoint2( 180f, 150f), new TPoint3(400f, 400f, 600f), 200), new MyMesh(pMeshes[3], pTextures[3], pShadows[3], new TPoint2( 600f, 550f), new TPoint3(400f, 400f, 600f), 200, 90) }; copter = new Copter(new MyMesh(pMeshes[4], pTextures[4], pShadows[4], new TPoint2(), new TPoint3(600, 600, 600), 200, 0, true), pTextures[5], pShadows[5]); zombie = new Zombie(pTextures[6]); }
protected internal override void Render(Graphics graphics, IRender render) { RenderTable(graphics,render); RenderExpand(graphics,render); //Render the ports if (Ports != null) { foreach (Port port in Ports.Values) { graphics.TranslateTransform(-Rectangle.X + port.Rectangle.X,-Rectangle.Y + port.Rectangle.Y); port.SuspendValidation(); port.Render(graphics,render); port.ResumeValidation(); graphics.TranslateTransform(Rectangle.X - port.Rectangle.X,Rectangle.Y - port.Rectangle.Y); } } }
private void RenderTable(Graphics graphics, IRender render) { GraphicsPath path = GetPathInternal(); if (path == null) return; //Draw background Color backColor = render.AdjustColor(BackColor,0,Opacity); Color gradientColor = render.AdjustColor(GradientColor,0,Opacity); SolidBrush brush = new SolidBrush(backColor); graphics.FillPath(brush,path); Region current = graphics.Clip; Region region = new Region(GetPathInternal()); graphics.SetClip(region,CombineMode.Intersect); //Draw Heading RectangleF headingRect = new RectangleF(0,0,Width,HeadingHeight); LinearGradientBrush gradient = new LinearGradientBrush(headingRect,gradientColor,backColor,LinearGradientMode.Horizontal); graphics.FillRectangle(gradient,headingRect); //Draw Heading text brush.Color = render.AdjustColor(Forecolor,1,Opacity); graphics.DrawString(Heading,Component.Instance.GetFont(FontName,FontSize,FontStyle.Bold),brush,8,5); graphics.DrawString(SubHeading,Component.Instance.GetFont(FontName,FontSize-1,FontStyle.Regular),brush,8,20); if (Expanded) { float iHeight = HeadingHeight; //Draw the top level rows (if any) if (Rows.Count > 0) { brush.Color = GradientColor; graphics.FillRectangle(brush,0,iHeight,Indent,1); iHeight+=1; RenderTableRows(graphics,render,Rows,ref iHeight); } if (Groups.Count > 0) { foreach (TableGroup tableGroup in Groups) { iHeight+=1; tableGroup.SuspendEvents = true; tableGroup.SetRectangle(new RectangleF(0,iHeight,Width,RowHeight)); tableGroup.Render(graphics,render); iHeight+=RowHeight; tableGroup.SuspendEvents = false; if (tableGroup.Groups.Count > 0 && tableGroup.Expanded) RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight); if (tableGroup.Rows.Count > 0 && tableGroup.Expanded) RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight); } } //Render highlight (if any) if (DrawSelectedItem && SelectedItem != null) SelectedItem.RenderSelection(graphics,render); } graphics.Clip = current; //Draw outline Pen pen; if (CustomPen == null) { pen = new Pen(BorderColor,BorderWidth); pen.DashStyle = BorderStyle; //Check if winforms renderer and adjust color as required pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity); } else { pen = CustomPen; } graphics.DrawPath(pen,path); }
private void RenderTableGroups(Graphics graphics, IRender render, TableItems groups,ref float iHeight) { foreach (TableGroup tableGroup in groups) { tableGroup.SuspendEvents = true; tableGroup.SetRectangle(new RectangleF(0, iHeight, Width, GroupHeight)); tableGroup.Render(graphics,render); iHeight+=GroupHeight; tableGroup.SuspendEvents = false; //Render groups and rows recursively if (tableGroup.Groups.Count > 0 && tableGroup.Expanded) RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight); if (tableGroup.Rows.Count > 0 && tableGroup.Expanded) RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight); } }
public WebEasilyReport() { headerItems = new ReportItemCollection(this); footerItems = new ReportItemCollection(this); fieldItems = new DataSourceItemCollection(this); dataSource = new WebDataSourceItemCollection(this); mailSetting = new MailConfig(); format = new ReportFormat(); parameters = new ParameterItemCollection(); images = new ImageItemCollection(); dbGateway = new DBGateway(this); serializer = new BinarySerialize(); this.reportID = ComponentInfo.DefaultReportID + DateTime.Now.ToString("yyyyMMdd"); this.reportName = ""; fontConvert = new FontConverter(); Visible = false; if (this.UIType == EasilyReportUIType.AspNet) { render = new AspNetRender(this); } else { render = new ExtJsRender(this); } }
//Implement a base rendering of an element selection protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderTable(graphics,render); //Render the ports if (Ports != null) { foreach (Port port in Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-Rectangle.X + port.Rectangle.X,-Rectangle.Y + port.Rectangle.Y); port.SuspendValidation(); port.Render(graphics,render); port.ResumeValidation(); graphics.TranslateTransform(Rectangle.X - port.Rectangle.X,Rectangle.Y - port.Rectangle.Y); } } } } else { base.RenderAction(graphics,render,renderDesign); } }
private void RenderPort(Graphics graphics,IRender render) { GraphicsPath path = GetPathInternal(); //Create a brush if no custom brush defined if (DrawBackground) { if (CustomBrush == null) { //Use a linear gradient brush if gradient requested if (DrawGradient) { LinearGradientBrush brush; brush = new LinearGradientBrush(new RectangleF(0,0,Rectangle.Width,Rectangle.Height),render.AdjustColor(BackColor,0,Opacity),render.AdjustColor(GradientColor,0,Opacity),GradientMode); brush.GammaCorrection = true; if (Blend != null) brush.Blend = Blend; graphics.FillPath(brush, path); } //Draw normal solid brush else { SolidBrush brush; brush = new SolidBrush(render.AdjustColor(BackColor,0,this.Opacity)); graphics.FillPath(brush,path); } } else { graphics.FillPath(CustomBrush, path); } } Pen pen = null; if (CustomPen == null) { pen = new Pen(BorderColor,BorderWidth); pen.DashStyle = BorderStyle; //Check if winforms renderer and adjust color as required pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity); } else { pen = CustomPen; } graphics.SmoothingMode = SmoothingMode; graphics.DrawPath(pen,path); //Render internal rectangle //Pen tempPen = new Pen(Color.Red,2); //graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height); }
private void RenderExpand(Graphics graphics,IRender render) { //Obtain a reference to IExpandable interface IExpandable expand = (IExpandable) this; if (!expand.DrawExpand) return; //Draw the expander Pen pen = new Pen(Color.FromArgb(128,Color.Gray),1); SolidBrush brush = new SolidBrush(Color.White); //Set up the expand path mExpandPath = new GraphicsPath(); mExpandPath.AddEllipse(Width-20,5,14,14); SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.FillPath(brush,mExpandPath); //Fill Circle graphics.DrawPath(pen,mExpandPath); //Outline pen.Color = Color.FromArgb(128,Color.Navy); pen.Width = 2; PointF[] points; if (expand.Expanded) { points = new PointF[] {new PointF(Width-16,11),new PointF(Width-13,8),new PointF(Width-10,11)}; } else { points = new PointF[] {new PointF(Width-16,8),new PointF(Width-13,11),new PointF(Width-10,8)}; } graphics.DrawLines(pen,points); points[0].Y += 5; points[1].Y += 5; points[2].Y += 5; graphics.DrawLines(pen,points); graphics.SmoothingMode = smoothing; }
protected internal override void RenderHighlight(Graphics graphics, IRender render,IRenderDesign renderDesign) { graphics.TranslateTransform(mOffset.X,mOffset.Y); base.RenderHighlight (graphics,render,renderDesign); graphics.TranslateTransform(-mOffset.X,-mOffset.Y); }
protected internal override void Render(Graphics graphics, IRender render) { if (GetPathInternal() == null) return; //Translate by offset graphics.TranslateTransform(mOffset.X,mOffset.Y); //Fill and draw the port RenderPort(graphics, render); //Render image if (Image != null) Image.Render(graphics,render); //Render label if (Label != null) Label.Render(graphics,render); graphics.TranslateTransform(-mOffset.X,-mOffset.Y); }
public void RemoveRenderable(IRender renderable) { lock (renderLock) { if (renderable is ISelectable) selectables.Remove((ISelectable)renderable); drawables.Remove(renderable); } }
/// <summary> /// This adds a renderable object to the list of items to render by the renderable. /// Keep in mind this is an ordered list, so items are drawn in the order they are added /// (i.e. items added first are drawn first and items after are drawn on top of those) /// Items that are selectable are ALSO added to the list of selectable renderables /// </summary> /// <param name="renderable"></param> public void AddRenderable(IRender renderable) { lock (renderLock) { if (renderable is ISelectable) selectables.Add((ISelectable)renderable); drawables.Add(renderable); } }
public VideoProcessorJob(String name, String forAnswer, IRender render, IEnumerator<WorkId> workIter, ISelectReceiversStrategy strategy) : base(name) { this.forAnswer = forAnswer; workIter.Reset(); while (workIter.MoveNext()) this.works.Enqueue(workIter.Current); this.render = render; this.strategy = strategy; }