锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 开源技术 / C#开源英语 / .net开源图形引擎AGE
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
技术分类
讨论组翻译
GraphicDesigner.exe不能打开
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。

.net开源图形引擎AGE

图形引擎

Introduction 介绍

This library lets you manipulate graphic objects in your app at runtime.

这个库允许您在你的应用程序在运行时操作图形对象。

Background 背景

Sometime ago, I read that someone had asked for a way to drag items over a panel. Since I had the same problem (all began with the designer of MyNeoReport project) I tried to solve this in a generic way, so that the system could be used in different applications without efforts.

不久以前,我读到有人要求在面板拖动图形部分的方法。因为我有同样的问题(所有始于MyNeoReport项目的设计师)我试图用一个通用的方式来解决这个问题,这样,该系统能够轻松的在不同的应用中使用。

AGE supports items dragging, snap-to-grid, multiselection, layers and much more.AGE支持项目拖动,捕捉网格,多项选择,图层等等。

AGE is growing fast; if I were you I would keep an eye on this project. AGE发展迅速;如果我是你,我会继续关注这个项目。

Principal Subjects 主要问题

GraphicItem: The item to be drawn GraphicItem:该项目绘制出图形。

Painter: The class that does the "dirty work" of painting Painter:实现绘制“脏活”的类

GraphicDocument: The class that collects all the items to be drawn on a single surface GraphicDocument:收集管理所有的图形,实现在一个单独面板上显示。

Canvas: The control that shows the drawing Canvas:控制显示绘图

Why This Set of Class? 为什么使用这组类?

Q: Why do I need an RendererBase and why don't I put the Render() method directly to the GraphicItem class? 问:为什么我需要一个RendererBase,为什么不直接把Render()方法用到GraphicItem类中?

A: Because I need more abstraction. 答:因为我要让它更抽象。

In this way I separate the logical item from the actor of the rendering. 这样我可以把这个项目合理的从渲染行为里分离出来。

I can virtually have the same renderer for different items or I can choose a different renderer for a single item. 我有相同的渲染器适合于不同的项目或我可以为一个单独的项目选择不同的渲染器。

Q: Why is the GraphicDocument a separate class from Canvas? I could add all the items to draw directly to the Canvas. 问:为什么Canvas和GraphicDocument是一个分享的类?我可以直接在画布上绘制添加所有项目。

A: Same reason of the first question: the GraphicDocument is the logical items aggregation, it is the document, the canvas is the surface on which the document is drawn. 答:第一个问题同样的原因:GraphicDocument是合理的项目聚集,,这是文档,画布是文档绘制的表面。

And again, in this way, I could have the same document open on more canvas. 再一次,这样,我可以有相同的文档支持多个打开的画布。

Ok, Let's Start... How Does It Work? 好的,让我们开始…它是如何工作的呢?

Q: How can I make my own graphic document? 问:我如何能制作自己的GraphicDocument?


A: Ok, let's define a complete new custom document: 答:好的,让我们来定义一个完整的新的自定义文档:

class CustomDocument : GraphicDocument
    {
    // define here your document properties
    } 
    // define a custom item: an ellipse.
    class Ellipse : GraphicItem
    {
    Color _foreColor = Color.Blue;
    public Ellipse()
    {
    Painter = new EllipsePainter();
    } 
    public Color ForeColor
    {
    get{ return _foreColor; }
    set{ _foreColor = value; }
    }
    }  
    // define the ellipse painter
    class EllipsePainter : Painter
    {
    // how the ellipse is painted...
    protected override void Paint(Graphics g)
    {
    Ellipse ellipse = (Ellipse)Item;
    Pen pen = new Pen(ellipse.ForeColor);
    g.DrawEllipse(pen, Item.Bounds);
pen.Dispose(); } } ...
canvas1.Document = new CustomDocument();
// add a new ellipse to the default layer
canvas1.Document.AddItem(new Ellipse());

From release 1.4.0.0, you can also use ScriptAge to define your custom graphic item at runtime: 从版本1.4.0.0,您还可以在运行时使用ScriptAge自定义图形项:

ScriptedItem triangle = new ScriptedItem();
    // Of course: it doesn't make much sense to hard code the script :)
    // Rather you would load it from a separate text file or a string resource.
    triangle.Script = "stroke: Polygon\n",
  "pen: #7070ff, 2!\n",
  "brush: gradient, #0000ff, #000000ff, (0; 0.5) (1; 1)\n",
  "points: (0; 0.5) (1; 0.0) (1; 1)\n"
友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内