Author Topic: Gdi+ Gif Animation Test  (Read 2655 times)

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Gdi+ Gif Animation Test
« on: November 09, 2020, 06:47:54 AM »
Hi Guys

I made a small test to load icons (with and without transparency), jpg, animated gif, png (with transparency), and tifs using Gdiplus following the idea made by JJ and Marinus. Can someone please test to see if there is a gdi leaking happenning ?

The app will open a opendialog box twice. The 1st image you choose as the foreground (icon, jpg, gifs etc etc) and the second image (gif, ico, jpg etc) it will be displayed filing the whole window/control where the image is to be showed. Also you can freely resize the window and the background image will stretch according.

I tried to use only Local variables to make this work, rather the using global) all controled by a single structure filled in WM_CREATE message. (Used globally). So, i needed only one major Global structure to control all of this

Once you open the image, it will call to a function GdipCreateImageInfo that will setup the whole data necessary for the used structure (Which i labeled as GdipImageNfo).

Then all the rest of the functions relies only in WM_PAINT, while WM_SIZE and WM_TIMER, contains only few modifications of the variables used onto that structure.

Note: I´ll do the necessary extra comments about the usage of each of the functions later if the app is really working ok without any leaks and will update it here, ok ? :)

The attached code (Embedded inside the executable as usual) is something like this:

At WM_CREATE:

Code: [Select]

(...)
[AnimateFramePerSec: F$ 60] ;  Frames per second to be used in GdipCreateImageInfo to calculate and create a smooth animation. The value of  "3" in GdipCreateImageInfo is the Keyframe of the sequence of repeated images to be animated

; Simple equates used as flag representing how we want our image to be displayed
[GDIP_DRAWIMG_DEFAULT 0] ; Default view. So, the image is displayed as it is without altering his X, Y pos and neither affecting the original width and height
[GDIP_DRAWIMG_FILL 1] ; Fill all over tyhe control or window. The image will fill the window/;control where it will be displayed. Generally it can be used as a image background
[GDIP_DRAWIMG_AUTO_ADJUST 2] ; To be implemented yet.
[GDIP_DRAWIMG_CUSTOM 3] ; To be  implemented yet

(...)

    ...Else_If D@Message = &WM_CREATE

        mov D$OtherFilePtr 0
        mov D$OtherFileLen  0
        call 'FastCRT.GetOpenFileEx' 0, OtherSaveFilter, {B$ "Choose a Image File", 0}, Sz_OpenImageFileFilters, &NULL, RsrcIconNfo.IconDataPtr, RsrcIconNfo.Size, 0, &NULL ; <------ Simply api i build to open a file (images) in this case) and store their contents loaded in memory and it´s size variables
        On eax = 0, ExitP
        call 'FastCRT.GetOpenFileEx' 0, OtherSaveFilter, {B$ "Choose a Image File", 0}, Sz_OpenImageFileFilters, &NULL, RsrcIconNfo.IconDataPtr2, RsrcIconNfo.Size2, 0, &NULL |  On eax = 0, ExitP

        call GdipCreateImageInfo D@Addressee, 0, 0, GDIP_DRAWIMG_DEFAULT, IDC_TIMER1, AnimateFramePerSec, 3, D$RsrcIconNfo.IconDataPtr, D$RsrcIconNfo.Size, GdipImageNfo1 ; <------ Configuration function responsible to fill the GdipImageNfo strucutre
        call GdipCreateImageInfo D@Addressee, 0, 0, GDIP_DRAWIMG_FILL, IDC_TIMER2, AnimateFramePerSec, 3, D$RsrcIconNfo.IconDataPtr2, D$RsrcIconNfo.Size2, GdipImageNfo2


GdipCreateImageInfo
Code: [Select]

______________________________________________________________________________________

