flat assembler
Message board for the users of flat assembler.
Index
> Windows > Set/Get Pixel Replacement |
Author |
|
comrade 01 Aug 2005, 03:33
what? where? how?
|
|||
01 Aug 2005, 03:33 |
|
comrade 01 Aug 2005, 03:37
When you ask something, post more information about the context of your problem so people can assist you better. FRUSTRATION LOOMS UPON YOU AND YOUR FRIENDS.
For bitmaps, you can try using GetObject() API to retrieve a pointer to the bitmap bits. If you create bitmaps yourself, use CreateDIBSection() API so you automatically get the pointer to the bitmap data. Once you have a pointer to the bitmap data, you can locate the pixel by using this formula: Code: ptr = (y * scanline) + (x * bpp / 8) where: ptr is the offset into the bitmap data (and ultimately the pointer to the pixel you are looking for) scanline is the width of a single row of pixels in the bitmap, in bytes (usually it is equal to width*bpp/8, and width is aligned on a 32-bit boundary) bpp is the bitmap depth of your bitmap (24-bits, 32-bits, etc) |
|||
01 Aug 2005, 03:37 |
|
comrade 01 Aug 2005, 03:43
In complexity, this is equal to regular GDI GetPixel/SetPixel. However, I can imagine that those two functions have a lot of overhead to deal with (colour-space conversion, etc). The optimization comes when you have to make concurrent calls to GetPixel/SetPixel. For example, if are reading every pixel in a bitmap after each other, it is not necessary to call GetPixel everytime. Instead you should start with the pointer to the bitmap, read the pixel, then advance the pointer by the size of the pixel. Do not forget to take care of the padding at the end of rows.
|
|||
01 Aug 2005, 03:43 |
|
cod3b453 01 Aug 2005, 10:21
First, sorry if I annoyed you in any way.
Context: I have 4 bitmaps created with CreateCompatibleBitmap API: one has the loaded bitmap for the window skin, the second has a desktop blit from BitBlt, the third has a loaded alpha blend map and the fourth is the destination bitmap. The skin and desktop capture are combined using an alpha blend routine, where the alpha blend varies with the alpha blend map. Then the destination bitmap is blitted to the window using BitBlt. BitBlt, SetPixel and GetPixel are slow, so by replacing these API, the result should be more pleasing. Here's what it looks like: [LINK REMOVED] |
|||
01 Aug 2005, 10:21 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.