本文整理汇总了C#中System.Image.Decode方法的典型用法代码示例。如果您正苦于以下问题:C# Image.Decode方法的具体用法?C# Image.Decode怎么用?C# Image.Decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Image
的用法示例。
在下文中一共展示了Image.Decode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateImage
private void UpdateImage()
{
Image image = new Image(ImageMode.Rgba,new ImageSize(110,100),new ImageColor(0,0,0,0));
Font font = new Font(FontAlias.System,50,FontStyle.Regular);
image.DrawText(playerScore + " - " + aiScore,new ImageColor(255,255,255,255),font,new ImagePosition(0,0));
image.Decode();
var texture = new Texture2D(110,100,false,PixelFormat.Rgba);
if(this.TextureInfo.Texture != null)
this.TextureInfo.Texture.Dispose();
this.TextureInfo.Texture = texture;
texture.SetPixels(0,image.ToBuffer());
font.Dispose();
image.Dispose();
}
示例2: UpdateImage
public static void UpdateImage(string highScores)
{
Image image = new Image(ImageMode.Rgba,new ImageSize(960,544),new ImageColor(0,0,0,0));
Font font = new Font(FontAlias.System,25,FontStyle.Regular);
image.DrawText("High Scores: " + highScores,new ImageColor(255,255,255,255),font,new ImagePosition(25,100));
image.Decode();
var texture = new Texture2D(960,544,false,PixelFormat.Rgba);
if(textInfo.Texture != null)
textInfo.Texture.Dispose();
textInfo.Texture = texture;
texture.SetPixels(0,image.ToBuffer());
font.Dispose();
image.Dispose();
}
示例3: Initialize
private void Initialize()
{
_imgTop = new Image("Application/assets/images/topSide.png");
_imgTop.Decode();
_imgLeft = new Image("Application/assets/images/leftSide.png");
_imgLeft.Decode();
_imgRight = new Image("Application/assets/images/rightSide.png");
_imgRight.Decode();
_imgTopStripe = new Image("Application/assets/images/stripeTop.png");
_imgTopStripe.Decode();
_imgLeftStripe = new Image("Application/assets/images/stripeLeft.png");
_imgLeftStripe.Decode();
_imgRightStripe = new Image("Application/assets/images/stripeRight.png");
_imgRightStripe.Decode();
_imgTopDot = new Image("Application/assets/images/dotTop.png");
_imgTopDot.Decode();
_imgLeftDot = new Image("Application/assets/images/dotLeft.png");
_imgLeftDot.Decode();
_imgRightDot = new Image("Application/assets/images/dotRight.png");
_imgRightDot.Decode();
initialized = true;
}
示例4: UpdateImage
public static void UpdateImage(int score)
{
Image image = new Image(ImageMode.Rgba,new ImageSize(960,544),new ImageColor(0,0,0,0));
Font font = new Font(FontAlias.System,20,FontStyle.Regular);
image.DrawText("Your Total Score: " + score,new ImageColor(255,255,255,255),font,new ImagePosition(25,125));
image.Decode();
//var texture = new Texture2D(960,544,false,PixelFormat.Rgba);
//if(textInfo.Texture != null)
//textInfo.Texture.Dispose();
//textInfo.Texture = texture;
//texture.SetPixels(0,image.ToBuffer());
font.Dispose();
image.Dispose();
}
示例5: CutTexture
private Texture2D CutTexture(string path, BoundBox rectangle)
{
ImageRect imageRect = new ImageRect ((int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);
if(System.IO.File.Exists(@"/Application/Content/Pic/" + path))
{
Image image = new Image (@"/Application/Content/Pic/" + path);
image.Decode ();
texture = new Texture2D ((int)rectangle.Width, (int)rectangle.Height, false, PixelFormat.Rgba);
texture.SetPixels (0, image.Crop (imageRect).ToBuffer ());
image.Dispose ();
}
else
DebugScene.Instance.WriteLine("未找到文件:Pic/" + path);
return texture;
}
示例6: UpdateTexture2D
public void UpdateTexture2D()
{
if (null == sm_Texture2D)
{
return;
}
if (null == Buffer)
{
return;
}
DateTime now = DateTime.Now;
long ival_100ns = now.Ticks - m_BaseTime.Ticks;
int index = (int)((ival_100ns / 10000000.0) / (movie.MicroSecPerFrame / 1000000.0));
if (movie.TotalFrames <= index) {
index = movie.TotalFrames -1;
}
AviOldIndexEntry entry = movie.VideoEntryList[index];
int size = entry.Size;
int offset = entry.Offset;
BinaryReader reader = new BinaryReader(File.OpenRead(movie.MovieFileDir + "/" + fileName));
reader.BaseStream.Seek(movie.MoviIndex + 4 + 4 + offset, SeekOrigin.Begin);
byte[] tmp = reader.ReadBytes(size);
reader.Close();
reader.Dispose();
if (tmp.Length != 0) {
Image img = new Image(tmp);
img.Decode();
Buffer = img.ToBuffer();
sm_Texture2D.SetPixels(0, Buffer);
img.Dispose();
}
}
示例7: UpdateSkillPoint
/// <summary>
/// スキルポイントの表示を更新
/// </summary>
/// <param name='skillPoint'>
/// skillPointだけ増加させる。マイナスの値も可
/// </param>
public static void UpdateSkillPoint(int skillPoint){
if((Global.skillPoint + skillPoint >= 0) && (Global.skillPoint + skillPoint <= 3)){
Global.skillPoint += skillPoint;
Scenes.sceneOnGame.RemoveChild(skillPointSprite,true);
var baseImage = new Image("Application/resourses/SPgause.png");
var starImage = new Image("Application/resourses/star.png");
baseImage.Decode();
starImage.Decode();
for(int i = 0; i < Global.skillPoint; i++){
baseImage.DrawImage(starImage,new ImagePosition(40*(i+1),0));
}
var texture = Convert.CreateTextureFromImage(baseImage);
var textureInfo = new TextureInfo(texture);
skillPointSprite = new SpriteUV(){TextureInfo = textureInfo};
skillPointSprite.Quad.S = textureInfo.TextureSizef;
skillPointSprite.CenterSprite(new Vector2(0,0));
skillPointSprite.Position = new Vector2(0,490);
Scenes.sceneOnGame.AddChild(skillPointSprite);
}
}
示例8: SkillUseEffect
/// <summary>
/// スキル使用時エフェクト
/// </summary>
/// <param name='mySpritePosition'>
/// 自機スプライトの位置
/// </param>
public static void SkillUseEffect(Vector2 mySpritePosition)
{
var image1 = new Image("/Application/resourses/Bullet01_64x64.png");
image1 = image1.Crop(new ImageRect(0,0,64,64));
var image2 = new Image("/Application/resourses/effect1.png");
image2 = image2.Resize(new ImageSize(960,180));
var waveTexture = Convert.CreateTextureFromImage(image1);
image2.Decode();
var bgTexture = Convert.CreateTextureFromImage(image2);
image1.Dispose();
image2.Dispose();
var skillName = "";
switch(Global.setSkill){
case SkillID.Default :
skillName = "The WORLD";
break;
case SkillID.Skill1 :
skillName = "Refrection";
break;
case SkillID.Skill2 :
skillName = "";
break;
case SkillID.Skill3 :
skillName = "";
break;
}
var textTexture = Convert.CreateTextureFromText(skillName,new Font(FontAlias.System,120,FontStyle.Bold | FontStyle.Italic),0xFFFFFF00) ;
waveTextureInfo = new TextureInfo(waveTexture);
textTextureInfo = new TextureInfo(textTexture);
bgTextureInfo = new TextureInfo(bgTexture);
waveSprite = new SpriteUV(){TextureInfo = waveTextureInfo};
textSprite = new SpriteUV(){TextureInfo = textTextureInfo};
bgSprite = new SpriteUV(){TextureInfo = bgTextureInfo};
waveSprite.Quad.S = waveTextureInfo.TextureSizef;
textSprite.Quad.S = textTextureInfo.TextureSizef;
bgSprite.Quad.S = bgTextureInfo.TextureSizef;
waveSprite.CenterSprite();
textSprite.CenterSprite();
bgSprite.CenterSprite();
waveSprite.Position = mySpritePosition;
textSprite.Position = new Vector2(1500,272);
bgSprite.Position = new Vector2(1500,272);
Scenes.sceneOnGame.AddChild(waveSprite);
Scenes.sceneOnGame.AddChild(bgSprite);
Scenes.sceneOnGame.AddChild(textSprite);
var seq0 = new Sequence();
seq0.Add(new MoveTo(new Vector2(480,272),1));
seq0.Add(new DelayTime(1.0f));
seq0.Add(new MoveTo(new Vector2(-500,272),1));
var seq1 = new Sequence();
seq1.Add(new MoveTo(new Vector2(480,272),1));
seq1.Add(new DelayTime(1.0f));
seq1.Add(new MoveTo(new Vector2(-500,272),1));
var seq2 = new Sequence();
seq2.Add(new DelayTime(3.5f));
seq2.Add(new CallFunc(()=>{Sounds.PlaySkill2();}));
seq2.Add(new ScaleTo(new Vector2(40,40),3));
Sounds.PlaySkill1();
bgSprite.RunAction(seq0);
textSprite.RunAction(seq1);
waveSprite.RunAction(seq2);
}