当我注意到它被密封时,我正要从BitmapImage类继承,我已经快速浏览了一下,但我找不到密封的原因.
有谁知道这是为什么?
谢谢
我在用
var bitmapdata:BitmapData=new BitmapData();
var pixels:Bytearray=new Bytearray();
pixels = rleDecodePixles();
bitmapdata.setPixels(bitmapdata.rect, pixels);
Run Code Online (Sandbox Code Playgroud)
在上面代码的第4行,我得到"错误:错误#2030:遇到文件结束." 我检查了像素对象的长度,它是rect对象宽度*高度的4倍.鉴于setPixels()函数从bytearray读取unsigned int并将该值设置为像素,我认为它应该可行.
但我不知道为什么这不起作用.在从服务器获得的数据的RLE解码之后填充像素对象.
是否有任何工作或我可以尝试使用的任何其他方法.加载器类不会工作,因为我从服务器获得的数据不是任何可识别的格式.
任何帮助是极大的赞赏.
Shrikant
谢谢.
我想绘制大量的形状(线条,椭圆和......),然后将它们保存为位图或png.我制作了图纸,问题是:如何在C#中将DrawingImage转换为BitmapImage?代码是这样的:
DrawingGroup drawingGroup = new DrawingGroup();
using(DrawingContext context = drawingGroup.Open())
{
//make some drawing
}
DrawingImage drawingImage = new DrawingImage(drawingGroup)
// your suggestion? DrawingImage - > BitmapImage
Run Code Online (Sandbox Code Playgroud) 我在尝试使用 Android 应用程序将照片保存到存储时遇到问题。该应用程序使用设备相机拍摄照片并将其以 PNG 格式保存到设备。
由于某种原因,无论我做什么或将图像存储在哪里,质量都很差。该应用程序是一个相当大的现有项目,因此我想知道将图像保存到设备时是否需要考虑其他因素,或者可能是另一种覆盖质量的方法。
这是以前的开发人员编写的函数:
public String saveImageToDevice(Bitmap image) {
saveCanvasImage(image);
String root = Environment.getExternalStorageDirectory().toString()+"/Android/data/com.app.android";
File myDir = new File(root + "/saved_images");
myDir.mkdirs();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String fname = "Image-"+ timeStamp +".png";
File file = new File (myDir, fname);
if (file.exists ()){
file.delete ();
}
try {
Toast.makeText(getActivity(), "Saving Image...", Toast.LENGTH_SHORT).show();
Log.i("Image saved", root+"/saved_images/"+fname);
FileOutputStream out = new FileOutputStream(file);
image.compress(CompressFormat.PNG, 100, out);
imageLocations.add(fname);
out.flush();
out.close();
//return myDir.getAbsolutePath() + "/" +fname;
return fname;
} catch (Exception …Run Code Online (Sandbox Code Playgroud) 即使在 RenderOptions.SetBitmapScalingMode(thumbImg, BitmapScalingMode.HighQuality); 之后,我的图像质量仍然很低;任何的想法
if(File.Exists(image_file.FullName))
{
IPLRes.print( "Loading " + image_file.FullName);
BitmapImage thumbImg = new BitmapImage(new Uri(image_file.FullName));
RenderOptions.SetBitmapScalingMode(thumbImg, BitmapScalingMode.HighQuality);
ImageBrush imgbrush = new ImageBrush(thumbImg);
imgbrush.Stretch = System.Windows.Media.Stretch.Uniform;
RenderedPages[page_numx] = imgbrush;
}
Run Code Online (Sandbox Code Playgroud)
.....
ShapRectangle thumbnail = (ShapRectangle)FindName("rect_Thumb" + thumbnail_nbr);
VISUAL thumbnailvisual = (VISUAL)FindName("rect_Thumb" + thumbnail_nbr);
thumbnail.Fill = (System.Windows.Media.Brush)RenderedPages[page_numx];
Run Code Online (Sandbox Code Playgroud)