[GdipImageNfo1:
 GdipImageNfo1.hWndOwner: D$ 0
 GdipImageNfo1.CtrlWidth: D$ 0
 GdipImageNfo1.CtrlHeight: D$ 0
 GdipImageNfo1.pGdiImage: D$ 0
 GdipImageNfo1.DisplayType: D$ 0; GDIP_DRAWIMG_DEFAULT
 GdipImageNfo1.ImgXPos: D$ 0
 GdipImageNfo1.ImgYPos: D$ 0
 GdipImageNfo1.ImgWidth: D$ 0
 GdipImageNfo1.ImgHeight: D$ 0
 GdipImageNfo1.TotalFrames: D$ 0
 GdipImageNfo1.CurFramePos: D$ 0
 GdipImageNfo1.TimerId: D$ 0
 GdipImageNfo1.DelayTime: D$ 0]


[GdipImageNfo2:
 GdipImageNfo2.hWndOwner: D$ 0
 GdipImageNfo2.CtrlWidth: D$ 0
 GdipImageNfo2.CtrlHeight: D$ 0
 GdipImageNfo2.pGdiImage: D$ 0
 GdipImageNfo2.DisplayType: D$ 0; GDIP_DRAWIMG_DEFAULT
 GdipImageNfo2.ImgXPos: D$ 0
 GdipImageNfo2.ImgYPos: D$ 0
 GdipImageNfo2.ImgWidth: D$ 0
 GdipImageNfo2.ImgHeight: D$ 0
 GdipImageNfo2.TotalFrames: D$ 0
 GdipImageNfo2.CurFramePos: D$ 0
 GdipImageNfo2.TimerId: D$ 0
 GdipImageNfo2.DelayTime: D$ 0]

; Displacement Equates for GdipImageNfo structure

[GdipImageNfo.hWndOwnerDis 0
 GdipImageNfo.CtrlWidthDis 4
 GdipImageNfo.CtrlHeightDis 8
 GdipImageNfo.pGdiImageDis 12
 GdipImageNfo.DisplayTypeDis 16
 GdipImageNfo.ImgXPosDis 20
 GdipImageNfo.ImgYPosDis 24
 GdipImageNfo.ImgWidthDis 28
 GdipImageNfo.ImgHeightDis 32
 GdipImageNfo.TotalFramesDis 36
 GdipImageNfo.CurFramePosDis 40
 GdipImageNfo.TimerIdDis 44
 GdipImageNfo.DelayTimeDis 48]

[Size_of_GdipImageNfo 52]

