flat assembler
Message board for the users of flat assembler.

Index > Windows > How to rotate image items?

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
Hi
I need to rotate and change angle of some images.
Tried to use SetWorldTransform with no success. Please help
Post 15 Dec 2020, 20:15
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 510
Ali.Z
show your code, example from msdn:
https://docs.microsoft.com/en-us/windows/win32/gdi/using-coordinate-spaces-and-transformations

p.s. you can do it manually by add/subtracting each x,y coordinates of every vertex.

_________________
Asm For Wise Humans
Post 16 Dec 2020, 03:09
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
That is a problem, I don't want to draw picture manually, I need to load turned image from file.
Actually I know how to do that: Open file in memory, decompress it to BMP, rotate, compress back to ICO or something with transparate, then load as resource for child window. But I'm looking for some less painful way to do that Smile
Post 16 Dec 2020, 05:55
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 510
Ali.Z
i found cpp code that does that:
https://www.codeguru.com/cpp/g-m/bitmap/specialeffects/article.php/c1743/Rotate-a-bitmap-image.htm

its not perfect, but at least it tells you the steps required or the order of doing ..

~

also searching old help files i found PlgBlt with a description saying it can be used for rotation, but personally i never seen this function.

_________________
Asm For Wise Humans
Post 16 Dec 2020, 07:26
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
Thanks, I'll take a look on it
Post 16 Dec 2020, 17:02
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
Looks like there is nothing special. In that scenario I prefer to use own skill by FPU to rotate already preloaded image as I said.
Post 18 Dec 2020, 16:49
View user's profile Send private message Visit poster's website Reply with quote
donn



Joined: 05 Mar 2010
Posts: 227
donn
With just GDI, DrawImage is probably the easies way

DrawImage

https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-rotating-reflecting-and-skewing-images-use

SetWorldTransform should work though https://docs.microsoft.com/en-us/windows/win32/gdi/rotation and then Direct2D (D3D, etc..) on top of that.
Post 18 Dec 2020, 21:25
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 510
Ali.Z
DrawImage is GDI+

_________________
Asm For Wise Humans
Post 18 Dec 2020, 22:47
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
Seems like masm32 accept GDI+ methods (GdipDrawImage). How to call it via Fasm?
Post 19 Dec 2020, 14:50
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 510
Ali.Z
Code:
; under your resource section
library gdiplus,'GDIPLUS.DLL'
import gdiplus,\
         GdipDrawImage,'GdipDrawImage'    


then just use invoke or call in your code.

_________________
Asm For Wise Humans
Post 19 Dec 2020, 20:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.