| Anonymous | Login | Signup for a new account | 2013-05-26 10:04 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0022245 | FPC | FCL | public | 2012-06-10 13:58 | 2012-06-18 11:02 | ||||
| Reporter | Bernd Kreuss | ||||||||
| Assigned To | Marco van de Voort | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | resolved | Resolution | fixed | ||||||
| Platform | all | OS | all | OS Version | all | ||||
| Product Version | 2.6.1 | Product Build | |||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0022245: [Patch] fcl-image, interpolation, wrong initialization of alpha channel | ||||||||
| Description | There is a small bug in packages/fcl-image/src/fpinterpolation.inc that essentially makes it impossible to use TFPImageCanvas.StretchDraw() with images that have alpha transparency. Attached is a patch. When it calculates the interpolated value of the new pixel it will first initialize this pixel with colBlack. This is wrong. The intention is to initialize all 4 channels of the pixel with zero but colBlack only has the RGB values set to zero, alpha is set to $ffff. The correct value would have been colTransparent which has them all four set to zero. The attached patch will fix it. Without the patch any attempt to use StretchDraw() on an image with alpha transparency would end up with most of the resulting alpha values in the resulting image set to $ffff. I am also attaching a small demo program (interpoltest.lpr), there is also a small PNG file with alpha channel in this archive for convenience, running the program should scale the image 'original.png' to 64*64 and save it to 'scaled.png' where you can then examine it with gimp to observe how the alpha channel gets messeed up during this operation. The patch was made against the current 2.6 fixes branch, I have not yet tested 2.7 trunk but most likely it is there also. (also maybe after it is fixed it would be nice to add a small example how to scale images to the fcl-image examples, it took me a while to figure out that it actually even *has* the capability to do this) | ||||||||
| Steps To Reproduce | To reproduce it unzip and compile the attached demo in the attached interpoltest.tar.bz2 archive. Run the program, it will create an image 'scaled.png', observe how the alpha channel in this image was corrupted during scaling. | ||||||||
| Tags | fcl-image | ||||||||
| FPCOldBugId | |||||||||
| Fixed in Revision | 21639 | ||||||||
| Attached Files | |||||||||
Notes |
|
|
(0060447) Bernd Kreuss (reporter) 2012-06-11 18:39 |
btw, the attached demo has a memory leak, I forgot to free the canvas object but this does not impact its function. |
|
(0060606) Marco van de Voort (manager) 2012-06-18 11:02 |
Applied, committed test as examples/interpoldemo (no picture though, to keep svn lean) |
|
(0060607) Marco van de Voort (manager) 2012-06-18 11:02 edited on: 2012-06-18 11:02 |
Note that I expect 0011217 to be something similar. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-06-10 13:58 | Bernd Kreuss | New Issue | |
| 2012-06-10 13:58 | Bernd Kreuss | File Added: interpol-must-be-all-zero.patch | |
| 2012-06-10 13:59 | Bernd Kreuss | File Added: interpoltest.tar.bz2 | |
| 2012-06-11 15:48 | Marco van de Voort | Tag Attached: fcl-image | |
| 2012-06-11 18:39 | Bernd Kreuss | Note Added: 0060447 | |
| 2012-06-18 11:02 | Marco van de Voort | Fixed in Revision | => 21639 |
| 2012-06-18 11:02 | Marco van de Voort | Status | new => resolved |
| 2012-06-18 11:02 | Marco van de Voort | Resolution | open => fixed |
| 2012-06-18 11:02 | Marco van de Voort | Assigned To | => Marco van de Voort |
| 2012-06-18 11:02 | Marco van de Voort | Note Added: 0060606 | |
| 2012-06-18 11:02 | Marco van de Voort | Note Added: 0060607 | |
| 2012-06-18 11:02 | Marco van de Voort | Note Edited: 0060607 | |
| Main | My View | View Issues | Change Log | Roadmap |