Proc GdipCreateImageInfo:
    Arguments @Addressee, @XPos, @YPos, @FillBg, @IdEvent, @pFps, @KeyFrame, @pFile, @Filesize, @pGdipImageNfo
    Structure @RECT 16, @RECT.leftDis 0, @RECT.topDis 4, @RECT.rightDis 8, @RECT.bottomDis 12

    mov edi D@pGdipImageNfo
    call 'RosMem.FastZeroMem' edi, Size_of_GdipImageNfo ;  Clean this structure
    call 'RosMem.FastZeroMem' D@RECT, 16 ;  Clean this structure

    mov eax D@Addressee | mov D$edi+GdipImageNfo.hWndOwnerDis eax ; Fill hWndOwner member to we have some control of which window/control is using the image
    mov D$edi+GdipImageNfo.TotalFramesDis 1 ; Minimum amount of frames is 1 (meaning it is a single image, bitmap, icon, jpg etc. Multiple frames are found in animated gif or tiff
    mov eax edi | add eax GdipImageNfo.pGdiImageDis ; Pointer to Gdi+ Object to be created at this location.
    call GdipGetTotalFramesFromMem D@pFile, D@Filesize, eax ; get the total amount of frames in the image (1 for jpg, icom, etc, and more then 1 if the animated gif or animated tiff contains more then 1 frames) and also stored the pointer to gdiplus object at pGdiImage member of the structure GdipImageNfo
    If eax > 1
        mov D$edi+GdipImageNfo.TotalFramesDis eax ; Save the total amount of frames of the image
        mov eax D@IdEvent | mov D$edi+GdipImageNfo.TimerIdDis eax ; Save the Chosen Id for the timer interval in case we are dealing with animated gifs or animated tiffs
        call SetAnimationInterval D@Addressee, D@IdEvent, D@pFps, D@KeyFrame ;  returns the necessary amount of time to be used in WM_TIMER (Always in miliseconds).
        mov D$edi+GdipImageNfo.DelayTimeDis eax
    End_If

    ; get now the width and height of the control/window where the image muist be placed
    call 'User32.GetClientRect' D@Addressee, D@RECT
    mov eax D@RECT.rightDis | sub eax D@RECT.leftDis | mov D$edi+GdipImageNfo.CtrlWidthDis eax
    mov eax D@RECT.bottomDis | sub eax D@RECT.topDis | mov D$edi+GdipImageNfo.CtrlHeightDis eax
    mov eax D@XPos | mov D$edi+GdipImageNfo.ImgXPosDis eax
    mov eax D@YPos | mov D$edi+GdipImageNfo.ImgYPosDis eax

    ; get now the image dimensions
    mov eax edi | add eax GdipImageNfo.ImgWidthDis
    call 'gdiplus.GdipGetImageWidth' D$edi+GdipImageNfo.pGdiImageDis, eax
    mov eax edi | add eax GdipImageNfo.ImgHeightDis
    call 'gdiplus.GdipGetImageHeight' D$edi+GdipImageNfo.pGdiImageDis, eax

    mov eax D@FillBg
    mov D$edi+GdipImageNfo.DisplayTypeDis eax ; <--- Save  the type of Flag used to display our image

EndP

________________________________________________________________________________________________________________________________________________

; Get the total amount of frames inside the image. Minimum is always 1, which means, of course, we are not dealing with an animation (such as icons, jpgs, pngs, bmps, etc).

Proc GdipGetTotalFramesFromMem:
    Arguments @pFile, @Filesize, @pGdiImage
    Local @hMem, @pImage, @FrameCount
    Uses ecx, edx

    call 'shlwapi.SHCreateMemStream' D@pFile, D@Filesize
    mov D@hMem eax
    call 'gdiplus.GdipCreateBitmapFromStream' D@hMem, D@pGdiImage;eax
    call 'fastcrt.IStream_Release' D@hMem

    mov eax D@pGdiImage | mov ecx D$eax
    lea eax D@FrameCount
    call 'gdiplus.GdipImageGetFrameCount' ecx, FRAME_DIMENSION_TIME, eax;D@FrameCount;eax
    mov eax D@FrameCount

EndP

________________________________________________________________________________________________________________________________________________

;;
    We are creating here the total amount of Time necessary to animate a Animated giff or tiff image. Instead allocating more memory or using extra gdiplus apis to get the delay time of the image, is better (and faster) do it directly on user command.
    On this way we can simply get the total amount of used frames and create an animation by scratch. We can set the Timer ID and also input the fps (Frame per second) we want our image to be animated and also we can set the wanted keyframe to make the animation be smoother, faster or slower.
The keyframe is only a repetition of images given a certain amount of time. It is used in video edition as well, so, on the same way as in videos, we can set this value to 3 or 4 to make the animation be ok without worring in allocating extra memory or using extra gdiplus apís.

    We have 29.970 per 1000 seconds =
    2.9970 frames per 100 miliseconds
    since we have 3 repeated frames it means we have
    100/2.9970 = 33.3667003....frames on eac interval of 33 miliseconds, therefore:
    3*33.3667003 = 100.100 miliseconds per each keyframe
    (1000/29.970)*3
;;


Proc SetAnimationInterval:
    Arguments @Addressee, @IdEvent, @pFps, @KeyFrame
    Local @Seconds
    Uses ecx, edx

    finit

    mov D@Seconds 1000
    mov eax D@pFps
    fild D@Seconds | fdiv F$eax
    mov eax D@KeyFrame | On eax = 0, mov eax 1
    mov D@Seconds eax | fimul F@Seconds
    lea eax D@Seconds
    fistp D$eax
    mov eax D$eax
    On eax < &USER_TIMER_MINIMUM, mov eax &USER_TIMER_MINIMUM
    mov D@Seconds eax
    call 'user32.SetTimer' D@Addressee, D@IdEvent, eax, 0
    mov eax D@Seconds

EndP

__________________________________________________________________________________________

At WM_SIZE

Code: [Select]
        ; Simply fill the Width and height on the GdipImageNfo structures.
        LOWORD D@lParam | mov D@NewWidth eax | mov D$GdipImageNfo1.CtrlWidth eax | mov D$GdipImageNfo2.CtrlWidth eax
        HIWORD D@lParam | mov D@NewHeight eax | mov D$GdipImageNfo1.CtrlHeight eax | mov D$GdipImageNfo2.CtrlHeight eax


At WM_TIMER
Code: [Select]
    ...Else_If D@Message = &WM_TIMER
         ; Simply increment the Total amount of Frames on GdipImageNfo structure for each image
        call 'USER32.InvalidateRect' D@Addressee, 0, 0
        If D$GdipImageNfo1.TotalFrames > 1
            inc D$GdipImageNfo1.CurFramePos
        End_If
        If D$GdipImageNfo2.TotalFrames > 1
            inc D$GdipImageNfo2.CurFramePos
        End_If

At WM_PAINT

Code: [Select]
    ...Else_If D@Message = &WM_PAINT

        call On_WmPaintIconRsrc D@Addressee, D$RsrcIconNfo.IconDataPtr, D$RsrcIconNfo.Size

(.......)
______________________________________

Proc On_WmPaintIconRsrc:
    Arguments @Adressee, @pFile, @Filesize
    Local @hDC
    Structure @PAINTSTRUCT 64, @PAINTSTRUCT.hdcDis 0
    Uses ecx, edx, edi

    call 'User32.BeginPaint' D@Adressee, D@PAINTSTRUCT
    mov D@hDC eax

    call GdipImageDraw D@Adressee, D@pFile, D@Filesize, D@hDC, GDIP_DRAWIMG_DEFAULT ; The main image painting functions relies here

    call 'USER32.EndPaint' D@Adressee, D@PAINTSTRUCT

EndP

________________________________________________________________________________________________________________________________________________

Proc GdipImageDraw:
    Arguments @Adressee, @pFile, @Filesize, @hDC, @FullBg
    Local @ctx, @hMemDC, @hbr, @Width, @Height, @XPos, @YPos
    Structure @RECT 16, @RECT.leftDis 0, @RECT.topDis 4, @RECT.rightDis 8, @RECT.bottomDis 12
    Uses ecx, edx, edi

    call 'GDI32.SaveDC' D@hDC | mov D@ctx eax

    lea eax D@Width
    lea ecx D@Height
    call CreateWorkingDCEx D@Adressee, eax, ecx
    mov D@hMemDC eax

    mov D@XPos 0
    mov D@YPos 0

    call ImgPaintP D@hMemDC, GdipImageNfo2
    call ImgPaintP D@hMemDC, GdipImageNfo1

    call 'GDI32.BitBlt' D@hDC, 0, 0, D@Width, D@Height, D@hMemDC, 0, 0, &SRCCOPY

    call 'GDI32.DeleteDC' D@hMemDC
    call 'GDI32.RestoreDC' D@hDC, D@ctx

EndP
________________________________________________________________________________________________________________________________________________

Proc CreateWorkingDCEx:
    Arguments @hWnd, @pWidth, @pHeight
    Local @hDC, @hBitmap, @phObject, @Width, @Height, @hMemDC
    Structure @RECT 16, @RECT.leftDis 0, @RECT.topDis 4, @RECT.rightDis 8, @RECT.bottomDis 12
    Uses ecx, edx, edi

    mov D@RECT.leftDis 0
    mov D@RECT.topDis 0
    mov D@RECT.rightDis 0
    mov D@RECT.bottomDis 0
    call 'User32.GetClientRect' D@hWnd, D@RECT
    mov eax D@RECT.rightDis | sub eax D@RECT.leftDis | mov D@Width eax
    mov eax D@RECT.bottomDis | sub eax D@RECT.topDis | mov D@Height eax

    call 'user32.GetDC' D@hWnd
    mov D@hDC eax
    call 'gdi32.CreateCompatibleDC' eax
    mov D@hMemDC eax

    call 'gdi32.CreateCompatibleBitmap' D@hDC, D@Width, D@Height
    mov D@hBitmap eax
    call 'gdi32.SelectObject' D@hMemDC, eax
    mov D@phObject eax
    call 'GDI32.DeleteDC' D@hDC
    call 'gdi32.DeleteObject' D@phObject
    call 'GDI32.DeleteObject' D@hBitmap

    call 'user32.GetSysColorBrush' &COLOR_3DFACE | call 'user32.FillRect' D@hMemDC, D@RECT, eax ; Fill the background color with the system color rather then a new brush to we allow transparency of the icons, png without having to add extra brushes etc.

    mov eax D@Width | mov ecx D@pWidth | mov D$ecx eax
    mov eax D@Height | mov ecx D@pHeight | mov D$ecx eax
    mov eax D@hMemDC

EndP

________________________________________________________________________________________________________________________________________________


[FRAME_DIMENSION_TIME: D$ 06AEDBD6D, W$ 03FB5, 0418A, B$ 083, 0A6, 07F, 045, 022, 09D, 0C8, 072]

Proc ImgPaintP:
    Arguments @hSrcDC, @pGdiImgNfo
    Local @pGraphics, @CurXPos, @CurYPos, @ImgWidth, @ImgHeight
    Uses ecx, edx, edi

    lea eax D@pGraphics
    call 'gdiplus.GdipCreateFromHDC' D@hSrcDC, eax

    mov edi D@pGdiImgNfo

    mov eax D$edi+GdipImageNfo.TotalFramesDis
    .If eax > 1
        If D$edi+GdipImageNfo.CurFramePosDis > eax
            mov D$edi+GdipImageNfo.CurFramePosDis 0
        End_If
        call 'gdiplus.GdipImageSelectActiveFrame' D$edi+GdipImageNfo.pGdiImageDis, FRAME_DIMENSION_TIME, D$edi+GdipImageNfo.CurFramePosDis
    .End_If

    mov eax D$edi+GdipImageNfo.ImgXPosDis | mov D@CurXPos eax
    mov eax D$edi+GdipImageNfo.ImgYPosDis | mov D@CurYPos eax
    mov eax D$edi+GdipImageNfo.DisplayTypeDis
    If eax = GDIP_DRAWIMG_DEFAULT
        mov eax D$edi+GdipImageNfo.ImgWidthDis | mov D@ImgWidth eax
        mov eax D$edi+GdipImageNfo.ImgHeightDis | mov D@ImgHeight eax
    Else_If eax = GDIP_DRAWIMG_FILL
        mov D@CurXPos 0
        mov D@CurYPos 0
        mov eax D$edi+GdipImageNfo.CtrlWidthDis | mov D@ImgWidth eax
        mov eax D$edi+GdipImageNfo.CtrlHeightDis | mov D@ImgHeight eax
    Else
        mov eax D$edi+GdipImageNfo.CtrlWidthDis | mov D@ImgWidth eax
        mov eax D$edi+GdipImageNfo.CtrlHeightDis | mov D@ImgHeight eax
    End_If

    call 'gdiplus.GdipDrawImageRectI' D@pGraphics, D$edi+GdipImageNfo.pGdiImageDis, D@CurXPos, D@CurYPos, D@ImgWidth, D@ImgHeight
    call 'gdiplus.GdipDeleteGraphics' D@pGraphics

EndP



Thanks for the inspiraton and tips, JJ and Marinus :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:


Testing examples

Transparent Icon + Animated background gif


Transparent Icon + Transparenrt icon as a filled background


Opaque Png + Animated background gif


Animated Gif + Animated background gif
« Last Edit: November 09, 2020, 08:25:59 AM by guga »
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

HSE

  • Member
  • *****
  • Posts: 1743
  • <AMD>< 7-32>
Re: Gdi+ Gif Animation Test
« Reply #1 on: November 09, 2020, 08:18:53 AM »
Fantastic  :thumbsup:
Just yesterday I was reading posts about this subject.

I found a "temporal" solution including the icon (the gear) in a button  :biggrin: :biggrin:

I will study your code!!


guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #2 on: November 09, 2020, 09:24:14 AM »
Fantastic  :thumbsup:
Just yesterday I was reading posts about this subject.

I found a "temporal" solution including the icon (the gear) in a button  :biggrin: :biggrin:

I will study your code!!

Tks, a lot HSE !

Great idea using it as a Button icon :thumbsup: :thumbsup: :thumbsup: :thumbsup:


Did you tested the example i posted ? Is it working ok or is leaking etc ?


Btw...If you don´t have RosAsm, i´m attaching it here to you see the full sources of this test. (The function ImgPaintP is the main responsible for painting  the whole image. It was inspired in the one JJ build but it was too complex for me, so i tried to simplify it the best i could - I´ll change the name of this function later, btw  :azn: :azn:)

If it is ok without leaking, i can then add it to RosAsm itself on the routines i´m fixing for the resources editor and may upload a new version as soon i finish fixing all of those small things. :smiley: :smiley: :smiley:

Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

HSE

  • Member
  • *****
  • Posts: 1743
  • <AMD>< 7-32>
Re: Gdi+ Gif Animation Test
« Reply #3 on: November 09, 2020, 10:10:32 AM »
Your example work well, perhaps a little fast the animation.

I have RosAsm!

I read you are using GdipImageDraw, that makes me to remember that there is some Draw functions in GDI and ... there is DrawIcon!

Just replacing the button with a small window:

jj2007

  • Member
  • *****
  • Posts: 11551
  • Assembler is fun ;-)
    • MasmBasic
