Re: [GD-DEVEL] [proposal] Attach DIB section buffer to gdImage
| From: | Markus Fleck-Graffe | Date: | Wed, 13 Feb 2008 06:47:25 +0000 |
| Subject: | Re: [GD-DEVEL] [proposal] Attach DIB section buffer to gdImage | ||
| References: | 1 2 3 4 5 6 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-359@lists.php.net to get a copy of this message | ||
Pierre schrieb:
I'm finishing the initial support of the new formats. The two most important additions for you and other users are the true 8bit per channel (alpha) and the contiguous buffer instead of per row allocation. It will let you use a DIB/BMP (or any compatible buffer) directly without any extra allocations or loop. It will require a lof tests and work to get stable enough for 2.1.x :)For what it's worth, there is a documentation of the Windows DIB/BMP in-memory format at the following URL: http://support.microsoft.com/?scid=kb%3Ben-us%3B81498&x=12&y=14 It appears that some alignment issues must be observed in order to be able to use plain RGB-style buffers directly on Microsoft Windows: "Every scanline is DWORD-aligned. The scanline is buffered to alignment; the buffering is not necessarily 0." (On Windows, a DWORD equals 4 bytes.) But things get even worse: - "Red, green, and blue bytes are in reverse order (red swaps position with blue) from the Windows convention." - "The scanlines are stored upside down" (The article blames the latter two conventions on some alleged OS/2 Presentation Manager compatibility.) So unless the pending (new) GD in-memory data format will offer a possibility for "DWORD 4-byte alignment padding" upon creation of a new image buffer, exporting a GD image to a Microsoft Windows DIB will require copying of the whole image (in addition to the additional RGB/BGR and upside-down hassle). Yours, Markus.