当前位置: 首页>>代码示例>>C#>>正文


C# Icon.Crop方法代码示例

本文整理汇总了C#中Icon.Crop方法的典型用法代码示例。如果您正苦于以下问题:C# Icon.Crop方法的具体用法?C# Icon.Crop怎么用?C# Icon.Crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Icon的用法示例。


在下文中一共展示了Icon.Crop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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 );
		}
开发者ID:bloxgate,项目名称:som--tg-station,代码行数:101,代码来源:GlobalFuncs.cs


注:本文中的Icon.Crop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。