Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
113 user(s) are online (59 user(s) are browsing Forums)

Members: 0
Guests: 113

more...

Headlines

 
  Register To Post  

Displaying animated GIFs / PNGs
Just popping in
Just popping in


See User information
Hi,
I'd like to know how I can (dis)play animated GIFs / PNGs in the ReAction window of my application.
I hope it's just a matter of telling the picture datatype where to load it from and where to draw it.
But how?
And will the animation keep running automatically and indefinitely, or do I regularly have to load and draw the next frame myself?
Any help appreciated. :)
Thanks,
Tom

Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@tomsoniq

Look at datatype’s tutorials in the SDK, anim gif’s should work just as .anim files, if not I suggest converting your .gif files into .anim files.

Datatypes is OO style API, that provides class that can be interested into window or GUI.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Displaying animated GIFs / PNGs
Just popping in
Just popping in


See User information
Hmm, I can't find any dedicated datatypes example, only GUI/BackFill but that's not what I want.
And I think it's a little more complex than just:

LAYOUT_AddChild, Objects[OBJ_PICTURE] = NewDTObject(
"picture.png",
DTA_GroupID, GID_PICTURE,
ICA_TARGET, ICTARGET_IDCMP,
TAG_END),

because that doesn't display anything.


Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@tomsoniq

Hey Tom

Would this maybe help?

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Displaying animated GIFs / PNGs
Just popping in
Just popping in


See User information
@Raziel
Hi,
that's pretty close but it attaches a datatype object to an empty space in a window at a fixed position where no gadget is.
I need it as a child of a layout object.

I also tried adding it with LAYOUT_AddImage instead of LAYOUT_AddChild but that doesn't help either.

So my code for the layout section of the window currently is:
LAYOUT_AddChild, LayoutObject,
LAYOUT_VertAlignment, LALIGN_CENTER,
LAYOUT_HorizAlignment, LALIGN_CENTER,

LAYOUT_AddChild, Objects[OBJ_BUTTON] = ButtonObject,
GA_Text, "Button",
ButtonEnd,
CHILD_WeightedWidth, 0,
CHILD_WeightedHeight, 0,


LAYOUT_AddImage, Objects[OBJ_PICTURE] = NewDTObject("picture.png",
DTA_SourceType, DTST_FILE,
DTA_GroupID, GID_PICTURE,
PDTA_DestMode, PMODE_V43,
PDTA_ScaleQuality, 1,
TAG_END),
CHILD_WeightedWidth, 0,
CHILD_WeightedHeight, 0,

LayoutEnd,
CHILD_WeightedHeight, 0,

But I only get the button, not the picture.


Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@tomsoniq

The only other thing i can find are the autodocs for datatypes...but i guess you already looked there?

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@tomsoniq

Yes it gadtools, so I guess its not 100% compatible with Reaction, I guess need to move the gadget manually, when window resize etch, I know reaction has empty space gadget or something like that, can be used.

Custom reaction classes are possible.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Displaying animated GIFs / PNGs
Amigans Defender
Amigans Defender


See User information

Note that there are two GIF Anim data types. One is a picture subclass, the other is a animation subclass.

I don't think you can realistically attach either to a window although it probably depends on exactly what you are trying to achieve.

You either need to decode the frames through data types (but that depends on knowing whether you have picture or animation data, and handle it differently for each), or use your own decoding routine (or a 3rd party library - libnsgif is small and easy to use). In either case you will need to manually update the data in the window for each frame.

Go to top
Re: Displaying animated GIFs / PNGs
Amigans Defender
Amigans Defender


See User information
@tomsoniq

LAYOUT_AddImage is correct, but you need to give it a Reaction imageclass, not a datatypes object. I don't think there is an anim.image, but there is a bitmap.image which will load and display a picture subclass for you. If you want animation you'll need to update it with each frame manually.

Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@Chris

That sounds painful and cpu hungry

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Displaying animated GIFs / PNGs
Just can't stay away
Just can't stay away


See User information
@tomsoniq, others

You can add a datatype object into a "Reaction" layout but CHILD_DataType,TRUE is needed.
LAYOUT_AddChild,IDataTypes->NewDTObject(...,TAG_END),
CHILD_DataType,TRUE,
CHILD_NoDispose,TRUE,


I don't think a layout/window can display animations on its own, like others have said. You have to display frames one by one on your own.

Trying to display an anim gif as a datatype object that way (above) after installing gifanim datatype from os4depot simply crashes badly. In case the author of anim gif is interested it crashes with memory pointer DEADBEEF.

Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top
Re: Displaying animated GIFs / PNGs
Amigans Defender
Amigans Defender


See User information
@Raziel

I do that in NetSurf but it's just blitted to the window, not to a gadget.

Go to top
Re: Displaying animated GIFs / PNGs
Home away from home
Home away from home


See User information
@Chris

Hmm, maybe that's sufficient?
Thanks for the hint

@tomsonic

Would that help?

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project