Welcome, Guest. Please login or register.

Author Topic: Using the picture.datatype  (Read 3728 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Using the picture.datatype
« on: July 25, 2003, 02:28:03 AM »
Hi all,

Whilst the tumbleweed blows through my other 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
int p; // A
 

Offline KennyR

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 8081
    • Show only replies by KennyR
    • http://wrongpla.net
Re: Using the picture.datatype
« Reply #1 on: July 25, 2003, 02:34:25 AM »
What about the OS3.9 NDK, in Examples/Datatypes/Memory/testdt.c?
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #2 on: July 25, 2003, 02:36:50 AM »
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 :-)
int p; // A
 

Offline KennyR

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 8081
    • Show only replies by KennyR
    • http://wrongpla.net
Re: Using the picture.datatype
« Reply #3 on: July 25, 2003, 02:39:04 AM »
Sure it is, Karlos. Legal too.

Here.
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #4 on: July 25, 2003, 02:39:34 AM »
Bloody hell.

I must be blind as a bat - I have it on the 3.5 version :lol:

Ignore me!

-edit-

Thanks anyway matey :-)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #5 on: July 25, 2003, 02:59:00 AM »
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?
int p; // A
 

Offline KennyR

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 8081
    • Show only replies by KennyR
    • http://wrongpla.net
Re: Using the picture.datatype
« Reply #6 on: July 25, 2003, 02:59:41 AM »
You're welcome. ;-)

(You should get the 3.9 ndk though, AFAIR it has some include fixes. I may be wrong though.)
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #7 on: July 25, 2003, 03:05:47 AM »
Well I procured a copy just now anyway :-)

I'm still unclear how to go about pinching those pixels ;-)
int p; // A
 

Offline KennyR

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 8081
    • Show only replies by KennyR
    • http://wrongpla.net
Re: Using the picture.datatype
« Reply #8 on: July 25, 2003, 03:10:18 AM »
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.
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #9 on: July 25, 2003, 03:16:17 AM »
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 ;-)
int p; // A
 

Offline Thomas

Re: Using the picture.datatype
« Reply #10 on: July 25, 2003, 09:01:44 AM »

You can use this as an example: http://home.t-online.de/home/thomas-rapp/download/dtpic.c

Bye,
Thomas

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #11 on: July 25, 2003, 11:44:40 AM »
Thanks Thomas, that looks a bit more like what I need :-)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #12 on: July 27, 2003, 03:54:21 PM »
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?
int p; // A
 

Offline Thomas

Re: Using the picture.datatype
« Reply #13 on: July 27, 2003, 05:22:43 PM »

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

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Using the picture.datatype
« Reply #14 on: July 27, 2003, 06:10:41 PM »
Quote
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...

Quote
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)
int p; // A