Re: Gdi+ Gif Animation Test
« Reply #4 on: November 09, 2020, 10:19:16 AM »
Can someone please test to see if there is a gdi leaking happenning ?

No leaks - compliments :thumbsup:

Siekmanski

  • Member
  • *****
  • Posts: 2365
Re: Gdi+ Gif Animation Test
« Reply #5 on: November 09, 2020, 11:15:17 AM »
Looks good.  :thumbsup:
Creative coders use backward thinking techniques as a strategy.

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #6 on: November 09, 2020, 11:54:48 AM »
Your example work well, perhaps a little fast the animation.

I have RosAsm!

I read you are using GdipImageDraw, that makes me to remember that there is some Draw functions in GDI and ... there is DrawIcon!

Just replacing the button with a small window:

Hi HSE, yes i tested that with DrawIcon too, but it was not working for transparent icons on the tests i was doing and neither for png and other kind of images, that's why i choose to use GdipImageDraw to make it a general usage drawing image routine. (That can also be used to draw webp files, btw).

Glad to see you are using RosAsm :thumbsup: :thumbsup: :thumbsup: I plan to make new updates soon. Recently i suceeded to implement SSE3 and SSE4 in the assembler, disassembler and debugger routines and started cleaning the whole code. I suceded to fix some old old issues in memory management and got the way to make the encoder and decoder be used as a standalone libraries (dlls). Now i´m currently working on the resources editor to fix whatever i can, and eventually build a new one based on the WizardsForm :azn: :azn: :smiley: :smiley:

The main problem was that hundreds of variables in RosAsm were being reused several times by different functions for different purposes and identifying which one is which is a true hell :greensml: :greensml: :greensml:

The good news is i created a couple of libraries to start making it work as standalone: FastCRT.dll, RosMem.dll, IconEdit.dll and i´m allowing to use libwep.dll (from google) to be used in the resources images so we could also import and export webp files inside the resource section  :smiley:

About the speed on this tests. It maybe fast because some gifs are encoded in different ways. Some of them have more frames per scenes then others.

Try reducing the fps to 29.970 or 25 and changing the keyframe to 4 instead of 3. It may result on a delay time of something around 100 ms (that will be passed to WM_TIMER message) that is used in many gifs as well. Like this:

[AnimateFramePerSec: F$ 29.970] ; or 25

and change the keyFrame value used in GdipCreateImageInfo as below (marked in red)

        call GdipCreateImageInfo D@Addressee, 0, 0, GDIP_DRAWIMG_DEFAULT, IDC_TIMER1, AnimateFramePerSec, 4, D$RsrcIconNfo.IconDataPtr, D$RsrcIconNfo.Size, GdipImageNfo1
        call GdipCreateImageInfo D@Addressee, 0, 0, GDIP_DRAWIMG_FILL, IDC_TIMER2, AnimateFramePerSec, 4, D$RsrcIconNfo.IconDataPtr2, D$RsrcIconNfo.Size2, GdipImageNfo2
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #7 on: November 09, 2020, 12:08:31 PM »
Can someone please test to see if there is a gdi leaking happenning ?

No leaks - compliments :thumbsup:

Looks good.  :thumbsup:

Tks a lot, guys. I couldn´t do it without you both  :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:

Glad to know there´s no leak. Now i can move on and implement it in RosAsm in order to try finish fixing the resources editors using this new functions to display the images to be used in the resource section of a file   :smiley: :smiley: :smiley:
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Vortex

  • Member
  • *****
  • Posts: 2583
Re: Gdi+ Gif Animation Test
« Reply #8 on: November 09, 2020, 05:42:04 PM »
Hi guga,

Nice job :thumbsup:

Does your application depends on vcruntime140.dll?  I had to find and add this DLL.

HSE

  • Member
  • *****
  • Posts: 1743
  • <AMD>< 7-32>
Re: Gdi+ Gif Animation Test
« Reply #9 on: November 09, 2020, 11:18:14 PM »
Hi Guga!

Glad to see you are using RosAsm :thumbsup: :thumbsup: :thumbsup:
I have RosAsm, Fasm, Yasm, but I only use ML, UAsm and AsmC. Most projects rely on SmplMath, and some of my own critical macros only work with AsmC.

[AnimateFramePerSec: F$ 29.970] ; or 25
:biggrin: That was 60 in your file.
Look nice with 25 and 4  :thumbsup:

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #10 on: November 10, 2020, 01:19:45 AM »
Hi guga,

