/// <summary>Called just after the whole grid has been created.</summary>
		internal void Setup(Scanner scanner){
		
			// Create the search set.
			
			// Get bounds:
			int maxX=scanner.DistanceCacheWidth;
			int maxY=scanner.DistanceCacheHeight;
			
			// How many?
			int count=9;
			
			// Is this square at the max points?
			bool boundsX=(X==0 || X==(maxX-1));
			bool boundsY=(Y==0 || Y==(maxY-1));
			
			if(boundsX && boundsY){
				
				count=4;
				
			}else if(boundsX || boundsY){
				
				count=6;
				
			}
			
			// Create the set:
			SearchSet=new DistanceCacheSquare[count];
			
			int setIndex=0;
			
			// Add each one (in a 3x3 block):
			for(int y=Y-1;y<=(Y+1);y++){
				
				if(y<0 || y==maxY){
					// Out of range.
					continue;
				}
				
				for(int x=X-1;x<=(X+1);x++){
					
					if(x<0 || x==maxX){
						// Out of range.
						continue;
					}
					
					// Get the index:
					int squareIndex=x+(y * scanner.DistanceCacheWidth);
					
					// Get the square:
					SearchSet[setIndex]=scanner.DistanceCache[squareIndex];
					
					setIndex++;
					
				}
				
			}
			
			RecalculateIndex(scanner);
			
		}
		internal void RecalculateIndex(Scanner scanner){
			
			PixelIndexX=X * scanner.BlurSpread;
			PixelIndexY=Y * scanner.BlurSpread;
			
			// Apply x/y:
			XOffset=((float)PixelIndexX) + 0.5f;
			YOffset=((float)PixelIndexY) + 0.5f;
			
		}
//--------------------------------------
		public ScannerScanLine(Scanner scanner){
			
			Scanner=scanner;
			
		}
Ejemplo n.º 5
0
		/// <summary>Sets up InfiniText. Called automatically when the first font is loaded.</summary>
		public static void Start(){
			
			if(Rasteriser!=null){
				return;
			}
			
			UpdateAliasValues();
			
			// Setup and start the rasteriser:
			Rasteriser=new Scanner();
			Rasteriser.SDFSize=SdfSize;
			Rasteriser.DrawHeight=(int)SdfPixelHeight;
			Rasteriser.Start();
			UpdateAliasValues();
			
		}