當前位置: 首頁>>代碼示例>>C#>>正文


C# Bitmap.copy方法代碼示例

本文整理匯總了C#中Bitmap.copy方法的典型用法代碼示例。如果您正苦於以下問題:C# Bitmap.copy方法的具體用法?C# Bitmap.copy怎麽用?C# Bitmap.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bitmap的用法示例。


在下文中一共展示了Bitmap.copy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: onActivityResult

		protected internal override void onActivityResult(int requestCode, int resultCode, Intent data)
		{
			base.onActivityResult(requestCode, resultCode, data);

			if (resultCode == RESULT_OK)
			{
				if (data == null)
				{
					return;
				}

				if (requestCode == REQUEST_CODE_SELECT_IMAGE_BACKGROUND)
				{
					Uri imageFileUri = data.Data;
					string strBackgroundImagePath = AnimationUtils.getRealPathFromURI(this, imageFileUri);

					// Check Valid Image File
					if (!AnimationUtils.isValidImagePath(strBackgroundImagePath))
					{
						Toast.makeText(this, "Invalid image path or web image", Toast.LENGTH_LONG).show();
						return;
					}

					// Set background image on the image view
					bmBackgroundBitmap = AnimationUtils.getSafeResizingBitmap(strBackgroundImagePath, mBackgroudnImageView.Width / 2, mBackgroudnImageView.Height / 2);

					if (bmBackgroundBitmap != null)
					{
						// mBackgroudnImageView.setImageBitmap(bmBackgroundBitmap);
						bmFilteredBitmap = bmBackgroundBitmap.copy(Bitmap.Config.ARGB_8888, true);

						if (mImageOperation != SifImageFilter.FILTER_ORIGINAL)
						{
							bmFilteredBitmap = SifImageFilter.filterImageCopy(bmBackgroundBitmap, mImageOperation, mImageOperationLevel);
							if (bmFilteredBitmap != null)
							{
								mBackgroudnImageView.ImageBitmap = bmFilteredBitmap;
							}
							else
							{
								Toast.makeText(mContext, "Fail to apply image filter", Toast.LENGTH_LONG).show();
							}
						}

						if (bmFilteredBitmap != null)
						{
							bmFilteredBitmap = bmFilteredBitmap.copy(Bitmap.Config.ARGB_8888, false);
							SifImageFilter.setImageTransparency(bmFilteredBitmap, mTransparency);
							mBackgroudnImageView.ImageBitmap = bmFilteredBitmap;
						}
						// reset the transparency
						mTransparency = 0;
					}
					else
					{
						Toast.makeText(mContext, "Fail to set Background Image Path.", Toast.LENGTH_LONG).show();
					}
				}
			}
		}
開發者ID:moljac,項目名稱:Samples.Data.Porting,代碼行數:60,代碼來源:Sif_Example_ImageFilter.cs


注:本文中的Bitmap.copy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。