Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Karlos on July 25, 2003, 02:28:03 AM
-
Hi all,
Whilst the tumbleweed blows through my other (http://www.amiga.org/forums/showthread.php?t=3399) query, I have another one :-)
Can anybody point me in the direction of any example/tutorial C sources for using the datatypes.library?
In particular, I'm interested in using the v43+ picture datatype to decode an image format into a 24-bit RGB (or 32-bit ARGB where applicable) buffer in memory. I'm not concerned in rendering the datatype to a window or anything, I just want to get the pixel data itself.
I found a small program on aminet that converts images to .ppm format via datatypes so I assume this kind of thing is relatively straightforward (at least I hope it is)...
Cheers,
K
-
What about the OS3.9 NDK, in Examples/Datatypes/Memory/testdt.c?
-
I only have the 3.5 NDK...
Is it possible to get that file anywhere else?
-edit-
Assuming its not illegal to do so, that is :-)
-
Sure it is, Karlos. Legal too.
Here (http://www.amiga.com/3.9/download/NDK3.9.lha).
-
Bloody hell.
I must be blind as a bat - I have it on the 3.5 version :lol:
Ignore me!
-edit-
Thanks anyway matey :-)
-
Hmm, this still doesnt quite look like what I need - this is reading a datatype object from a raw memory source.
What I need is to take the decoded image data from a datatype and use it for my own ends,,,
Is there a DoMethod() method for reading the decoded RGB pixels in the image?
-
You're welcome. ;-)
(You should get the 3.9 ndk though, AFAIR it has some include fixes. I may be wrong though.)
-
Well I procured a copy just now anyway :-)
I'm still unclear how to go about pinching those pixels ;-)
-
I've never done anything like that before, but I do know datatypes is very, very limited in its abilities. Some have use guigfx.library and render.library instead for image data manipulation. But since I've done neither myself, I can't help you much, sorry.
-
Me neither, hence my problem :-)
As I said, I'm not interested in actually rendering the datatype (which is what they seem to be aimed at), just using it as a nice codec...
Still, thanks anyway ;-)
-
You can use this as an example: http://home.t-online.de/home/thomas-rapp/download/dtpic.c
Bye,
Thomas
-
Thanks Thomas, that looks a bit more like what I need :-)
-
Hi again...
Well at the risk of sounding like a newbie...
I see the v43 extensions support exactly what I need - that is it supports PDTM_WRITEPIXELARRAY ans PDTM_READPIXELARRAY.
The latter would seem to be the method I need. The pictureclass.h header doesn't really go into much depth. There is a pdtBlitPixelArray struct defined also, containing width, height, modulus and buffer address, so I assume its the argument for the above methods.
I'm just a bit nonplussed that it also contains a ULONG MethodID field The header contains no hint as to what this is for. Is this just a copy of PDTM_READ/WRITEPIXELARRAY? Seems odd that it would be needed :-?
Can anybody confirm the usage of these methods for me?
So far I'm guessing its...
void* buffer;
....
struct Object* picObject;
...
struct pdtBlitPixelArray myPixelArray;
myPixelArray.MethoodID = PDTM_READPIXELARRAY;
myPixelArray.pbpa_PixelData = buffer;
...
DoMethod(picObject, PDTM_READPIXELARRAY, &myPixelArray);
Is this correct?
-
You should read the autodocs.
DoMethod() is a varargs stub for DoMethodA() and DoMethodA() takes two arguments, obj and msg, where msg in this case is struct pdtBlitPixelArray.
So MethodID is not a copy of PDTM_READPIXELARRAY, it is the place where PDTM_READPIXELARRAY belongs to.
If you want to use DoMethod() instead of DoMethodA() you can write all fields of struct pdtBlitPixelArray into the arguments:
DoMethod (obj,PDTM_READPIXELARRAY,data,format,mod,left,top,width,height);
Bye,
Thomas
-
You should read the autodocs.
Well that's the most polite RTFM I've seen :-D
Anyway, I have been - I'm just not fully up to speed with the BOOPSI mechanisms for method/attribute handling - I come from a pure C++ background and find all this GetAttrs / DoMethod stuff a bit arcane...
So MethodID is not a copy of PDTM_READPIXELARRAY, it is the place where PDTM_READPIXELARRAY belongs to.
Ah, I get it :-) I was filling in the structure when it's really the job of the varargs DoMethod() to do so from the arguments I pass...
Silly me :oops: :lol:
Well, thanks a lot, that's cleared that one up nicely :-)
In line with the sig, oldDog->teach(new Trick)