public virtual void Transform(VectorTransform transform)
        {
            float x = X;

            X = (transform.XScale * x + transform.Scale01 * Y + transform.Dx);
            Y = (transform.Scale10 * x + transform.YScale * Y + transform.Dy);
        }
Exemplo n.º 2
0
        public override void Transform(VectorTransform transform)
        {
            float x = Control1X;

            Control1X = (transform.XScale * x + transform.Scale01 * Control1Y + transform.Dx);
            Control1Y = (transform.Scale10 * x + transform.YScale * Control1Y + transform.Dy);

            base.Transform(transform);
        }
        public override void Transform(VectorTransform transform)
        {
            float x = CircleCenterX;

            CircleCenterX = (transform.XScale * x + transform.Scale01 * CircleCenterY + transform.Dx);
            CircleCenterY = (transform.Scale10 * x + transform.YScale * CircleCenterY + transform.Dy);

            base.Transform(transform);
        }
		public override void Transform(VectorTransform transform){
			
			float x=Control2X;
			Control2X=(transform.XScale * x + transform.Scale01 * Control2Y + transform.Dx);
			Control2Y=(transform.Scale10 * x + transform.YScale * Control2Y + transform.Dy);
			
			base.Transform(transform);
			
		}
		public override void Transform(VectorTransform transform){
			
			float x=CircleCenterX;
			CircleCenterX=(transform.XScale * x + transform.Scale01 * CircleCenterY + transform.Dx);
			CircleCenterY=(transform.Scale10 * x + transform.YScale * CircleCenterY + transform.Dy);
			
			base.Transform(transform);
			
		}
		public void AddComponent(VectorTransform component){
			
			if(FirstComponent==null){
				
				// Set as only one:
				FirstComponent=LastComponent=component;
				
			}else{
				
				// Push to the end:
				LastComponent=LastComponent.Next=component;
				
			}
			
		}
		private void TransformPoints(Glyph fromGlyph,VectorTransform transform){
			VectorPoint current=fromGlyph.FirstPathNode;
			
			while(current!=null){
				
				// Create a new one:
				VectorPoint newPoint = current.Copy();
				
				// Apply transformed pos:
				newPoint.Transform(transform);
				
				// Add it:
				AddPathNode(newPoint);
				
				current=current.Next;
				
			}
			
		}
Exemplo n.º 8
0
		public static Glyph ParseGlyph(FontParser parser,FontFace font,float range){
			
			// How many contours has it got?
			int contourCount=parser.ReadInt16();
			
			// Skip bounds - we don't trust these too much, so we'll figure them out ourselves:
			parser.Position+=8;
			
			if(contourCount>0){
				// This glyph is not a composite.
				
				// Create the glyph:
				Glyph glyph=new Glyph(font);
				
				if(Fonts.Preload){
					
					LoadGlyph(glyph,contourCount,parser,range);
					
				}else{
					
					// Increase unloaded count:
					font.UnloadedGlyphs++;
					
					// Add position info:
					glyph.AddPathNode(new LoadMetaPoint(parser.Position,contourCount));
					
				}
				
				return glyph;
				
			}else if(contourCount==0){
				
				// Empty glyph e.g. space. Create the glyph:
				Glyph glyph=new Glyph(font);
				
				return glyph;
				
			}
			
			CompositeGlyph compGlyph=new CompositeGlyph(font);
			
			bool moreComponents=true;
			
			while(moreComponents){
			
				ushort cFlags=parser.ReadUInt16();
				ushort glyphIndex=parser.ReadUInt16();
				
				VectorTransform component=new VectorTransform(glyphIndex);
				
				if ((cFlags & 1) > 0) {
					// The arguments are words
					component.Dx = (float)parser.ReadInt16() / range;
					component.Dy = (float)parser.ReadInt16() / range;
				} else {
					// The arguments are bytes
					component.Dx = (float)parser.ReadByte()  / range;
					component.Dy = (float)parser.ReadByte()  / range;
				}
				
				if ((cFlags & 8) > 0) {
					// We have one scale
					component.XScale = component.YScale = parser.ReadF2Dot14();
				} else if ((cFlags & 64) > 0) {
					// We have an X / Y scale
					component.XScale = parser.ReadF2Dot14();
					component.YScale = parser.ReadF2Dot14();
				} else if ((cFlags & 128) > 0) {
					// We have a 2x2 transformation
					component.XScale = parser.ReadF2Dot14();
					component.Scale01 = parser.ReadF2Dot14();
					component.Scale10 = parser.ReadF2Dot14();
					component.YScale = parser.ReadF2Dot14();
				}
				
				// Push the component to the end:
				compGlyph.AddComponent(component);
				
				moreComponents = ((cFlags & 32)==32);
			}
			
			return compGlyph;
			
		}
//--------------------------------------