|
Displaying animated GIFs / PNGs |
Posted on: 12/1 12:45
#1 |
---|---|---|
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 |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/1 12:53
#2 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2886
|
@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. |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/2 12:37
#3 |
---|---|---|
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. ![]() |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/2 13:45
#4 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3942
|
|
|
_________________
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 |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/2 15:25
#5 |
---|---|---|
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. |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/2 16:04
#6 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3942
|
@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 |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/2 16:17
#7 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2886
|
@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. |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/3 20:01
#8 |
---|---|---|
Amigans Defender
![]() ![]() Joined:
2006/11/17 22:40 From England
Posts: 3254
|
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. |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/3 20:04
#9 |
---|---|---|
Amigans Defender
![]() ![]() Joined:
2006/11/17 22:40 From England
Posts: 3254
|
@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. |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/4 10:45
#10 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3942
|
@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 |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/5 15:27
#11 |
---|---|---|
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),
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 |
||
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/5 23:24
#12 |
---|---|---|
Amigans Defender
![]() ![]() Joined:
2006/11/17 22:40 From England
Posts: 3254
|
@Raziel
I do that in NetSurf but it's just blitted to the window, not to a gadget. |
|
|
Re: Displaying animated GIFs / PNGs |
Posted on: 12/5 23:55
#13 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/26 21:45 From a dying planet
Posts: 3942
|
@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 |
||