bitmap

winforms graphics with nearest neighbor filtering clipping edges of image

牧云@^-^@ 提交于 2020-01-13 10:03:30
问题 I'm writing a Chip8 emulator/interpreter. It's going great. To the point I need a UI to play some games and watch this bad Jackson in motion. I first ran into a problem where drawing the framebuffer (which is just a bitmap) to the screen was super-blurry. After figuring out I needed to set the interpolation mode to Nearest Neighbor it looked much better, but it seems the edges of the image are either being clipped or I'm misunderstanding the interpolation at work. Here's a screenshot. The

Why are all my bitmaps upsampled 200%?

主宰稳场 提交于 2020-01-13 09:51:28
问题 I'm having severe memory issues in my application [1]. In order to investigate this, I took heapdumps of my app at different states. I saw that some bitmaps were taking huge amounts of memory. I wrote a small tool [2] that decodes the byte arrays to Windows bitmap files (.bmp), so that I can see the bitmaps and compare them to the files I have in my res/drawable folder. What I discovered is that all my files are upsampled twice. I first checked with the biggest one had: a byte array buffer of

Save MapView as a Bitmap

随声附和 提交于 2020-01-13 04:49:09
问题 I've tried both methods to save a MapView as a bitmap which I've found here and none seem to work for me. The first option, Bitmap bitMap = mMapView.getDrawingCache(); mMapView.setDrawingCacheEnabled(true); bitMap = mMapView.getDrawingCache(true); and the second, Canvas offscreencanvas = new Canvas(); Bitmap bmap = Bitmap.createBitmap(mMapView.getWidth(), mMapView.getHeight(), Bitmap.Config.ARGB_8888); bmap.copy(Config.ARGB_4444, true); offscreencanvas.setBitmap(bmap); offscreencanvas

C# 图片自由变换 任意扭曲

别来无恙 提交于 2020-01-13 04:08:46
  之前想过要做个地铁驾驶的游戏,其中想把一些原本是矩形图片弄成一个梯形,但是发现GID+上面没有类似的方法。于是在谷歌谷了一下。没有!只能找到令人垂涎的,并没有源码。按照自己的想法尝试了一两天,有点效果,但实际上不是那样。后来知道那个在数字图像处理中叫“透视变换”。于是上网找了相关资料,原理找了,看了不明白。代码没多少,有ActionScript的,不明;有C的,不明。真笨啊!后来在CodeProject上面看到一份外国人的博文,全英文看不太明白,但看了一幅图,大概知道他意思了。下了份源码看看,C++的。好不容易翻译成C#的(感觉还是保留了不少C++风格的东西),编译通过,运行正常。后来才一步一步的阅读代码。还没全懂,先把懂的部分记录下来。以后继续研究继续补充。   先看看效果   界面是仿照某个人(网上版本太多,找不到原作者)的弄出来的,界面不是重点,重点是算法。下面就直接贴老外的那幅图大致讲讲思想。   首先是从原本图片转化成一幅理想化的目标图片,那幅图片只是理想化的,最终的图片是最右边的那幅。转换的过程就是根据转换后图片的四个角计算出目标图片的size,生成一个矩阵,就是那个Destination Image,然后把理想化的目标图片覆盖过去,把理想化图片的每个“像素格”(已经不是真正的像素格了,因为经过了扭曲变形)跟那个矩阵对比,看看覆盖了哪些格子,覆盖的面积有多少

Oracle常用诊断事件清单

*爱你&永不变心* 提交于 2020-01-13 03:33:31
事件 说明 例子 Event 10013 - Monitor Transaction Recovery 在Startup时跟踪事务恢复 ALTER SESSION SET EVENTS '10013 trace name context forever, level 1'; Event 10015 - Dump Undo Segment Headers- 在事务恢复后做Dump回退段头信息 ALTER SESSION SET EVENTS '10015 trace name context forever, level 1'; Event 10032 - Dump Sort Statistics Dump排序的统计信息 ALTER SESSION SET EVENTS '10032 trace name context forever, level 10'; Event 10033 - Dump Sort Intermediate Run Statistics 排序过程中,内存排序区和临时表空间的交互情况 ALTER SESSION SET EVENTS '10033 trace name context forever, level 10'; Event 10045 - Trace Free List Management Operations FREELIST的管理操作

How can i define a 8 bit grayscale image directly ?

风格不统一 提交于 2020-01-12 18:59:13
问题 The following code is used to create a 8 bit bitmap Bitmap b = new Bitmap(columns, rows, PixelFormat.Format8bppIndexed); BitmapData bmd = b.LockBits(new Rectangle(0, 0, columns, rows), ImageLockMode.ReadWrite, b.PixelFormat); But when i save it it is saved as a 8 bit color bitmap. Is it possible to directly create a 8 bit grayscale bitmap without creating a 8 bit color bitmap and later having to convert it to a grayscale ? 回答1: If you have a bitmap that has a palette then there's not really a

Programmatically swap colors from a loaded bitmap to Red, Green, Blue or Gray, pixel by pixel

百般思念 提交于 2020-01-12 10:15:50
问题 Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip Yes, I want to convert something "mostly blue" to something "mostly green". I would like to take a original bitmap (light blue) and change the colors (Pixel by Pixel) to the red, green, blue and gray equivalence relation. To get an idea of what I mean, I have include the source code and a screen shot. Any help would be greatly appreciated. If more information is needed, please feel free to ask. If you could

Programmatically swap colors from a loaded bitmap to Red, Green, Blue or Gray, pixel by pixel

你说的曾经没有我的故事 提交于 2020-01-12 10:15:33
问题 Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip Yes, I want to convert something "mostly blue" to something "mostly green". I would like to take a original bitmap (light blue) and change the colors (Pixel by Pixel) to the red, green, blue and gray equivalence relation. To get an idea of what I mean, I have include the source code and a screen shot. Any help would be greatly appreciated. If more information is needed, please feel free to ask. If you could

C# paint program flickering

99封情书 提交于 2020-01-12 08:28:57
问题 I'm trying to make a simple paint program in C#, but it keeps flickering when I'm drawing, like I need some kind of double buffering, but I don't know how to do it. I am drawing on a Panel and I'm using a Bitmap to store the graphics. Here's my code: public partial class Form1 : Form { private Bitmap drawing; private bool leftDown = false; private int prevX; private int prevY; private int currentX; private int currentY; public Form1() { InitializeComponent(); drawing = new Bitmap(panel1.Width

How to handle try catch exception android

邮差的信 提交于 2020-01-12 07:16:46
问题 I am using a method getBitmap to display images. As I am using this as a method,if it returns bitmap display an image but if it returns null,catch an exception. But if url entered is wrong also, it should handle the FileNotFoundException. How to handle two exception and display in UI? public Bitmap getBitmap(final String src) { try { InputStream stream = null; URL url = new URL(src); java.net.URL url = new java.net.URL(src); URLConnection connection = url.openConnection(); InputStream input =