Animated GIF with transparency
Animated GIF with transparency
I'm looking for an OCX that can play animated GIF files that have transparency.
Does anyone have a suggestion?
Does anyone have a suggestion?
The eXpress train is coming - and it has more cars.
Re: Animated GIF with transparency
what about using XbpHTMLViewer() to show animated GIF ?
greetings by OHR
Jimmy
Jimmy
Re: Animated GIF with transparency
I tried that and it isn't going to work.what about using XbpHTMLViewer() to show animated GIF ?
We need the background transparency because we are overlaying an animated GIF over a bitmap.
XbpHTMLViewer paints a box with scroll bars.
The eXpress train is coming - and it has more cars.
Re: Animated GIF with transparency
Hi Roger
http://www.imagemagick.org/script/binary-releases.php
ImageMagick-7.0.4-2-Q16-x64-dll.exe
Use ImageMagick® to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Here are just a few examples of what ImageMagick can do for you:
Animation create a GIF animation sequence from a group of images.
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_b ... grass2.gif
Best Regard
Hector
http://www.imagemagick.org/script/binary-releases.php
ImageMagick-7.0.4-2-Q16-x64-dll.exe
Use ImageMagick® to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Here are just a few examples of what ImageMagick can do for you:
Animation create a GIF animation sequence from a group of images.
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_b ... grass2.gif
Best Regard
Hector
Re: Animated GIF with transparency
Hector -
Thank you for that info.
I had already created my own Animation from a set of .PNG images.
I save all the image buffers into an XML file and then load the XML tree and step thru the tree to paint each image.
It works very good.
I'm going to post the sample here after a few finishing touches.
This is the code that creates the XML file with all the images:
Thank you for that info.
I had already created my own Animation from a set of .PNG images.
I save all the image buffers into an XML file and then load the XML tree and step thru the tree to paint each image.
It works very good.
I'm going to post the sample here after a few finishing touches.
This is the code that creates the XML file with all the images:
Code: Select all
FUNCTION DC_AnimatedImageCreate( cPrefix, cType, aTransparentColor )
LOCAL aDir, cFileName, oBitmap, oAnimate, oImages, oImage, cImageFile, ;
cBuffer, i
DEFAULT cPrefix := '', ;
cType := 'BMP', ;
aTransparentColor := { 192,192,192 }
aDir := Directory( cPrefix + '*.' + cType )
ASort( aDir,,,{|a,b|a[1]<b[1]})
IF Empty( aDir )
DCMSGBOX 'Image File could not be created'
ELSE
oAnimate := DC_XmlNode():new('AnimatedImage')
oAnimate:addNode( DC_XmlNode():new('ImageFormat',Upper(cType)) )
oAnimate:addNode( DC_XmlNode():new('TransparentColor',DC_ArrayString(aTransparentColor)) )
oImages := DC_XmlNode():new('Images')
oAnimate:addNode(oImages)
oBitmap := XbpBitmap():new():create()
cFileName := cPrefix + '.Xml'
FOR i := 1 TO Len(aDir)
cImageFile := aDir[i,1]
oBitmap:loadFile(cImageFile)
cBuffer := oBitmap:setBuffer()
oImage := DC_XmlNode():new('Image')
oImages:addNode(oImage)
oImage:addNode( DC_XmlNode():new('FileName',cImageFile) )
oImage:addNode( DC_XmlNode():new('EncodedData',Bin2Base64(cBuffer)) )
NEXT
oBitmap:destroy()
oAnimate:writeXml(cFileName)
DCMSGBOX 'File: ' + cFileName + ' was created.'
ENDIF
RETURN nil
The eXpress train is coming - and it has more cars.
Re: Animated GIF with transparency
Here is an animation I created using the most current build of eXpress++ (265).
Build 265 will be released this month.
This sample requires Xbase++ 2.0, however it will also compile under 1.9 when build 265 is released.
http://bb.donnay-software.com/samples/animation.zip
Build 265 will be released this month.
This sample requires Xbase++ 2.0, however it will also compile under 1.9 when build 265 is released.
http://bb.donnay-software.com/samples/animation.zip
The eXpress train is coming - and it has more cars.
Re: Animated GIF with transparency
hi,
have run your Demo.
Comment
a.) load moving Bitmap (taxitest_ani00.jpg) with
b.) IMHO GraSaveScreen()/GraRestScreen() UDF is not need just
c.) run it in a Thread
d.) use this Tip from Tillhave modify Alaska Sample \SOURCE\samples\basics\THREAD\Worms.prg.
have run your Demo.
Comment
a.) load moving Bitmap (taxitest_ani00.jpg) with
Code: Select all
o:transparentClr := o:getDefaultBGColor()
Code: Select all
oStatic:invalidateRect(aRect) // aRect := Size of moving Bitmap
d.) use this Tip from Till
Code: Select all
/*
Formdesiger Class Code
\JHV2013\GUI-Anwendungen\Problems, Solutions\Flicker\Solution - ClipChildren\_TEST.PRG
*/
::XbpDialog:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
IF aSize[1] == 0 .AND. aSize[2] == 0
::XbpDialog:ClientSize := {582,359}
ENDIF
::XbpDialog:drawingArea:clipChildren := .T. // <- add THIS Line !!!
::XbpDialog:taskList := .T.
::XbpDialog:title := "New form"
greetings by OHR
Jimmy
Jimmy
Re: Animated GIF with transparency
I can't believe I never saw this method before. That works just fine.o:transparentClr := o:getDefaultBGColor()
My first attempt at this used :invalidateRect() because that was so simple.oStatic:invalidateRect(aRect) // aRect := Size of moving Bitmap
Unfortunately, it also causes too much flicker on large bitmaps.
This is why I had to develop a more complicated approach.
I needed a smoother animation. Since I posted my sample, I smoothed it out even more.
I also reduced the size of the .XML file by a factor of 10.
It IS running in a thread.run it in a Thread
I still get the flicker when using invalidateRect().::XbpDialog:drawingArea:clipChildren := .T. // <- add THIS Line !!!
I have replaced that with oBitmap:draw().
Here is an updated version:
http://bb.donnay-software.com/samples/animation.zip
The eXpress train is coming - and it has more cars.
Re: Animated GIF with transparency
i need invalidateRect() to "activate" Ownerdraw ...rdonnay wrote:I still get the flicker when using invalidateRect().
I have replaced that with oBitmap:draw().

