bitmap

How do you tell Android not to scale images?

流过昼夜 提交于 2019-12-30 11:17:10
问题 I have some pictures in the /drawable folder, which to my understanding is intepreted as /drawable-mdpi. Now these images are scaled when being used (depending on the device). I don't want to add more pictures, because they don't exist. And I don't have the resources to create different res pictures. I just want the pictures to appear smaller on bigger devices. Is there a way of not scaling the images? I'd hate to have to hard-code all the picture sizes. This is the second question, as edits

How do you tell Android not to scale images?

这一生的挚爱 提交于 2019-12-30 11:17:10
问题 I have some pictures in the /drawable folder, which to my understanding is intepreted as /drawable-mdpi. Now these images are scaled when being used (depending on the device). I don't want to add more pictures, because they don't exist. And I don't have the resources to create different res pictures. I just want the pictures to appear smaller on bigger devices. Is there a way of not scaling the images? I'd hate to have to hard-code all the picture sizes. This is the second question, as edits

Android get full View as Bitmap [duplicate]

浪尽此生 提交于 2019-12-30 11:13:10
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Android 2.1 View's getDrawingCache() method always returns null I hava a Layout which I want to save an bitmap. If my Layout is smaller than the screen everything is fine. But if my Layout is bigger, the bitmap (b) is null. This is my code: layout.setDrawingCacheEnabled(true); int wt = layout.getMeasuredWidth(); int ht = layout.getMeasuredHeight(); layout.layout(0, 0, wt, ht); Bitmap b = layout.getDrawingCache

OnTouch Listener doesn't change bitmap location

天大地大妈咪最大 提交于 2019-12-30 10:27:08
问题 I have a "Board.java" class, which is an activity, and a "MySurfaceView.java" , which is a SurfaceView. I'm drawing some bitmap on the SurfaceView and I want to move it when the screen is touched (to the touched place). it draws the bitmap but after touching, nothing happened. Thanks in advance! Log: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=539.47266, y[0]=978.45703, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0,

C# BitmapData class Scan0 and Stride properties meaning

谁都会走 提交于 2019-12-30 10:00:11
问题 Can anyone explain what Scan0 and Stride properties of BitmapData class in C# are for? 回答1: Are you talking about the BitmapData class? If so, the description in the documentation is reasonably clear, I think: Scan0: Gets or sets the address of the first pixel data in the bitmap. This can also be thought of as the first scan line in the bitmap. In other words, this lets you find the data to examine or change - or even lets you make the bitmap to a completely different piece of data. Stride:

How to change the alpha of a bitmap font in libgdx

扶醉桌前 提交于 2019-12-30 09:32:23
问题 I want to make a message box that fade when you accept but I don't know how to change the alpha of a font, here is how I do my font: white = new BitmapFont(Gdx.files.internal("data/font/whitefont.fnt"),false); white.setUseIntegerPositions(false); white.setScale(0.025f); white.draw(batchHUD, message.nom+":", 1000*0.1f+(1000*0.8f*0.3f), 625*0.1f+(1000*0.8f*0.625f*0.5f*0.1f)+1000*0.2f); Can anyone help me ? :) I'm sorry for my english, it's not my native language. 回答1: white.setColor(1, 1, 1,

Android: Easiest way to make a WebView display a Bitmap?

拥有回忆 提交于 2019-12-30 08:36:33
问题 I have some images that I loaded from a remote source stored in Bitmap variables and I want to display them. In addition to switching between these images the user should also be able to zoom and pan them. My first idea was to somehow pass them via an intent to the built-in gallery application but this doesn't seem to be possible. A solution that is suggested in several places is using a WebView since it already supports zooming and panning. My question is how does my Bitmap data get into the

How to create an Icon file that contains Multiple Sizes / Images in C#

白昼怎懂夜的黑 提交于 2019-12-30 08:29:22
问题 How do I create an icon file that contains multiple sizes? I know that I create a icon from a bitmap using Icon.FromHandle() but how do I add another image / size to that icon? Edit: I need to do this in my application, so I cannot execute an external application to do the combining. 回答1: Quick CYA: I just did a Google search, and have not tested the method below. YMMV. I found this article, which mentions a class that does this (albeit in VB.Net, but easy enough to translate), and tells how

Fastest way to rotate big size bitmap

丶灬走出姿态 提交于 2019-12-30 08:17:06
问题 I am working with large size images and when I try to rotate them (applying matrix on the bitmap) a lot of seconds occurs. I've seen that android system gallery can accomplish this task in a very fast manner instead. How is it possible? I thought to perform the rotation on an asyncTask, applying only the ImageView rotation (which doesn't take long time) on the main thread, but if the app is killed before the asyncTask get to the end, the app fall in an inconsistent state. This is my bitmap

Html5 Canvas overlay

ぐ巨炮叔叔 提交于 2019-12-30 07:48:08
问题 Is there a good solution to draw a bitmap with an overlay color with canvas ? What I'm looking to do is drawing a bitmap with a unique color for all not transparent pixel. I do not find any solution for that, and it could be usefull for me ! Thank's 回答1: Live Demo One way to do it is to loop through each pixel and change the r/g/b values to the value you want it. By skipping over the alpha value it will only change the opaque pixels to the color you want. var canvas = document.getElementById(