Author Topic: Affine transformation  (Read 597 times)

guga

  • Member
  • *****
  • Posts: 1362
  • Assembly is a state of art.
    • RosAsm
Affine transformation
« on: November 10, 2020, 06:20:09 PM »
Hi Guys

Someone already tried to do some Affine transformations with GDIPlus directly from the pixel data of a image ?


I´m reading some examples here

https://www.codeproject.com/Tips/516761/Affine-Transformations-in-Computer-Graphics
https://github.com/LidaPetr/affine-transformation/blob/master/aurora.cpp
https://engineerslaboratory.wordpress.com/2016/08/27/affine-transformation-in-image-processing-explained-with-c/
https://en.wikipedia.org/wiki/Affine_transformation

Maybe could be a good idea to give a try. I wonder if using gdi plus to retrieve the pixel data and manipulating it directly to perform those tranformations could be faster the using the gdi+ apis itself. ?
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

TouEnMasm

  • Member
  • *****
  • Posts: 1529
    • EditMasm
Re: Affine transformation
« Reply #1 on: November 10, 2020, 08:16:57 PM »

Try to complie the first,little problem "#include <graphics.h>" no more exist.
Seem to be an old sample ,some says it's directx and some says it's opengl ????
Fa is a musical note to play with CL

TimoVJL

  • Member
  • ****
  • Posts: 656
May the source be with you

TouEnMasm

  • Member
  • *****
  • Posts: 1529
    • EditMasm
Re: Affine transformation
« Reply #3 on: November 11, 2020, 01:32:06 AM »

Thanks for links
https://github.com/nirin/WinBGI     ;works (without errors !!!) with win10 VS2019 C++

Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1529
    • EditMasm
Re: Affine transformation
« Reply #4 on: November 11, 2020, 03:11:27 AM »
First sample compiled ,works 64 in dos or Windows mode.Stop with spacebar.
Library too big for the forum.
can surely be done more easily with opengl. http://masm32.com/board/index.php?topic=8885.msg97287#msg97287

second sample
Quote
Microsoft Windows [version 10.0.19042.572]
(c) 2020 Microsoft Corporation. Tous droits réservés.

H:\ecrase>math
Affine Transformation is being created
Affine Transformation is being created
Affine Transformation is being created
Initial values:
1 0
Transformation:
3 -3
Inverse Transformation:
1 -2.22045e-16
Combined Transformation:
1 0

H:\ecrase>
Fa is a musical note to play with CL

TimoVJL

  • Member
  • ****
  • Posts: 656
Re: Affine transformation
« Reply #5 on: November 11, 2020, 03:34:29 AM »
With these dll's it worked in Windows 7
May the source be with you

guga

  • Member
  • *****
  • Posts: 1362
  • Assembly is a state of art.
    • RosAsm
Re: Affine transformation
« Reply #6 on: November 11, 2020, 05:22:11 AM »
First sample compiled ,works 64 in dos or Windows mode.Stop with spacebar.
Library too big for the forum.
can surely be done more easily with opengl. http://masm32.com/board/index.php?topic=8885.msg97287#msg97287

second sample
Quote
Microsoft Windows [version 10.0.19042.572]
(c) 2020 Microsoft Corporation. Tous droits réservés.

H:\ecrase>math
Affine Transformation is being created
Affine Transformation is being created
Affine Transformation is being created
Initial values:
1 0
Transformation:
3 -3
Inverse Transformation:
1 -2.22045e-16
Combined Transformation:
1 0

H:\ecrase>

 :dazzled: :dazzled: :dazzled: :dazzled:

How did you managed to compiled ? Can it be one in VisualStudio and for x86 ?

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

caballero

  • Member
  • *****
  • Posts: 1555
  • Matrix - Noah
    • abre ojos ensamblador
Re: Affine transformation
« Reply #7 on: November 11, 2020, 08:36:15 AM »
Well, this is an example on GDI, rotating and scaling, if you are interested in source code:
http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=6#Rotozoomer

Using matrices to achieve such transformations is easy, I could make an example when have time

Here an example using a bitmap, it can accept any bmp file (drag and drop)
http://masm32.com/board/index.php?topic=7145.msg88350#msg88350
The logic of the error is hidden among the most unexpected lines of the program

TouEnMasm

  • Member
  • *****
  • Posts: 1529
    • EditMasm
Re: Affine transformation
« Reply #8 on: November 11, 2020, 07:22:13 PM »
Quote
How did you managed to compiled ? Can it be one in VisualStudio and for x86 ?
On windows 10 with c++ of visual studio 2019,64 bits
* First step download the c++ project for the winbgi library (upper post,master....)
   del the soluce,open the project,compile with visual studio,He is very easy to compile in 32 or 64(no one error).
   When it is done,dowload the source code i have posted,made it compilable,it is compiled with command line,not visual studio.
* Now you have just to delet the code (except  include and lib),replace the code by the second sample,It much work at the first time.

You can made a batch with that
Code: [Select]
EditMasmIni
Pour les variables d'environnements:
-* l'ancienne variable,si elle existe,est remplacé entièrement
-* chaque chemin s'ajoute,le ; est ajouté
Par défaut,le mot suivant EditMasmIni (en début de ligne) est considéré comme une variable
d'environnement,à moins qu'il ne fasse partie de la liste de mots réservés


EditMasmIni RESERVELISTE
;rien pour l'instant , éventuel futur


EditMasmIni Platform
X64

EditMasmIni PATH
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64

EditMasmIni LIB
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64

EditMasmIni INCLUDE
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include

EditMasmIni PROCESSEUR
X64

EditMasmIni CL
/c /FA /Gm- /GS- /Ox /MD

EditMasmIni LINK
/NOLOGO

EditMasmIni FindeEditMasmIni

Fa is a musical note to play with CL

guga

  • Member
  • *****
  • Posts: 1362
  • Assembly is a state of art.
    • RosAsm
Re: Affine transformation
« Reply #9 on: November 12, 2020, 06:29:12 AM »
Well, this is an example on GDI, rotating and scaling, if you are interested in source code:
http://abreojosensamblador.epizy.com/?Tarea=5&SubTarea=6#Rotozoomer

Using matrices to achieve such transformations is easy, I could make an example when have time

Here an example using a bitmap, it can accept any bmp file (drag and drop)
http://masm32.com/board/index.php?topic=7145.msg88350#msg88350

Tks, Caballero

Please, when you have some time, try making some examples of transformations using matrices (whose pixel where retrieved from bitmap etc )
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

caballero

  • Member
  • *****
  • Posts: 1555
  • Matrix - Noah
    • abre ojos ensamblador
Re: Affine transformation
« Reply #10 on: November 16, 2020, 09:21:41 AM »
The same using matrices
The logic of the error is hidden among the most unexpected lines of the program

guga

  • Member
  • *****
  • Posts: 1362
  • Assembly is a state of art.
    • RosAsm
Re: Affine transformation
« Reply #11 on: November 20, 2020, 08:06:25 PM »
 :dazzled: :dazzled: :dazzled: :dazzled:

Tks a lot, caballero :thumbsup: :thumbsup: :thumbsup:

Great Work :thumbsup:
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