Silvermoon is a UI framework for windows Mobile 6.x to build harDWare accelerated user interfaces with OpenGL ES 1.1 as kernel. When I started development,I planned to make Silvermoon independent from the harDWare layer,so that the OpenGL rendering engine Could easily be replaced by ActiveX. But since development progressed,I recognized that this abstraction leads to several restrictions and so from beta 2 to beta 3 I dropped this feature completely.
Silvermoon has currently no design time supports. This is because Silvermoon is not a windows form application. As for Silverlight,a separate designer is required,but for Now it doesn’t exist yet. The name “Silvermoon” is a derivation from “Silverlight” and “Moonlight” and in fact,I was orIEntating on Silverlight to design Silvermoon. But although similar,it has nothing to do with it.
Before I go into the details,I give a brIEf introduction of the elements of Silvermoon.
ShapeShapes are primitive classes which are used by controls to render its appearance. Generally spoken,a shape is a rectangle with an image. The image can be a rectangle (RectangleShape) or it can be a Circle (RoundShape) or any other image. A shape can even contain other shapes (MultiShape) to build complex images. But more about shapes later…
ControlControls are the heart of Silvermoon. Controls have propertIEs that describe the current characteristics and appearance of a control. For instance a button control has a Ispressed property,or almost every Control has a color property. Controls use shapes to render their appearance. Therefore every control has a protected Shapes class which is a linked List of shapes (I prefer linked Lists over Lists,as they are about 20% faster for enumeration and consume only the storage they required). A Control can also host one (Decorator) or more (ContainerControl) controls. For instance a ListBox contains Items. There are controls which don’t have any appearance and are supposed to be used as container only,like Panel,and some have,like button. Visual controls (or ChromeControl) have a Background and a Chrome property which is of type shape. The background is the shape which is rendered as first of all other shapes and child controls. Chrome is the opposite and it is rendered after all other shapes and child controls. For instance,the picker makes use of the Chrome to render a lens.
Some controls have additional shapes,and you can always change the default shape directly by changing the property to another shape.
A control does not directly (or should not) change it’s appearance when a property changes it’s value. The only thing it does is to change the state. So the button sets it’s state to “pressed” when Ispressed changes to true,and back to “normal” when it returns to false. And this is the moment where a visualstatemanager comes into the play:
visualstatemanager is a description of how the control appears when a control has a distinct state. Of course it can happen that a control has more than one state,e.g. a radio button can be selected and Disabled. Therefore visualstatemanager is divIDed into groups. Every group can contain a state and they are mutually exclusive. But it’s also possible that one state is included in more than one group. Each state finally contains a collection of propertIEs and their values for that state. They also describe how to Transition to the new value instead of simply change to the new value on sudden. VisualsstateManager can either be applIEd to all controls of a distinct class (visualstatemanager.SetClassManager) or for an explicit control only (Control.visualstatemanager).
Property accessors are the Silvermoon equivalent of dependency propertIEs. Property accessors allow access the value of a property from a class without kNowledge of the class itself. This feature is required to describe animations for propertIEs (see visualstatemanager) and later how to bind them. Unless dependency propertIEs,they are no sparse propertIEs who only consume storage when they are assigned. That because a dependency property is slower in access (70xwrite,20xread) than a direct property due to Boxing/unBoxing value types and maintaining the dictionary. Therefore I decIDed to create something new,which allows to access a property from outsIDe but does not slow down accessing a property. A property accessor also allows to remember the value of the property before an animation/Transition is applIEd on it. A property accessor also ensures that there is only one animation of the property at one time.
Style and StyleDictionaryPrincipally spoken,a style is a class which changes propertIEs of a control. Instead of writing a custom class which overrIDes the default shapes of a control,styles can do this more elegant. As soon as a control initializes itself (this is when shortly before it gets rendered for the very first time),it looks for a style to use. This can be a named style (Control.Stylename) or a class style. The style comes from the first ancestor control,which contains a StyleDictionary. This is a control of type ContainerControl. For instance,a window is a container control and therefore has a StyleDictionary. Therefore,you can give all buttons on a distinct window another appearance as for a second window. You can also change the style of controls embedded in a panel. As an example,Toolbar contains a Style in is dictionary for any button control to render it different from its default style. But it’s also possible,to overrIDe this default style again.
transformationtransformations can be attached to controls as well as to shapes and their intention is – as the name applIEs – to transform the control or shape. There are transformations to translate the location as well as to scale,or rotate in 3d space. transformations are mostly used for Transitions.
CommandCommands are used to notify ancestor controls about an event that occured. The ancestor (parent) can analyze the command and decIDe whether to do something or not. The command is then bubbled down to the next parent. If and when a command is raised,depends of the class of the control. For instance,a button command raises a command when the button is tapped. However,it is possible to raise any command at any time with RaiseCommand. The explorer example in the demo uses commands to decouple child controls from their parents.
SparseEvent
Many events in Silvermoon are SparseEvents. SparseEvents,as the name implIEs are events which don't consume any storage unless they are used. You can register own sparse events by creating a new static instance,and use AddHandler/RemoveHandler/RaiseEvent to add/remove/raise the event.
System Requirements For Use .NET CF 6.x OpenGL harDWare acceleration capable device Resolution of 192dpi (800x480). (96dpi possible,but not completely tested) For Development Visual Studio 2008 .NET CF 3.5 Emulator is NOT recommended since it does not support OpenGL acceleration. 总结
以上是内存溢出为你收集整理的The basics of Silvermoon全部内容,希望文章能够帮你解决The basics of Silvermoon所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)