コード例 #1
0
ファイル: Texture3D.cs プロジェクト: Daramkun/Misty
 public Texture3D( IGraphicsDevice graphicsDevice, ImageInfo [] imageInfo, Color? colorKey = null, int mipmapLevel = 1 )
 {
     MakeTexture ( imageInfo [ 0 ].Width, imageInfo [ 0 ].Height, imageInfo.Length );
     Color [] colours = new Color [ imageInfo [ 0 ].Width * imageInfo [ 0 ].Height * imageInfo.Length ];
     int index = 0;
     foreach ( ImageInfo i in imageInfo )
     {
         Color [] decoded = i.GetPixels ( colorKey );
         decoded.CopyTo ( colours, index );
         index += decoded.Length;
     }
     Buffer = colours;
     GenerateMipmap ( mipmapLevel );
 }
コード例 #2
0
ファイル: TrueTypeFont.cs プロジェクト: Daramkun/Misty
        protected override ITexture2D this[char ch]
        {
            get
            {
                if ( noneList.Contains ( ch ) ) return null;
                if ( readedImage.ContainsKey ( ch ) ) return readedImage [ ch ];

                if ( ch == ' ' )
                {
                    Color [] buffer = new Color [ fontSizeOfPixel * ( fontSizeOfPixel / 3 ) ];
                    ImageInfo imageInfo = new ImageInfo ( fontSizeOfPixel / 3, fontSizeOfPixel, 1, null, buffer, ( ImageInfo i, object rawData, int ii, Color? colorKey ) =>
                    {
                        return rawData as Color [];
                    } );
                    ITexture2D texture = Core.GraphicsDevice.CreateTexture2D ( imageInfo );
                    readedImage.Add ( ch, texture );
                    return texture;
                }
                else
                {
                    int width, height, xOffset, yOffset;
                    byte [] data = trueType.GetCodepointBitmap ( ch, fontSize, fontSize, out width, out height, out xOffset, out yOffset );

                    if ( data == null || data.Length == 0 )
                    { noneList.Add ( ch ); return null; }

                    int extendedHeight = Math.Abs ( yOffset ) * ( width );
                    Color [] buffer = new Color [ ( width ) * fontSizeOfPixel ];
                    for ( int x = 0; x < width; x++ )
                    {
                        for ( int y = 0; y < height; y++ )
                        {
                            int dataIndex = ( y * width ) + x;
                            int index = ( ( y + ( fontSizeOfPixel / 3 * 2 ) + yOffset ) * ( width ) ) + x;
                            if ( index >= buffer.Length || index < 0 ) continue;
                            buffer [ index ] = data [ dataIndex ] > 0 ? new Color ( 255, 255, 255, data [ dataIndex ] ) : new Color ( 0, 0, 0, 0 );
                        }
                    }

                    ImageInfo imageInfo = new ImageInfo ( width, fontSizeOfPixel, 1, null, buffer, ( ImageInfo i, object rawData, int ii, Color? colorKey ) =>
                    {
                        return rawData as Color [];
                    } );
                    ITexture2D texture = Core.GraphicsDevice.CreateTexture2D ( imageInfo );
                    readedImage.Add ( ch, texture );
                    return texture;
                }
            }
        }
コード例 #3
0
ファイル: PackageInfo.cs プロジェクト: Daramkun/Misty
        public PackageInfo( string packageName, string author, string copyright, string description, Version version, DateTime releaseDate,
			bool isSubPackage, Guid [] mainPackageIds, StringTable stringTable, ResourceTable resourceTable, ImageInfo imageInfo = null, Guid? packageId = null )
        {
            PackageName = packageName;

            Author = author;
            Copyright = copyright;
            Description = description;

            PackageID = ( packageId == null ) ? Guid.NewGuid () : packageId.Value;
            Version = version;
            ReleaseDate = releaseDate;

            if ( imageInfo != null )
                PackageCover = imageInfo;

            IsSubPackage = isSubPackage;
            MainPackageIDs = mainPackageIds;

            StringTable = stringTable;
            ResourceTable = resourceTable;

            IsSettingCompleted = true;
        }
コード例 #4
0
ファイル: Texture1D.cs プロジェクト: Daramkun/Misty
 public Texture1D( IGraphicsDevice graphicsDevice, ImageInfo imageInfo, Color? colorKey = null, int mipmapLevel = 1 )
 {
     MakeTexture ( imageInfo.Width );
     Buffer = imageInfo.GetPixels ( colorKey );
     GenerateMipmap ( mipmapLevel );
 }
コード例 #5
0
ファイル: Texture2D.cs プロジェクト: Daramkun/Misty
 public Texture2D( IGraphicsDevice graphicsDevice, ImageInfo imageInfo, Color? colorKey = null, int mipmapLevel = 1 )
     : this(graphicsDevice, imageInfo.Width, imageInfo.Height)
 {
     Buffer = imageInfo.GetPixels ( colorKey );
 }
コード例 #6
0
ファイル: SpriteNode.cs プロジェクト: Daramkun/Misty
 public SpriteNode( ImageInfo imageInfo, Color? colorKey = null )
     : this(Core.GraphicsDevice.CreateTexture2D ( imageInfo, colorKey ))
 {
 }