本文整理汇总了C#中Byte4类的典型用法代码示例。如果您正苦于以下问题:C#Byte4类的具体用法?C#Byte4怎么用?C#Byte4使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:GetDiamond
//////////////////////////////////////////////////////////////////////////
///
///返回一个菱形Texture2D
///
publicstaticTexture2DGetDiamond(intwidth,intheight,Colorcolor,Gamegame)
{
Texture2DttDmd=newTexture2D(game.GraphicsDevice,width,height);
Byte4[]btDmd=newByte4[width*height];
Vector2vtO=newVector2(width/2f,height/2f);
//PointptPos=newPoint(i/ttRound.Width,i%ttRound.Width);
//ptPos.X=Rownumber,ptPos.Y=Colnumber
for(intx=0;x<=width/2;x++)
{
for(inty=0;y<=height/2;y++)
{
if(width/2f*y+height/2f*x>=width*height/4f)
{
uintpacked=(uint)(
(color.A<<24)+
(color.B<<16)+
(color.G<<8)+
color.R
);
btDmd[Vector2ToIndex(newVector2(x,y),width)].PackedValue=packed;
if(x!=0)
btDmd[Vector2ToIndex(newVector2(width-x,y),width)].PackedValue=packed;
if(y!=0)
btDmd[Vector2ToIndex(newVector2(x,height-y),width)].PackedValue=packed;
if(x!=0&&y!=0)
btDmd[Vector2ToIndex(newVector2(width-x,height-y),width)].PackedValue=packed;
}
}
}
ttDmd.SetData
(btDmd);
returnttDmd;
}
原文链接:http://www.jxszl.com/biancheng/C/556621.html