Nice job :thumbsup:

Does your application depends on vcruntime140.dll?  I had to find and add this DLL.

Tks Vortex

No,  It´s was not suppose to use vcruntime140.dll. If it is asking for it, i can only think that maybe libwebp.dll needs it.  :dazzled: :dazzled: :dazzled:

Tks for reporting, i´ll change FastCRT.dll in order to use libwebp (That calls to this other dll) dinamically with LoadLibrary rather then a direct dll call as it is already

Here´s vcruntime140.dll to you test :smiley: :smiley:

Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #11 on: November 10, 2020, 01:54:28 AM »
Btw...Talking about libwebp. How to force VisualStudio to compile a gnu c project ?

Libwebp was meant to be compiled with GNU C make. So, maybe teh better would be compile it with VisualStudio, but i dont know how o do it. Can someone pls try to convert it using VisualStudio as a compiler ?

I cannot upload the files here, because they are big

The link containing the source code is:

https://developers.google.com/speed/webp/docs/compiling

Btw...The last version 1.1.0 seems to have both x86 and x64, so, if someone could allow it to compile wieh x86 rather then x64 it would be better for people with older machines also uses it without problem.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #12 on: November 20, 2020, 08:11:27 PM »
New test

This time added a small Text on it and also the color of the background is painted with a modern color.

Probably it sill not leaking, but if someone could test for leaking it would be great :)

Note: The additional dlls are attached on the 1st post

Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Vortex

  • Member
  • *****
  • Posts: 2583
Re: Gdi+ Gif Animation Test
« Reply #13 on: November 20, 2020, 08:23:47 PM »
Hi guga,

Your application depends on two extra DLLs :

Code: [Select]
\PellesC\Bin\podump.exe /IMPORTS AnimGifTest5.exe | findstr ".dll"
.
.
        FASTCRT.dll
        ROSMEM.dll
.
.

Could you attach those DLLs? Thanks.

guga

  • Member
  • *****
  • Posts: 1357
  • Assembly is a state of art.
    • RosAsm
Re: Gdi+ Gif Animation Test
« Reply #14 on: November 20, 2020, 08:50:26 PM »
Hi Vortex

They were attached on the 1st post. I´m attaching it again  :smiley: :smiley:

Added also libwebp.dll and vcruntime140.dll (these two ones are needed for the webp files used in FastCRT.dll)


The FastCRT.dll i made uses google chrome libwebp (that uses the vcrxxx library). Later i´ll try to see if i can avoid loading libwebp.dll with a check for loadlibrary (Or eventually, create a full routine able to encode and decode webp files as well)

The main routine for painting a new color for the background is at CreateWorkingDCEx  and the one responsible to create the text i labeled as GdiTextPaint

I´m currently cleaning the code in order to try making it work with one single function at once.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com