bitmap

Efficient bitmap manipulation in WPF (C#).

Hi there, the problem is as follows: I have got a rendered bitmap in a byte array (together with the bitmap header). Now I want to manipulate the content of a bitmap. For that purpose I need to wrap this array with some high-level class, say BitmapImage . I want to avoid copying the array, or its data part etc. I want just to force .NE...

Save a portion of my program’s own window to a bitmap file using mfc/win32.

Within my mfc program, I need to programmatically capture a portion of that program’s own window, then save it out as a file (bmp or jpg etc). How to do this without using 3rd party library? ...

Copy BitmapData From mx:Image

How can I copy or duplicate the bitmapdata from a mx:image component? I need to display the same image in multiple screens of my application and don't want to have to download the image multiple times. I could just use a urlrequest to download the image as a bitmap and copy that but I like the way you can can just set the source of th...

Android: Bitmaps loaded from gallery are rotated in ImageView

When I load an image frome the media gallery into a Bitmap, everything works fine, except that pictures that were shot with the camera while holding the phone vertically, are rotated so that I always get a horizontal picture even though it appears vertical in the gallery. Why is that and how can I load it correctly? ...

How to convert Single Channel IplImage* to Bitmap^

How can I convert single channel IplImage (grayscale), depth=8, into a Bitmap? The following code runs, but displays the image in 256 color, not grayscale. (Color very different from the original) btmap = gcnew Bitmap( cvImg->width , cvImg->height , cvImg->widthStep , System::Drawing::Imaging::PixelFormat::Format8bppIndexed, (Sy...

Android Bitmap Tile on X Only

I want to use a Bitmap that Tile on the Horizontal only, is there any way to do it, so that it will expand only on X like repeat x on CSS. I using the following code but the bitmap tile Horizontal and vertical : ...

WPF: Saving a TransformedBitmap Object to disk.

Working in WPF and C#, I have a TransformedBitmap object that I either 1) Need to save to disk as a bitmap type of file (ideally, I'll allow users to choose whether it's saved as a BMP, JPG, TIF, etc, though, I'm not to that stage yet...), or 2) Need to convert to a BitmapImage object as I know how to get a byte[] from a BitmapImage obje...

How to blur a Bitmap (Android)?

I am struggling to get Bitmaps blurred using Android. I have seen a lot of information about using a simple kernel like 0 0 0 5 0 0 0 0 5 18 32 18 5 0 0 18 64 100 64 18 0 5 32 100 100 100 32 5 0 18 64 100 64 18 0 0 5 18 32 18 5 0 0 0 0 5 0 ...

Combining 2 Images overlayed

Hi There, I've got a things to do with android, so, I have 2 images, 1. image from camera 2. another image from somewhere so what I want to achieve is how to combine those image into 1 image, but it's overlapping (just like watermarking the image), the 2nd image should be scaled first into the size of the 1st image(camera) - so they ha...

How to unit test code that adds a string to a bit map

I'm trying to unit test some code that adds a string to a bitmap. The code works fine when the app is running. But I'm having trouble writing a unit test for it. This is the SUT: public byte[] AddStringToImage(byte[] image, string caption) { using(var mstream = new MemoryStream(image)) using (var bmp = new Bitmap(mstream)) ...

AND two bitmaps in C#

Hi all, I'm trying to AND two bitmaps like this: [DllImport("gdi32.dll")] public static extern int SetROP2(IntPtr hDC, int nDrawMode); const int SRCAND = 0x008800C6; // AND raster op. lock (g.Clip) { IntPtr pDC = g.GetHdc (); SetROP2 (pDC, SRCAND); g.Draw...

problem writing bitmap file header in C

Hi, I am trying to create a new bitmap file using C. This is a struct for the .bmp file header. #define uint16 unsigned short #define uint32 unsigned long #define uint8 unsigned char typedef struct { uint16 magic; //specifies the file type "BM" 0x424d uint32 bfSize; //specifies the size in bytes of the bitmap file uint16 bfReserv...

Bitmap cant find a pixel on itself!

Scenario: 1) Program going to draw a string (commonly a single character) on a bitmap: protected void DrawCharacter(string character, Font font) { if(string.IsNullOrEmpty(character)) character = "."; FontFamily f = new FontFamily(FontName); bitmap = new Bitmap((int)(font.Size * 2f), (int)font.Height); ...

How do you verify that a 2d bitmap is contiguous?

Let's say you have the following structure in C#: struct Piece : IEquatable<Piece> { public readonly int size; public readonly bool[,] data; public Piece(Piece p) { size = p.size; data = (bool[,])p.data.Clone(); } public Piece(int s, bool[,] d) { size = s; if (d.GetLength(0) != s || ...

Loading a resource to a mutable bitmap

I am loading a bitmap from a resource like so: Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image); What I want to do is make some changes to the bitmap before It gets drawn to the main canvas in my draw method (As it would seem wasteful to repeat lots of drawing in my main loop when it isn't going to change). I a...

Is there a way to load and draw partially a bitmap from file in Android?

Say I have a somewhat large (i.e. not fit in most phones' memory) bitmap on disk. I want to draw only parts of it on the screen in a way that isn't scaled (i.e. inSampleSize == 1) Is there a way to load/draw just the part I want given a Rect specifying the area without loading the entire bitmap content? ...

[DELPHI] Canvas/Bitmap scrolling question

Hello. I'm trying to make a small game based on the canvas in Delphi. Basically, I'd like to make a fairly large bitmap ( 3000x3000, for example ), then load it into the canvas, and being able to scroll right/left/up/down just like an ordinary image viewer, however I can't seem to find what I'm looking for. Any ideas? ...

moving a path with a repeating Bitmap image in android

Hi, I'm currently writing an android side-scrolling game and am having trouble filling a path with a repeating bitmap image. I'm creating a path from a number of coordinates to make up the "ground" area. I have a character who is fixed in the middle of the canvas and screen and am moving the path to represent the movement of the characte...

hardware specialized for bitmap indexes?

This is just an out of curiosity question. Let's say you have a database table with 1m rows in it, and you want to often do queries like looking for either male or female, US or non-US, voter or non-voter etc, it's clearly very efficient to define a bitmap index for the table in which each bit represents one either-or condition. However...

Help converting a bitmap to a png in memory using libpng.

Basically I would like to convert a bitmap to a png using libpng but rather than outputting it to a FILE* I would like to output it to a char*. I have already seen this related post but I don't see where the bitmap data is actually used. Any help would be appreciated. ...