i have made some Sample and try to "move" a smaller Image but it does flicker
when o:SetPos(aPos). same with o:SetCaption(x) when x = Bitmap.
i made a Class to "make" Bitmap using o:Draw.
Code: Select all
1.) using GraBitBlt() to "Snapshot" Parent Area ( o:FillBG() )
2.) xBanner:draw
3.) xPic:draw both to same Presspace

so i try
Code: Select all
5.) make external Parent Ownerdraw
6.) now just oParent:invalidateRect() to activate Ownerdraw

greetings by OHR
Jimmy
Jimmy
Re: Animated GIF with transparency
have found GIF89.DLL
have test it and made a small Demo and Help file as you see it have only 2 Method : Play() and Stop()
as always you have to register GIF89.DLL as Administratorhave fun
! Note : on 64bit OS() you have to copy GIF89.DLL to C:\Windows\System32\ AND (!!!) c:\Windows\SysWOW64\ before register with c:\Windows\System32\regsvr32.exe
have test it and made a small Demo and Help file as you see it have only 2 Method : Play() and Stop()
as always you have to register GIF89.DLL as Administrator
Code: Select all
regsvr32.exe GIF89.DLL
! Note : on 64bit OS() you have to copy GIF89.DLL to C:\Windows\System32\ AND (!!!) c:\Windows\SysWOW64\ before register with c:\Windows\System32\regsvr32.exe
- Attachments
-
- XB_GIF89.ZIP
- DLL / Xbase++ Demo Source
- (71.89 KiB) Downloaded 1015 times
greetings by OHR
Jimmy
Jimmy