Search Results

Search found 1375 results on 55 pages for 'bitmap'.

Page 2/55 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Rendering to a single Bitmap object from multiple threads

    - by Lee Treveil
    What im doing is rendering a number of bitmaps to a single bitmap. There could be hundreds of images and the bitmap being rendered to could be over 1000x1000 pixels. Im hoping to speed up this process by using multiple threads but since the Bitmap object is not thread-safe it cant be rendered to directly concurrently. What im thinking is to split the large bitmap into sections per cpu, render them separately then join them back together at the end. I haven't done this yet incase you guys/girls have any better suggestions. Any ideas? Thanks

    Read the article

  • Drawable advantage over bitmap for memory in android

    - by Tabish
    This question is linked with the answers in the following question: Error removing Bitmaps[Android] Is there any advantage of using Drawable over Bitmap in Android in terms of memory de-allocation ? I was looking at Romain Guy project Shelves and he uses SoftReference for images caches but I'm unable to search where is the code which is de-allocating these Drawables when SoftReference automatically reclaims the memory for Bitmap. As far as I know .recycle() has to be explicitly called on the Bitmap for it to be de-allocated.

    Read the article

  • Best way to reverse bitmap data that is upside down

    - by Wladimir
    Hello, I have a method that I call and it returns bitmap data from a capture device. It returns a pointer to the buffer data as an IntPtr and the buffer length as an int. I know in advance that this bitmap is a 24bpp and its width and height. The problem is that the buffer contains the bitmap data upside down and I need this data to be in the right order (reverse it). What I do is create a for loop and using CopyMemory, I copy each line (stride) of this data from bottom to up to a newly allocated memory space. Is there any way to make it faster than creating more memory each time I receive a new frame? It makes the application get a bit slow and consumes more memory as each bitmap is pretty big. I do this because I use another component that analyses the bitmaps and it doesn't work propertly if the bitmaps are upside down. I'm using .net, c# thanks!

    Read the article

  • Bitmap as button?

    - by Hwang
    How to set a bitmap as a button so that i can apply button mode and mouse-event stuff on it, without adding the bitmap to a Movie Clip? var bmpFull=new Bitmap(event.currentTarget.content.bitmapData); bmpFull.smoothing=true; bmpFull.name="photo"; bmpFull.alpha=0; //fullMC.buttonMode=true; fullMC.addChild(bmpFull);

    Read the article

  • convert a textview, including those contents off the screen, to bitmap

    - by user623318
    Hi, I want to save(export) contents of MyView, which extends TextView, into a bitmap. I followed the code: [this][1]. It works fine when the size of the text is small. But when there are lots of texts, and some of the content is out of the screen, what I got is only what showed in the screen. Then I add a "layout" in my code: private class MyView extends TextView{ public MyView(Context context) { super(context); // TODO Auto-generated constructor stub } public Bitmap export(){ Layout l = getLayout(); int width = l.getWidth() + getPaddingLeft() + getPaddingRight(); int height = l.getHeight() + getPaddingTop() + getPaddingBottom(); Bitmap viewBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(viewBitmap); setCursorVisible(false); layout(0, 0, width, height); draw(canvas); setCursorVisible(true); return viewBitmap; } } Now the strange thing happened: The first time I invoke "export"(I use an option key to do that), I got contents only on the screen. When I invoke "export" again, I got complete contents, including those out of the screen. Why? How to "export" a view, including contents cannot be showed on the screen? Thank you! [1]: http://www.techjini.com/blog/2010/02/10/quicktip-how-to-convert-a-view-to-an-image-android/ this

    Read the article

  • Bitmap.Save problems

    - by user284026
    Hello, can anyone tell me if you know to be a problem with Bitmap and steganography for WM 6? I am working on a project and i have to hide a digital signature in a bitmap. The algorithm works perfect, as in untill i have the image on the memory the bitmap contains the modified bytes. But after i save the image (Bitmap.Save()) and I reopen the image, than those bytes are lost. When i say lost i mean they are the orriginal bytes from when the picture was taken. Thank you.

    Read the article

  • Android: how to convert whole ImageView to Bitmap?

    - by yosh
    I have my application that is displaying images with different ratio, resized inside (centerInside) imageView. What I need is to create bitmap from the ImageView including the background (black in this case). So for example I have device screen 320x480, full screen imageView with image resized to 280x480. How could I get 320x480 bitmap from it? On top of this imageview I have some logos or buttons that I don't want to include to bitmap, they're like on top layer. All I need is bitmap with image and black border from some sides.

    Read the article

  • OutofMemoryError: bitmap size exceeds VM budget (Android)

    - by Chrispix
    Getting an Exception in the BitmapFactory. Not sure what is the issue. (Well I can guess the issue, but not sure why its happening) ERROR/AndroidRuntime(7906): java.lang.OutOfMemoryError: bitmap size exceeds VM budget ERROR/AndroidRuntime(7906): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:295) My code is pretty straight forward. I defined an XML layout w/ a default image. I try to load a bm on the SDCard (if present - it is). If not it shows the default image. Anyway.. Here is code : public class showpicture extends Activity { public void onCreate(Bundle savedInstanceState) { /** Remove menu/status bar **/ requestWindowFeature(Window.FEATURE_NO_TITLE); final Window win = getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); Bitmap bm; super.onCreate(savedInstanceState); setContentView(R.layout.showpicture); try { ImageView mImageButton = (ImageView)findViewById(R.id.displayPicture); bm = Bitmap.createScaledBitmap(BitmapFactory.decodeFile("/sdcard/dcim/Camera/20091018203339743.jpg"),100, 100, true); parkImageButton.setImageBitmap(bm); } catch (IllegalArgumentException ex) { Log.d("MYAPP",ex.getMessage()); } catch (IllegalStateException ex) { It fails on the bm=Bitmap.createScaledBitmap any thoughts? I did some research on the forums, and it pointed to this post I just don't know why it is not working. Any help would be great! Thanks, Chris.

    Read the article

  • Delphi fast large bitmap creation (without clearing)

    - by Ritsaert Hornstra
    When using the TBitmap wrapper for a GDI bitmap from the unit Graphics I noticed it will always clear out the bitmap (using a PatBlt call) when setting up a bitmap with SetSize( w, h ). When I copy in the bits later on (see routine below) it seems ScanLine is the fastest possibility and not SetDIBits. function ToBitmap: TBitmap; var i, N, x: Integer; S, D: PAnsiChar; begin Result := TBitmap.Create(); Result.PixelFormat := pf32bit; Result.SetSize( width, height ); S := Src; D := Result.ScanLine[ 0 ]; x := Integer( Result.ScanLine[ 1 ] ) - Integer( D ); N := width * sizeof( longword ); for i := 0 to height - 1 do begin Move( S^, D^, N ); Inc( S, N ); Inc( D, x ); end; end; The bitmaps I need to work with are quite large (150MB of RGB memory). With these iomages it takes 150ms to simply create an empty bitmap and a further 140ms to overwrite it's contents. Is there a way of initializing a TBitmap with the correct size WITHOUT initializing the pixels itself and leaving the memory of the pixels uninitialized (eg dirty)? Or is there another way to do such a thing. I know we could work on the pixels in place but this still leaves the 150ms of unnessesary initializtion of the pixels.

    Read the article

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

    - by eyeClaxton
    Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip 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 take a look at the code below, I have three functions that I'm looking for help on. The functions "RGBToRed, RGBToGreen and RGBToRed" I can't seem to come up with the right formulas. unit MainUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TMainFrm = class(TForm) Panel1: TPanel; Label1: TLabel; Panel2: TPanel; Label2: TLabel; Button1: TButton; BeforeImage1: TImage; AfterImage1: TImage; RadioGroup1: TRadioGroup; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var MainFrm: TMainFrm; implementation {$R *.DFM} function RGBToGray(RGBColor: TColor): TColor; var Gray: Byte; begin Gray := Round( (0.90 * GetRValue(RGBColor)) + (0.88 * GetGValue(RGBColor)) + (0.33 * GetBValue(RGBColor))); Result := RGB(Gray, Gray, Gray); end; function RGBToRed(RGBColor: TColor): TColor; var Red: Byte; begin // Not sure of the algorithm for this color Result := RGB(Red, Red, Red); end; function RGBToGreen(RGBColor: TColor): TColor; var Green: Byte; begin // Not sure of the algorithm for this color Result := RGB(Green, Green, Green); end; function RGBToBlue(RGBColor: TColor): TColor; var Blue: Byte; begin // Not sure of the algorithm for this color Result := RGB(Blue, Blue, Blue); end; procedure TMainFrm.FormCreate(Sender: TObject); begin BeforeImage1.Picture.LoadFromFile('Images\RightCenter.bmp'); end; procedure TMainFrm.Button1Click(Sender: TObject); var Bitmap: TBitmap; I, X: Integer; Color: Integer; begin Bitmap := TBitmap.Create; try Bitmap.LoadFromFile('Images\RightCenter.bmp'); for X := 0 to Bitmap.Height do begin for I := 0 to Bitmap.Width do begin Color := ColorToRGB(Bitmap.Canvas.Pixels[I, X]); case Color of $00000000: ; // Skip any Color Here! else case RadioGroup1.ItemIndex of 0: Bitmap.Canvas.Pixels[I, X] := RGBToBlue(Color); 1: Bitmap.Canvas.Pixels[I, X] := RGBToRed(Color); 2: Bitmap.Canvas.Pixels[I, X] := RGBToGreen(Color); 3: Bitmap.Canvas.Pixels[I, X] := RGBToGray(Color); end; end; end; end; AfterImage1.Picture.Graphic := Bitmap; finally Bitmap.Free; end; end; end. Okay, I apologize for not making it clearer. I'm trying to take a bitmap (blue in color) and swap the blue pixels with another color. Like the shots below.

    Read the article

  • Masking a Drawable/Bitmap on Android

    - by Joshua Rodgers
    I'm currently looking for a way to use a black and white bitmap to mask the alpha channel of another bitmap or Drawable on Android. I'm curious as to what the best way to do this is. I certainly have a couple of ideas for how to do this, but they are not optimal. I need to be able to apply a new mask to the image every so often (the black and white bitmap will change every few seconds). Any feedback on how to achieve this would be greatly appreciated.

    Read the article

  • How can I overwrite a System.Drawing.Bitmap onto an existing GDI bitmap?

    - by MusiGenesis
    If I have a .Net Bitmap, I can create from it a GDI bitmap by calling the Bitmap's GetHbitmap() method. Bitmap bmp = new Bitmap(100, 100); IntPtr gdiBmp = bmp.GetHbitmap(); This works fine, but every time you call GetHbitmap, Windows has to allocate new memory for the object that gdiBmp references. What I'd like to do - if possible - is write a function (I know PInvoke will be necessary here) that also generates a GDI bitmap copy of a Bitmap, but that uses an existing object instead of allocating a new one. So it would look something like this (if it were an extension method of Bitmap): //void OverwriteHbitmap(IntPtr gdi) Bitmap bmp1 = new Bitmap(100, 100); IntPtr gdi1 = bmp1.GetHbitmap(); Bitmap bmp2 = new Bitmap(100, 100); bmp2.OverwriteHbitmap(gdi1); How can I do this? I assume I'll need to know the structure of a GDI bitmap, and probably I can use LockBits and BitmapData for this, but I'm not sure exactly how.

    Read the article

  • Bitmap files added in .rc not listed in resource.h

    - by ame
    I added a large number of bitmap files to my MFC project in resource view (Visual Studio). However, the resource.h file does not list any of these files. I would want them to be listed with exactly the same name as they are added in .rc bitmap list (say the name is xxx) I want it listed as #define IDB_xxx If I try to click on the bitmap in the .rc list and import it, it gets listed as IDB_BITMAP1. Owing to the large number of files it is not feasible for me to manually rename them for use in my code.

    Read the article

  • Bitmap Confusion Android

    - by Farhan
    I am getting an image from gallery in onActivityResult() through intent.getdata(). Now i get the data and set it to a bitmap, its size is 716x716 and its setting to full screen. (ImageView's width and height is set to wrap content). Now i created another bitmap after scaling the original through Bitmap.CreateScaledBitmap(orgBitmap,30,30,false); After this, i make sure these things(width,height n size) and they happen as they should be but the problem is that the image is still taking the full screen... rather it should only take 30dp x 30dp. Anyone have an idea what might be the problem??? Thanx

    Read the article

  • how to draw a Bitmap to a Canvas with a variable alpha

    - by steelbytes
    Hi, I'm trying to draw a Bitmap to a Canvas with a variable amount of alpha. But I only get nothing (when alpha<255) or the 'full' bitmap (when alpha==255). Have also tried loading as a Drawable, and using drawable.setAlpha, but that gave the same result. my init BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inScaled = false; opts.inSampleSize = 1; Bitmap img = BitmapFactory.decodeResource(getResources(),R.drawable.sample,opts); my onDraw() Paint p = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG); p.setColor((alpha<<24)+0xffffff); // alpha in range 0..255 canvas.drawBitmap(img, null, imgRect, p);

    Read the article

  • Bitmap rotation jitter around pivot

    - by Manderin87
    I am working on a asteriods clone and I have the ship graphic loaded as a 96x96 bitmap. When the player rotates the ship I rotate the bitmap by degree (float). rotation function: if(m_Matrix == null) { m_Matrix = new Matrix(); } else { m_Matrix.reset(); } m_Matrix.setRotate(degree, m_BaseImage.getWidth() / 2, m_BaseImage.getHeight() / 2); m_RotatedImage = Bitmap.createBitmap(m_BaseImage, 0, 0, m_BaseImage.getWidth(), m_BaseImage.getHeight(), m_Matrix, true); draw function: m_Paint.setAntiAlias(true); m_Paint.setFilterBitmap(true); m_Paint.setDither(true); canvas.drawBitmap(m_RotatedImage, (int) posX - m_RotatedImage.getWidth() / 2, (int) posY - m_RotatedImage.getHeight() / 2, m_Paint); When the bitmap is drawn, the bitmap jitters slightly around the pivot. Can anyone fix or tell me why the bitmap is jittering around the pivot? It needs to be smooth.

    Read the article

  • Android "Trying to use recycled bitmap" error?

    - by Mike
    Hi all, I am running into a problem with bitmaps on an Android application I am working on. What is suppose to happen is that the application downloads images from a website, saves them to the device, loads them into memory as bitmaps into an arraylist, and displays them to the user. This all works fine when the application is first started. However, I have added a refresh option for the user where the images are deleted, and the process outlined above starts all over. My problem: By using the refresh option the old images were still in memory and I would quickly get OutOfMemoryErrors. Thus, if the images are being refreshed, I had it run through the arraylist and recycle the old images. However, when the application goes to load the new images into the arraylist, it crashes with a "Trying to use recycled bitmap" error. As far as I understand it, recycling a bitmap destroys the bitmap and frees up its memory for other objects. If I want to use the bitmap again, it has to be reinitialized. I believe that I am doing this when the new files are loaded into the arraylist, but something is still wrong. Any help is greatly appreciated as this is very frustrating. The problem code is below. Thank you! public void fillUI(final int refresh) { // Recycle the images to avoid memory leaks if(refresh==1) { for(int x=0; x<images.size(); x++) images.get(x).recycle(); images.clear(); selImage=-1; // Reset the selected image variable } final ProgressDialog progressDialog = ProgressDialog.show(this, null, this.getString(R.string.loadingImages)); // Create the array with the image bitmaps in it new Thread(new Runnable() { public void run() { Looper.prepare(); File[] fileList = new File("/data/data/[package name]/files/").listFiles(); if(fileList!=null) { for(int x=0; x<fileList.length; x++) { try { images.add(BitmapFactory.decodeFile("/data/data/[package name]/files/" + fileList[x].getName())); } catch (OutOfMemoryError ome) { Log.i(LOG_FILE, "out of memory again :("); } } Collections.reverse(images); } fillUiHandler.sendEmptyMessage(0); } }).start(); fillUiHandler = new Handler() { public void handleMessage(Message msg) { progressDialog.dismiss(); } }; }

    Read the article

  • get bitmap from textview in android

    - by Sponge
    I want to get the bitmap that is drawn when a textview is displayed but without displaying the textview in the activity. something like this: TextView t = new TextView(this); t.forceToDrawItself(); Bitmap b=t.getViewBitmap(); how is this possible?

    Read the article

  • Cannot open a .tif with color using .Net Image or Bitmap classes

    - by Tom Regan
    I am attempting to open .tif files that have color in them (300 dpi, PixelFormat.Format24bppRgb) using the .Net Image and Bitmap classes. I always get an "invalid parameter" error when the tiffs have color (works fine for black and white tiffs). If anyone has source code on how to open a .tif with color in it I'd deeply appreciate it. Below is what I'm attempting to do; this also fails when calling Bitmap.FromStream: using (FileStream fs = File.OpenRead(fileName)) { using (Image img = Image.FromStream(fs)) {} }

    Read the article

  • Android : Bitmap save to location

    - by Chrispix
    I am working on a function to download an image from a web server, redisplay it on the screen, and if the user wishes to keep the image, save it on the SD card in a certain folder. Is there an easy way to take a bitmap and just save it to the SD card in a folder of my choice? My issue is that I can download the image, display it on screen as a Bitmap. The only way I have been able to find to save an image to a particular folder is to use FileOutputStream, but that requires a byte array. I am not sure how to convert (if this is even the right way) from Bitmap to byte array, so I can use a Fileoutput stream to write the data. The other option I have is it use MediaStore : MediaStore.Images.Media.insertImage(getContentResolver(), bm, barcodeNumber + ".jpg Card Image", barcodeNumber + ".jpg Card Image"); Which works fine to save to SD card, but does not allow you to customize the folder. Any assistance would be very much appreciated. Thank you in advance.

    Read the article

  • Changing a sprites bitmap

    - by numerical25
    As of right now, I am trying to create a tiling effect for a game I am creating. I am using a tilesheet and I am loading the tiles to the sprite like so... this.graphics.beginBitmapFill(tileImage); this.graphics.drawRect(30, 0,tWidth ,tHeight ); var tileImage is the bitMapData. 30 is the Number of pixels to move retangle. then tWidth and tHeight is how big the rectangle is. which is 30x30 This is what I do to change the bitmap when I role over the tile this.graphics.clear(); this.graphics.beginBitmapFill(tileImage); this.graphics.drawRect(60, 0,tWidth ,tHeight ); I clear the sprite canvas. I then rewrite to another position on tileImage. My problem is.... It removes the old tile completely but the new tile positions farther to the right then where the old bitmap appeared. My tile sheet is only 90px wide by 30px height. On top of that, it appears my new tile is drawn behind the old tile. Is there any better way to perfect this. again, all i want is for the bitmap to change colors

    Read the article

  • SharpDX: Render to bitmap using Direct2D 1.1

    - by mwhouser
    I have a command line application that I am currently using SharpDX (Direct2D 1.0) to render to PNG files. This is a window-less application. It's currently creating a SharpDX.WIC.WicBitmap, a WicRenderTarget, then rendering to that. I then save the WicBitmap to the PNG file. For various reasons, I need to migrate to Direct2D 1.1 to take advantage of some of the effects available in 1.1. I'm trying to get a SharpDX.Direct2D1.Bitmap that I can save as PNG. I cannot use FromWicBitmap because that copies the bitmap, it does not share it. I see CreateSharedBitmap in the Direct2D1 API that takes a IWICBitmapLock. However, I do not see this implemented as a constructor of SharpDX.Direct2D.Bitmap. This is what I'm trying to do: // Bunch of setup var d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice); var d2dDeviceContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice, SharpDX.Direct2D1.DeviceContextOptions.None); using (var wicFactory = new SharpDX.WIC.ImagingFactory()) { using (SharpDX.WIC.Bitmap wicBitmap = new SharpDX.WIC.Bitmap(wicFactory, 500, 500, SharpDX.WIC.PixelFormat.Format32bppPBGRA, SharpDX.WIC.BitmapCreateCacheOption.CacheOnDemand)) { var wicLock = wicBitmap.Lock(SharpDX.WIC.BitmapLockFlags.Write); var props = new SharpDX.Direct2D1.BitmapProperties1(); props.BitmapOptions = SharpDX.Direct2D1.BitmapOptions.Target; var bitmap = new SharpDX.Direct2D1.Bitmap1(d2dDeviceContext, wicLock, props); // This is not available d2dDeviceContext.Target = bitmap; // Do the drawing // Save the PNG } } Is there a way to do what I'm trying to accomplish?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >