bitmap

Draw with a Canvas over an Image in Android/Java

邮差的信 提交于 2019-12-25 15:15:34
问题 I try to draw on a Canvas, where the background is an loaded Image in Android. It works just fine without the backgroundimage: background = (ImageView)view.findViewById(R.id.Background); Bitmap bitmap = Bitmap.createBitmap(canvasSize,canvasSize,Bitmap.Config.ARGB_8888); canvas = new Canvas(bitmap); background.setImageBitmap(bitmap); Im passing that canvas to another class and draw on it. That works fine. But when I do this: background = (ImageView)view.findViewById(R.id.Background); Bitmap

Graphics.DrawImage Doesn't Always Paint The Whole Bitmap?

Deadly 提交于 2019-12-25 14:05:14
问题 I have run into a strange problem when using Graphics.DrawImage . When using e.Graphics.DrawImage(Image, Point) in OnPaint to paint a bitmap 'buffer' on the control, it appears that parts of the image are omitted. The buffer is populated in a helper method which draws directly onto the Bitmap using a Graphics constructed from it. When the control paints, the cached bitmap is drawn on the control. Nothing appears to be omitted on the bitmap itself, because when I saved the bitmap to disc and

Two Different GCHandle's refer to same array in memory

断了今生、忘了曾经 提交于 2019-12-25 12:45:28
问题 This is probably not a well-phrased question, because I am not sure what is happenning, so i don't know how to ask it pointedly. I am trying to learn, and i hope i can get some direction on this. Your patience with a neophyte is appreciated. I have a piece of code i am modifying. It displays an image. I want to modify the image, and display it in a different window. I copy the code that displays the image, do the modification, and it displays the modified image for both the original and

Foreach bitmap in folder

我们两清 提交于 2019-12-25 10:55:12
问题 So below is some code that uses TessNet's OCR tool to scans each bitmap in the folder and processes the OCR information into List<tessnet2.Word> result . But I can't seem to get the foreach to work right. I get the following error foreach statement cannot operate on variables of type 'System.IO.DirectoryInfo' because 'System.IO.DirectoryInfo' does not contain a public definition for 'GetEnumerator' DirectoryInfo diBMP = new DirectoryInfo("c:\\temp\\bmps"); foreach (Bitmap bmp in diBMP) {

Draw Bitmap When Still Using XML View

岁酱吖の 提交于 2019-12-25 10:16:18
问题 So I am using my main.xml as a view in my program but I still need to be able to add bimaps/drawables to the screen through programming. Is there any way to do that? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } That is kinda what my onCreate looks like (but with a lot of code for the purpose of the app). Is there anyway to maybe add a View or Canvas ONTOP of my current view? I am new to bitmaps and drawables for android

Draw Bitmap When Still Using XML View

微笑、不失礼 提交于 2019-12-25 10:16:15
问题 So I am using my main.xml as a view in my program but I still need to be able to add bimaps/drawables to the screen through programming. Is there any way to do that? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } That is kinda what my onCreate looks like (but with a lot of code for the purpose of the app). Is there anyway to maybe add a View or Canvas ONTOP of my current view? I am new to bitmaps and drawables for android

Android Google Maps GroundOverlay from Bitmap appears white

孤人 提交于 2019-12-25 09:34:40
问题 I am trying to display a ground overlay downloaded from url. the problem is that the image is not shown and the overlay appears as white square. thinking the Bitmap Object is faulty i tested: addding the same bitmap Object to a marker - the marker shows o.k get an image with .fromResource(R.id.myimage) - the overlay shows o.k but my image is from downloaded Bitmap Object. This is my code: private void addOverlayFromBitmap(Bitmap bmImage){ BitmapDescriptor image = BitmapDescriptorFactory

Android Out of Memory Error - Bitmap is too big

纵饮孤独 提交于 2019-12-25 09:28:22
问题 In my game, I have a bitmap image which functions as the games background (drawn on a canvas). The bigger the image the more "space" there is in the game for the user to move in, so I want the bitmap to be as big as possible without causing memory problems. Well I went overboard and drew an enormous bitmap, which caused an out of memory error immediately on initialzation, so I shrunk the bitmap a bit. But I think its too small. My question is how can I measure the "safe" limit of the memory

Sharing bitmap in memory without asking for read permissions using ACTION_SEND

感情迁移 提交于 2019-12-25 09:17:23
问题 I am trying to store a bitmap within the app's storage using file provider and then share it via ACTION_SHARE, I am trying to avoid the read external storage permissions while sharing the image (it is the screenshot of the current view of the app -> bitmap). Though I add the FLAG_GRANT_READ_URI_PERMISSION flag the receiver app always asks for the permissions, if I grant the permissions then the image is accessible by the receiver app else the receiver app does not show the image. Can someone

How to save cropped image uri in shared Preference

时间秒杀一切 提交于 2019-12-25 08:58:03
问题 I have selected an image and cropped it. But I want to save the cropped image uri in shared preference so that it can be showed later. I know how to save in shared preference, but the problem key is "how I can get the image URL of the cropped image" ........................ Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); // code for crop image intent.putExtra("crop", "true"); intent.putExtra("aspectX", 0); intent.putExtra("aspectY", 0);