bitmap

Safe use of Marshal.Copy from raw bitmap data to managed array.

I posted a question not to long ago about how my program was essentially leaking memory: see here. I have now tracked it specifically to some code in which I copy the raw bytes of a Bitmap object into a managed array. The relevant code: public class FastBitmap { ... private byte[] rgbValues; private int height; private i...

How can I copy a masked bitmap maintaining the masking transparency in actionscript?

Hi all - I need to find a way to copy a masked bitmap. I have a bitmap on stage, and a user drawn sprite that acts as a mask. I need to capture/copy the masked area bitmap, maintaining the transparency created by the masking to eventually encode as a png. I could find no documentation on how to accomplish this using copyPixels(), or an...

fstream skipping characters without reading in bitmap

I am trying to read a bmp file using fstream. However it skips the values between 08 and 0E (hex) for example, for values 42 4d 8a 16 0b 00 00 00 00 00 36 it reads 42 4d 8a 16 00 00 00 00 00 36 skipping 0b like it does not even exist in the document. What to do? code: ifstream in; in.open("ben.bmp", ios::binary); unsigned char a='\...

What is the fastest way I can compare two equal-size bitmaps to determine whether they are identical?

I am trying to write a function to determine whether two equal-size bitmaps are identical or not. The function I have right now simply compares a pixel at a time in each bitmap, returning false at the first non-equal pixel. While this works, and works well for small bitmaps, in production I'm going to be using this in a tight loop and o...

Render bound wpf controls off screen to bitmap

I have a custom wpf control to do an arbitrary reverse image warp, that use a Viewport3D and custom matrix, and a mesh with an ImageBrush... I'm trying to render this to a bitmap entirely off screen. I am able to render a bitmap fine (I found to call .Measure() .Arrange(new Rectangle(...)) and .UpdateLayout()) before rendering, but the ...

Fread skipping characters reading into object

I'm trying to read in a bitmap starting with its header, but fread is skipping characters for me. I'm using this typedef in my header: #include <windows.h> // Used for other #include <cstdio> typedef struct tagBITMAPHEADER{ WORD wFileType; DWORD dwFileSize; WORD dwReserved; WORD dwReserved2...

Waving text on canvas

How could I make waving text on a canvas element similar to what is found on this page? ...

To show bitmap created in memory in Rave.

I have created a bitmap in memory, and would like to show this in rave report design time. I don't want to create a file then load. Is there a better way? Thanks and regards, jai ...

Creating a jpeg from several overlapping png's

So on my site, a user has the ability to create an avatar. It's created by the user selecting from several images; there is a base "skin" image, and png's that overlap that image that depict hair, eyes, mouth, etc. I cannot save the user's avatar to the project's files, so the user's avatar data is stored in the database, and the png's...

Flex - get bitmap

Hi Is it possible to get the bitmap data from a component using ActionScript? I dynamically load an image. onComplete I create a Flex Image component and add the loaded image to the source loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void { var image:Image = new Image(); image.x = 0; im...

C# Drawing, Strange Behaviour

Hi, the following code is fairly straight forward - it fills a design surface with randomnly selected pixels - nothing special (ignore the XXXXXXX's in the 2nd method for now). private void PaintBackground() { Random rnd = new Random(); Bitmap b = new Bitmap(this.Width, this.Height); for (int vertical = 0; vertical < this.H...

GDI GradientFill not working on offscreen bitmap

Hi, I am trying to use the GDI GradientFill function to draw on a offscreen bitmap, then BitBlt that to the screen. But I always get a black bitmap... if I GradientFill directly to the screen it works. Below is a sample app to see what I mean. #pragma comment(lib, "msimg32.lib") #include <windows.h> const CHAR c_szWndClass[] = "Grad...

How can I check the color depth of a Bitmap?

I'm working on an application that prints a folder of image files, including JPEG and TIFF. The TIFF images are usually Black and White (1bpp). After loading the image, I want to determine if the image is Color or B&W or Grayscale so I can send the image to the right printer (color printer or black and white printer). I'm using the Bi...

How can I accurately draw my rotated bitmap?

Hi - I have a container with masked bitmap in it. The scale and rotation of this container changes at runtime, and I need to draw the masked bitmap but cannot figure out the appropriate matrix calculations to do so. My code works correctly to reflect position, scale, offset for centering without rotation. When rotated, the angle is cor...

C header file with bitmapped fonts

Hi, I need to do some rudimentary text rendering to a pixel buffer, and I think that having a table indexed by char with the representation of the letters as a binary array would be more than enough... Anybody knows about a free header as such? Example: char data[256][8][8]; void init() { data['a'] = { {0,0,1,1,1,0,0,0}, {0,1...

C# System.Drawing.Bitmap <-- how to check if image is valid before adding it to picturebox!

How do I do that in C#? :) Thx! ...

Delphi DIB with DIB Header into TBitmap

Hi All, I'm kindly asking you to help me with this problem: There's a byte array (data: PByte) containing DIB data AND DIBHeader: TDibHeader = record size: Cardinal; width: Integer; height: Integer; planes: Word; bits: Word; compression: Cardinal; image_size: Cardinal; x_res: Integer; y_res: Int...

draw object/image on canvas

Is there another way to draw an object on a canvas in android? This code inside draw() doesn't work: Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null); Well actually, it's working on my 1st code but when I've transfered this ...

Delphi, ImageList that handles BOTH png and bitmaps.

Recently I've found TPngImageList component ( http://cc.embarcadero.com/Item/26127 ) which is very good, but it handles only png images ... I'd like to have some imagelist that allows combining of pngimages with bitmaps, as I'm using lots of bitmaps, and I do not want to spend coming week converting those bitmaps to pngs, yet I want to u...

freeze on sending certain bitmaps to activities

Basically I receive the Image's URI from the Gallery, then created a Bitmap and want to send to another activity for displaying: Uri imageUri = intent.getData(); mBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri); Intent intent = new Intent(TakePictureActivity.this, PreviewActivity.class); intent.putExtra(EXTRA_...