本文整理汇总了C#中TexImage类的典型用法代码示例。如果您正苦于以下问题:C# TexImage类的具体用法?C# TexImage怎么用?C# TexImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TexImage类属于命名空间,在下文中一共展示了TexImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateArrayTest
public void CreateArrayTest(string file1, string file2)
{
var list = new List<TexImage>();
for (int i = 0; i < 5; ++i)
{
var temp = new TexImage();
fiLib.Execute(temp, new LoadingRequest(file1, false));
list.Add(temp);
temp = new TexImage();
fiLib.Execute(temp, new LoadingRequest(file2, false));
list.Add(temp);
}
var array = new TexImage();
library.Execute(array, new ArrayCreationRequest(list));
Assert.IsTrue(array.ArraySize == list.Count);
//Console.WriteLine("ArrayTexLibrary_CreateArray_" + Path.GetFileName(file1) + "_" + Path.GetFileName(file2) + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
Assert.IsTrue(TestTools.ComputeSHA1(array.Data, array.DataSize).Equals(TestTools.GetInstance().Checksum["ArrayTexLibrary_CreateArray_" + Path.GetFileName(file1) + "_" + Path.GetFileName(file2)]));
array.Dispose();
foreach (var image in list)
{
image.Dispose();
}
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:28,代码来源:ArrayTexLibraryTest.cs
示例2: Execute
public void Execute(TexImage image, IRequest request)
{
switch (request.Type)
{
case RequestType.ArrayCreation:
CreateArray(image, (ArrayCreationRequest)request);
break;
case RequestType.ArrayExtraction:
Extract(image, (ArrayExtractionRequest)request);
break;
case RequestType.ArrayUpdate:
Update(image, (ArrayUpdateRequest)request);
break;
case RequestType.ArrayInsertion:
Insert(image, (ArrayInsertionRequest)request);
break;
case RequestType.ArrayElementRemoval:
Remove(image, (ArrayElementRemovalRequest)request);
break;
case RequestType.CubeCreation:
CreateCube(image, (CubeCreationRequest)request);
break;
default:
Log.Error("ArrayTexLib can't handle this request: " + request.Type);
throw new TextureToolsException("ArrayTexLib can't handle this request: " + request.Type);
}
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:28,代码来源:ArrayTexLib.cs
示例3: StartLibrary
public void StartLibrary(TexImage image)
{
if(image.Format.IsCompressed())
{
Log.Error("FreeImage can't process compressed texture.");
throw new TextureToolsException("FreeImage can't process compressed texture.");
}
var libraryData = new FreeImageTextureLibraryData();
image.LibraryData[this] = libraryData;
libraryData.Bitmaps = new FIBITMAP[image.SubImageArray.Length];
FREE_IMAGE_TYPE type;
uint bpp, redMask, greenMask, blueMask;
if (!FreeImage.GetFormatParameters(image.Format, out type, out bpp, out redMask, out greenMask, out blueMask))
{
throw new ArgumentException("The pixel format '{0}' is not supported by FreeImage".ToFormat(image.Format));
}
for (int i = 0; i < image.SubImageArray.Length; ++i)
{
var data = image.SubImageArray[i].Data;
var width = image.SubImageArray[i].Width;
var heigth = image.SubImageArray[i].Height;
var pitch = image.SubImageArray[i].RowPitch;
libraryData.Bitmaps[i] = FreeImage.ConvertFromRawBits(data, type, width, heigth, pitch, bpp, redMask, greenMask, blueMask, false);
}
if (image.DisposingLibrary != null) image.DisposingLibrary.Dispose(image);
image.DisposingLibrary = this;
libraryData.Data = IntPtr.Zero;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:34,代码来源:FITexLib.cs
示例4: Execute
public void Execute(TexImage image, IRequest request)
{
if (image.GetType() != typeof(TexAtlas))
{
throw new TextureToolsException("The given texture must be an instance of TexAtlas.");
}
TexAtlas atlas = (TexAtlas)image;
switch (request.Type)
{
case RequestType.AtlasCreation:
Create(atlas, (AtlasCreationRequest)request, 0);
break;
case RequestType.AtlasExtraction:
Extract(atlas, (AtlasExtractionRequest)request);
break;
case RequestType.AtlasUpdate:
Update(atlas, (AtlasUpdateRequest)request);
break;
default:
Log.Error("AtlasTexLibrary can't handle this request: " + request.Type);
throw new TextureToolsException("AtlasTexLibrary can't handle this request: " + request.Type);
}
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:26,代码来源:AtlasTexLibrary.cs
示例5: StartLibrary
public void StartLibrary(TexImage image)
{
if (image.LibraryData.ContainsKey(this) && ((DxtTextureLibraryData)image.LibraryData[this]).DxtImages[0].pixels.Equals(image.Data)) return;
DxtTextureLibraryData libraryData = new DxtTextureLibraryData();
image.LibraryData[this] = libraryData;
DXGI_FORMAT format = RetrieveNativeFormat(image.Format);
libraryData.DxtImages = new DxtImage[image.SubImageArray.Length];
for (int i = 0; i < image.SubImageArray.Length; ++i)
{
libraryData.DxtImages[i] = new DxtImage(image.SubImageArray[i].Width, image.SubImageArray[i].Height, format, image.SubImageArray[i].RowPitch, image.SubImageArray[i].SlicePitch, image.SubImageArray[i].Data);
}
switch (image.Dimension)
{
case TexImage.TextureDimension.Texture1D:
libraryData.Metadata = new TexMetadata(image.Width, image.Height, image.Depth, image.ArraySize, image.MipmapCount, 0, 0, format, TEX_DIMENSION.TEX_DIMENSION_TEXTURE1D); break;
case TexImage.TextureDimension.Texture2D:
libraryData.Metadata = new TexMetadata(image.Width, image.Height, image.Depth, image.ArraySize, image.MipmapCount, 0, 0, format, TEX_DIMENSION.TEX_DIMENSION_TEXTURE2D); break;
case TexImage.TextureDimension.Texture3D:
libraryData.Metadata = new TexMetadata(image.Width, image.Height, image.Depth, image.ArraySize, image.MipmapCount, 0, 0, format, TEX_DIMENSION.TEX_DIMENSION_TEXTURE3D); break;
case TexImage.TextureDimension.TextureCube:
libraryData.Metadata = new TexMetadata(image.Width, image.Height, image.Depth, image.ArraySize, image.MipmapCount, TEX_MISC_FLAG.TEX_MISC_TEXTURECUBE, 0, format, TEX_DIMENSION.TEX_DIMENSION_TEXTURE2D); break;
}
libraryData.Image = null;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:31,代码来源:DxtTexLib.cs
示例6: FlipTest
public static void FlipTest(TexImage image, ITexLibrary library, Orientation orientation)
{
library.Execute(image, new FlippingRequest(orientation));
Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["FlipTest_" + orientation + "_" + image.Name]));
//Console.WriteLine("FlipTest_" + orientation + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:TexLibraryTest.cs
示例7: CanHandleRequest
public bool CanHandleRequest(TexImage image, IRequest request)
{
switch (request.Type)
{
case RequestType.Export:
{
string extension = Path.GetExtension(((ExportRequest)request).FilePath);
return extension.Equals(".dds") || extension.Equals(Extension);
}
case RequestType.ExportToXenko:
return true;
case RequestType.Loading: // Xenko can load dds file or his own format or a Xenko <see cref="Image"/> instance.
LoadingRequest load = (LoadingRequest)request;
if(load.Mode == LoadingRequest.LoadingMode.XkImage) return true;
else if(load.Mode == LoadingRequest.LoadingMode.FilePath)
{
string extension = Path.GetExtension(load.FilePath);
return extension.Equals(".dds") || extension.Equals(Extension);
} else return false;
}
return false;
}
开发者ID:cg123,项目名称:xenko,代码行数:25,代码来源:XenkoTexLibrary.cs
示例8: DecompressTest
public static void DecompressTest(TexImage image, ITexLibrary library)
{
Assert.IsTrue(image.Format.IsCompressed());
library.Execute(image, new DecompressingRequest(false));
Assert.IsTrue(image.Format == PixelFormat.R8G8B8A8_UNorm);
Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["DecompressTest_" + image.Name]));
//Console.WriteLine("DecompressTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:8,代码来源:TexLibraryTest.cs
示例9: Load
public static TexImage Load(ITexLibrary library, string file)
{
var image = new TexImage();
library.Execute(image, new LoadingRequest(InputTestFolder + file, false));
image.Name = file;
image.CurrentLibrary = library;
return image;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:8,代码来源:TestTools.cs
示例10: SwitchChannelsTest
public static void SwitchChannelsTest(TexImage image, ITexLibrary library)
{
var isInRgbaOrder = image.Format.IsRGBAOrder();
library.Execute(image, new SwitchingBRChannelsRequest());
Assert.IsTrue(image.Format.IsRGBAOrder() != isInRgbaOrder);
//Console.WriteLine("SwitchChannelsTest_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["SwitchChannelsTest_" + image.Name]));
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:9,代码来源:TexLibraryTest.cs
示例11: StartLibraryTest
/// <summary>
/// The purpose of this test is to show that after calling the StartLibrary method on a TexImage,
/// this image will contain in its LibraryData list the ITextureLibraryData instance corresponding
/// to the actual state of the TexImage.
/// An instance of ITextureLibraryData is creating at the load of the TexImage by the library so we
/// must delete it first for the sake of this test.
/// </summary>
public static void StartLibraryTest(TexImage image, ITexLibrary library)
{
image.LibraryData.Remove(library); // deleting the LibraryData instance
Assert.IsFalse(image.LibraryData.ContainsKey(library));
library.StartLibrary(image);
Assert.IsTrue(image.LibraryData.ContainsKey(library));
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:17,代码来源:TexLibraryTest.cs
示例12: Dispose
public void Dispose(TexImage image)
{
if (!image.LibraryData.ContainsKey(this)) return;
PvrTextureLibraryData libraryData = (PvrTextureLibraryData)image.LibraryData[this];
if (libraryData.Texture != null)
{
libraryData.Header = null;
libraryData.Texture.Dispose();
}
}
开发者ID:Julyuary,项目名称:paradox,代码行数:11,代码来源:PvrttTexLib.cs
示例13: Execute
public void Execute(TexImage image, IRequest request)
{
switch (request.Type)
{
case RequestType.ColorKey:
ApplyColorKey(image, (ColorKeyRequest)request);
break;
default:
Log.Error("ColorKeyTexLibrary can't handle this request: " + request.Type);
throw new TextureToolsException("ColorKeyTexLibrary can't handle this request: " + request.Type);
}
}
开发者ID:Powerino73,项目名称:paradox,代码行数:12,代码来源:ColorKeyTexLibrary.cs
示例14: CanHandleRequest
public bool CanHandleRequest(TexImage image, IRequest request)
{
switch (request.Type)
{
case RequestType.Compressing:
return SupportFormat(((CompressingRequest)request).Format) && SupportFormat(image.Format);
case RequestType.Decompressing:
return SupportFormat(image.Format);
default:
return false;
}
}
开发者ID:Powerino73,项目名称:paradox,代码行数:13,代码来源:AtitcTexLibrary.cs
示例15: StartLibraryTest
public void StartLibraryTest(string file)
{
TexImage image = new TexImage();
var dxtLib = new DxtTexLib();
dxtLib.Execute(image, new LoadingRequest(Module.PathToInputImages + file, false));
image.CurrentLibrary = dxtLib;
dxtLib.EndLibrary(image);
TexLibraryTest.StartLibraryTest(image, library);
image.Dispose();
}
开发者ID:Julyuary,项目名称:paradox,代码行数:13,代码来源:PvrttTexLibTest.cs
示例16: Dispose
public void Dispose(TexImage image)
{
DxtTextureLibraryData libraryData = (DxtTextureLibraryData)image.LibraryData[this];
if (libraryData.Image == null && libraryData.DxtImages != null)
{
ScratchImage img = new ScratchImage();
img.InitializeFromImages(libraryData.DxtImages, libraryData.DxtImages.Length);
img.Release();
}
else
{
libraryData.Image.Dispose();
}
}
开发者ID:releed,项目名称:paradox,代码行数:15,代码来源:DxtTexLib.cs
示例17: StartLibrary
public void StartLibrary(TexImage image)
{
AtitcTextureLibraryData libraryData = new AtitcTextureLibraryData();
image.LibraryData[this] = libraryData;
libraryData.Textures = new Texture[image.SubImageArray.Length];
int bpp = (int)image.Format.GetBPP();
for (int i = 0; i < image.SubImageArray.Length; ++i)
{
libraryData.Textures[i] = new Texture(image.SubImageArray[i].Width, image.SubImageArray[i].Height, image.SubImageArray[i].RowPitch, RetrieveNativeFormat(image.Format), image.SubImageArray[i].DataSize, image.SubImageArray[i].Data);
}
libraryData.Data = IntPtr.Zero;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:16,代码来源:AtitcTexLibrary.cs
示例18: StartLibrary
public void StartLibrary(TexImage image)
{
AtitcTextureLibraryData libraryData = new AtitcTextureLibraryData();
image.LibraryData[this] = libraryData;
libraryData.Textures = new Texture[image.SubImageArray.Length];
var bpp = Paradox.Graphics.PixelFormatExtensions.SizeInBits(image.Format);
for (int i = 0; i < image.SubImageArray.Length; ++i)
{
libraryData.Textures[i] = new Texture(image.SubImageArray[i].Width, image.SubImageArray[i].Height, image.SubImageArray[i].RowPitch, RetrieveNativeFormat(image.Format), image.SubImageArray[i].DataSize, image.SubImageArray[i].Data);
}
libraryData.Data = IntPtr.Zero;
}
开发者ID:releed,项目名称:paradox,代码行数:16,代码来源:AtitcTexLibrary.cs
示例19: FixedRescaleTest
public static void FixedRescaleTest(TexImage image, ITexLibrary library, Filter.Rescaling filter)
{
var request = new FixedRescalingRequest(256, 256, filter);
int width = request.ComputeWidth(image);
int height = request.ComputeHeight(image);
library.Execute(image, request);
Assert.IsTrue(image.Width == width);
Assert.IsTrue(image.Height == height);
Assert.IsTrue(image.MipmapCount == 1);
image.Update();
Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["FixedRescaleTest_" + filter + "_" + image.Name]));
//Console.WriteLine("FixedRescaleTest_" + filter + "_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize));
}
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:16,代码来源:TexLibraryTest.cs
示例20: CanHandleRequest
public bool CanHandleRequest(TexImage image, IRequest request)
{
switch (request.Type)
{
case RequestType.ArrayCreation:
case RequestType.ArrayExtraction:
case RequestType.ArrayUpdate:
case RequestType.ArrayInsertion:
case RequestType.ArrayElementRemoval:
case RequestType.CubeCreation:
return true;
default:
return false;
}
}
开发者ID:cg123,项目名称:xenko,代码行数:16,代码来源:ArrayTexLib.cs
注:本文中的TexImage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论