Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
78 user(s) are online (64 user(s) are browsing Forums)

Members: 0
Guests: 78

more...

Support us!

Headlines






Displaying animated GIFs / PNGs
Just popping in
Joined:
2009/2/21 14:27
Posts: 53
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

   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2887
@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.
   Report Go to top

Re: Displaying animated GIFs / PNGs
Just popping in
Joined:
2009/2/21 14:27
Posts: 53
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.


   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 3948
@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
   Report Go to top

Re: Displaying animated GIFs / PNGs
Just popping in
Joined:
2009/2/21 14:27
Posts: 53
@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.


   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 3948
@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
   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2887
@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.
   Report Go to top

Re: Displaying animated GIFs / PNGs
Amigans Defender
Joined:
2006/11/17 22:40
From England
Posts: 3255

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.

   Report Go to top

Re: Displaying animated GIFs / PNGs
Amigans Defender
Joined:
2006/11/17 22:40
From England
Posts: 3255
@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.

   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 3948
@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
   Report Go to top

Re: Displaying animated GIFs / PNGs
Just can't stay away
Joined:
2007/2/23 13:49
From Finland, the land of Santa, sauna, sisu and salmiakki
Posts: 1107
@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 excuse me.
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
   Report Go to top

Re: Displaying animated GIFs / PNGs
Amigans Defender
Joined:
2006/11/17 22:40
From England
Posts: 3255
@Raziel

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

   Report Go to top

Re: Displaying animated GIFs / PNGs
Home away from home
Joined:
2006/11/26 21:45
From a dying planet
Posts: 3948
@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
   Report Go to top





[Advanced Search]



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project