本文整理汇总了C#中Icon.Width方法的典型用法代码示例。如果您正苦于以下问题:C# Icon.Width方法的具体用法?C# Icon.Width怎么用?C# Icon.Width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icon
的用法示例。
在下文中一共展示了Icon.Width方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AverageColour
// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
public static dynamic AverageColour( Icon I = null ) {
ByTable colours = null;
double? x_pixel = null;
double? y_pixel = null;
string this_colour = null;
dynamic final_average = null;
dynamic colour = null;
colours = new ByTable();
x_pixel = null;
foreach (dynamic _b in Lang13.iter_range( 1, I.Width() ) ) {
x_pixel = _b;
y_pixel = null;
foreach (dynamic _a in Lang13.iter_range( 1, I.Height() ) ) {
y_pixel = _a;
this_colour = I.GetPixel( x_pixel, y_pixel );
if ( Lang13.Bool( this_colour ) ) {
colours.Add( this_colour );
}
};
};
if ( !( colours.len != 0 ) ) {
return null;
}
final_average = colours[1];
colour = null;
foreach (dynamic _c in colours - colours[1] ) {
colour = _c;
final_average = GlobalFuncs.BlendRGB( final_average, colour, 1 );
};
return final_average;
}
示例2: get_turf_pixel
// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
public static Tile get_turf_pixel( BaseStatic AM = null ) {
Matrix M = null;
double pixel_x_offset = 0;
double pixel_y_offset = 0;
Icon AMicon = null;
int rough_x = 0;
int rough_y = 0;
dynamic T = null;
dynamic final_x = null;
dynamic final_y = null;
if ( !( AM is BaseDynamic ) ) {
return null;
}
M = Num13.matrix( ((dynamic)AM).transform );
pixel_x_offset = AM.pixel_x + Lang13.Double( M.get_x_shift() );
pixel_y_offset = AM.pixel_y + Lang13.Double( M.get_y_shift() );
if ( Lang13.Int( ((dynamic)AM).bound_height ) != Game13.icon_size || Lang13.Int( ((dynamic)AM).bound_width ) != Game13.icon_size ) {
AMicon = new Icon( ((dynamic)AM).icon, ((dynamic)AM).icon_state );
pixel_x_offset += ( AMicon.Width() / Game13.icon_size - 1 ) * Game13.icon_size * 0.5;
pixel_y_offset += ( AMicon.Height() / Game13.icon_size - 1 ) * Game13.icon_size * 0.5;
GlobalFuncs.qdel( AMicon );
}
rough_x = Num13.floor( Num13.round( pixel_x_offset, Game13.icon_size ) / Game13.icon_size );
rough_y = Num13.floor( Num13.round( pixel_y_offset, Game13.icon_size ) / Game13.icon_size );
T = GlobalFuncs.get_turf( AM );
final_x = T.x + rough_x;
final_y = T.y + rough_y;
if ( Lang13.Bool( final_x ) || Lang13.Bool( final_y ) ) {
return Map13.get_tile_at( Lang13.Int( final_x ), Lang13.Int( final_y ), Lang13.Int( T.z ) );
}
return null;
}
示例3: getFlatIcon
//.........这里部分代码省略.........
curblend = defblend;
} else {
curblend = Lang13.IntNullable( A.blend_mode );
}
layers = new ByTable();
if ( !noIcon ) {
copy = new Image( curicon, null, curstate, A.layer, curdir );
copy.color = A.color;
copy.alpha = A.alpha;
copy.blend_mode = curblend;
layers[copy] = A.layer;
}
process = A.underlays;
pSet = false;
curIndex = 1;
while (GlobalVars.TRUE) {
if ( curIndex <= Lang13.Double( process.len ) ) {
current = process[curIndex];
if ( !Lang13.Bool( current ) ) {
curIndex++;
continue;
}
currentLayer = current.layer;
if ( Lang13.Double( currentLayer ) < 0 ) {
if ( Lang13.Double( currentLayer ) <= -1000 ) {
return flat;
}
if ( !pSet ) {
currentLayer = A.layer + currentLayer / 1000;
} else {
currentLayer = A.layer + ( currentLayer + 1000 ) / 1000;
}
}
cmpIndex = 1;
while (cmpIndex <= layers.len) {
compare = layers[cmpIndex];
if ( Lang13.Double( currentLayer ) < Lang13.Double( layers[compare] ) ) {
layers.Insert( cmpIndex, current );
layers[current] = currentLayer;
break;
}
cmpIndex++;
}
if ( cmpIndex > layers.len ) {
layers[current] = currentLayer;
}
curIndex++;
}
if ( curIndex > Lang13.Double( process.len ) ) {
if ( !pSet ) {
curIndex = 1;
pSet = true;
process = A.overlays;
} else {
break;
}
}
}
add = null;
flatX1 = 1;
flatX2 = flat.Width();
flatY1 = 1;
flatY2 = flat.Height();
addX1 = null;
addX2 = null;
addY1 = null;
addY2 = null;
I = null;
foreach (dynamic _a in layers ) {
I = _a;
if ( Lang13.Bool( I.alpha ) == false ) {
continue;
}
if ( I == copy ) {
curblend = GlobalVars.BLEND_OVERLAY ?1:0;
add = new Icon( I.icon, I.icon_state, Lang13.IntNullable( I.dir ) );
} else {
add = GlobalFuncs.getFlatIcon( new Image( I ), curdir, curicon, curstate, curblend );
}
addX1 = Num13.minInt( flatX1 ??0, Lang13.Int( I.pixel_x + 1 ) );
addX2 = Num13.maxInt( flatX2 ??0, Lang13.Int( I.pixel_x + add.Width() ) );
addY1 = Num13.minInt( flatY1 ??0, Lang13.Int( I.pixel_y + 1 ) );
addY2 = Num13.maxInt( flatY2 ??0, Lang13.Int( I.pixel_y + add.Height() ) );
if ( addX1 != flatX1 || addX2 != flatX2 || addY1 != flatY1 || addY2 != flatY2 ) {
flat.Crop( ( addX1 ??0) - ( flatX1 ??0) + 1, ( addY1 ??0) - ( flatY1 ??0) + 1, ( addX2 ??0) - ( flatX1 ??0) + 1, ( addY2 ??0) - ( flatY1 ??0) + 1 );
flatX1 = addX1;
flatX2 = addX2;
flatY1 = addY1;
flatY2 = addY2;
}
flat.Blend( add, GlobalFuncs.blendMode2iconMode( curblend ), Lang13.IntNullable( I.pixel_x + 2 - flatX1 ), Lang13.IntNullable( I.pixel_y + 2 - flatY1 ) );
};
if ( Lang13.Bool( A.color ) ) {
flat.Blend( A.color, 2 );
}
if ( Lang13.Double( A.alpha ) < 255 ) {
flat.Blend( String13.color_code( 255, 255, 255, Lang13.Int( A.alpha ) ), 2 );
}
return new Icon( flat, "", GlobalVars.SOUTH );
}
示例4: DrawPixel
// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
public static dynamic DrawPixel( Icon I = null, string colour = null, double drawX = 0, double drawY = 0 ) {
double Iwidth = 0;
double Iheight = 0;
if ( !( I != null ) ) {
return 0;
}
Iwidth = I.Width();
Iheight = I.Height();
if ( drawX > Iwidth || drawX <= 0 ) {
return 0;
}
if ( drawY > Iheight || drawY <= 0 ) {
return 0;
}
I.DrawBox( colour, drawX, drawY );
return I;
}