On Wed, Feb 27, 2008 at 8:48 AM, bill lam cbill.lam@gmail.com wrote:
The app is a package called 'platimg' of J language.
I had reported this and I believed that it is the negative stride that caused the problem.
Where did you report it? I can't find a bug report.
Would you like to file a Wine bug, or should I?
NB. load and decode a jpeg file into 2D integer matrix with each integer NB. for one pixel element. readimg1 'picture.jpg'
where definition of readimg1 is as follows
readimg1=: 3 : 0 GdiplusStartup (TOK=.,_1);GdiplusStartupInput;0 GdipCreateBitmapFromFile y;BMP=.,_1 z=. bmpARGB {.BMP GdiplusShutdown {.TOK z )
bmpARGB=: 3 : 0 DATA=. i.4%~#BitmapData GdipBitmapLockBits y;0;ImageLockModeRead;PixelFormat32bppARGB;DATA 'w h s f p r'=. DATA z=. (h,w)$memr p,0,(w*h),JINT GdipBitmapUnLockBits y;DATA GdipDisposeImage y z )
Here GdipBitmapLockBits has 2 issues,
- GdipBitmapLockBits accept a null for rect (the second argument) to stands for
the entire region. I can workaround this by calling GdipGetImageWidth and GdipGetImageHeight to construct the rect. However
- the data returned GdipBitmapLockBits does not point a valid bitmap data, so
the when trying memory read in the following z=. (h,w)$memr p,0,(w*h),JINT J gives raise a domain error. (but no crash, so that no crash log)
Scripts of J can be difficult to understand, but since this example calls gdiplus api so that you can follow it without much difficulty and write an equivalent c program to test it.
current version of J can be downloaded here. http://www.jsoftware.com/beta.htm after installation, run package manager that comes with J to install the platimg addon.
Cool, thanks. I also see it's documented here: http://olegykj.sourceforge.net/scripts/platimg.htm - Dan