bitmap

how can i "reset" the canvas (and the bitmap used to draw into) so i can draw a new bitmap into the canvas ?

My loadMap() method generate a canvas.throwIfRecycled exception when i try to load a new map. When i start the game, the initial map loads and work fine though, its only when i try to load a new map that i get the exception .. how can i "reset" canvas and the bitmap i use to draw into, so i can startover fresh with them ? here's what ...

Actionscript 3 pixel perfect collision. How to? (learning purposes)

I know that there are people out there creating classes for this (ie http://coreyoneil.com/portfolio/index.php?project=5). But I want to learn how to do it myself so I can create everything I need the way I need. I've read about BitMap and BitMapData. I should be able to .draw the MovieClips onto a BitMap so I could then cycle the pixel...

Is it possible to draw antialiased text on an 8bpp bitmap in Win32?

I've selected an 8bpp bitmap into a CDC, and used ::TextOut () to draw text. The font quality is ANTIALIASED_QUALITY, but the text comes out in monochrome; no gray pixels & jagged edges. The 8bpp bitmap was extracted from a 24bpp bitmap that already had antialiased text drawn on it, and THAT text is ok. (Both text types are in the sam...

File not found error with LoadImage() (Windows)

EDIT: I've added a few more lines of the program to the code snippet below. I have the following line of code in a program BITMAP BMP; HBITMAP hBMP; hBMP = (HBITMAP)LoadImage(GetModuleHandle(NULL), "Test.bmp", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); if (!hBMP) return 1; GetObject(hBMP, sizeof(BMP), &BMP); and wh...

Define BIT0, BIT1, BIT2, etc Without #define

Is it possible in C++ to define BIT0, BIT1, BIT2 in another way in C++ without using #define? #define BIT0 0x00000001 #define BIT1 0x00000002 #define BIT2 0x00000004 I then take the same thing and make states out of those bits: #define MOTOR_UP BIT0 #define MOTOR_DOWN BIT1 Note: I am using 32 bits only, not 64 bits. I am also usi...

how to read I-node bitmap of a minix fs bit by bit in c

Hi, I wanted to know how can I read and check(1 or 0) the bits of the the I-node bit map of a minix fs bit by bit in c programming language. This way I want check the free and occupied I-nodes. And also if possible to set and unset the bits manually. Please help. Thank you this is the layout of the minix file system ----------------...

Get Pixel Values from Android Canvas

Hi, I'm currently writing an Android game using surfaceView. I've optimized the game as much as possible and it runs quite smoothly. However, I have collision detection incorporated which is a bit messy. I would like to do collision detection by reading pixels directly from the canvas. Is this possible to do? The closest to this that I ...

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

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. ...

Basic drawing tools for .NET application

I need a control that allows loading a picture, performing some basic drawing tasks with it (including adding text, pencil, oval, horizontal and diagonal lines), and exporting it as bitmap. Anything like that available? Thanks ...

Memory efficient image resize in Android

Hi, I am trying to reduce the size of images retrieved form the camera (so ~5-8 mega pixels) down to one a a few smaller sizes (the largest being 1024x768). I Tried the following code but I consistently get an OutOfMemoryError. Bitmap image = BitmapFactory.decodeStream(this.image, null, opt); int imgWidth = image.getWidth(); int imgHeig...

WinAPI/GDI: why snapshot of large windows includes taskbar?

Hello people. I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap ...

How to build Android NDK sample: "bitmap-plasma"

I am trying to build the bitmap-plasma sample that is included with the ndk, but getting an error. I run ndk-build from the samples/bitmap-plasma directory, and the error it displays is that it cannnot locate android/bitmap.h file. How do i direct the ndk-build script to the file it needs? Using android-ndk-r4 on Ubuntu Lucid 10.04 ...

Android encode string as bitmap?

Is there a way to encode a string as a bitmap? Or a drawable? Thanks Chris ...

Replace Color Gradient In Transparent Image

I have small function which will recolor pixels in a Bitmap from a given color to a new given color. The problems I have with the code are as follows: 1) The function gives results which are remapping white pixels which should not be concidered since I have a threshold... (unless I have defined this calculation wrong) 2) When certain ...

Save image in Oracle without retrieving a BMP later

Hello there. Right now I'm facing some performance issues in a web app because of a situation with Oracle saving images and my webapp getting them. The database gets the input from a form, which allows user to save any kind of image as a BLOB. No matter the format, it gets saved in a table with its description and stuff. The field gett...

Fast CRC of a Drawing.Bitmap

On application startup I build a cache of icons (24x24 32bbp pre-multiplied argb bitmaps). this cache contains roughly a thousand items. I don't want to store the same image multiple times in this cache, for both memory and performance reasons. I figured the best way would be to create some sort of crc from each bitmap as it goes into th...

Writing EXIF metadata to images in Android

Hi, I want to store some metadata in images. My camera application gives me a bitmap, which I store in the storage (MediaStore) device. In addition to this, I want to add a few tags to the picture in its metadata. I think EXIF is a good way of doing this. But I couldn't find good references on how to do this. If there are some tools to ...

drawing layout through canvas

I have a layout like : <ll vertical> <ll horizental> <textview></textview> <textview></textview> </ll> <ll horizental> <textview></textview> <textview></textview> </ll> </ll> The problem is i need to display this as part of my whole screen. i am doing mCustomDrawableView = new CustomDrawableView((Context)this, R.drawable.mychar...

I can't figure out why this code does not display an Image in Android

I am following very closely to the sample codes in the resources for TicTacToeLib as well as an example of how to display a bitmap in a book titled Android Application Development. I am doing all the same things they are doing, the only difference is I am using a SurfaceView instead of a view. Can anyone tell me what I am doing wrong? T...

How to fill bitmap object with color in Android

I'm working on Android game and there are some problem appear I want to fill a color on bitmap object but can not I tried bitmap.setPixel but my Image is PNG format (like a circle or unsharp, surrounded with transparent color) and android can not getHeight() or getWidth(), ie ImageView i = new ImageView(mContext); Bitmap bMap = BitmapF...