Jump to content
Download Section Back Up, Navigate the Right Hand Menu to find files, ignore the 0s

FPLaunch MOD: Pause and Loading screens...


samwyze

Recommended Posts

I'm looking for some good free command line image rotator??????

I need it to rotate screen shots.

I've made the code that reads the description of running table from xml, adds one hot key for print screen, on press of that key saves print screen image in hyperpin\media\blabla\table desc.

I just need to rotate it (since hp needs 180 degrees rotated images).

Found some image converter plus but it is commercial.

Found some linux tools also, but ...

So any body knows free windows program that will do this?

Link to comment
Share on other sites

I'm looking for some good free command line image rotator??????

I need it to rotate screen shots.

I've made the code that reads the description of running table from xml, adds one hot key for print screen, on press of that key saves print screen image in hyperpin\media\blabla\table desc.

I just need to rotate it (since hp needs 180 degrees rotated images).

Found some image converter plus but it is commercial.

Found some linux tools also, but ...

So any body knows free windows program that will do this?

I always use Windows for this to bulk rotate files.

Win 7 and XP both have that function built in.

for Win 7 : Select multiple files, open file menu, click rotate left twice.

Easy peasy.

XP I have to look up, but I know it's capable of doing the same.

Link to comment
Share on other sites

I always use Windows for this to bulk rotate files.

Win 7 and XP both have that function built in.

for Win 7 : Select multiple files, open file menu, click rotate left twice.

Easy peasy.

XP I have to look up, but I know it's capable of doing the same.

He needs it to be a command line tool, so he can execute it from the FPLaunch script, though.

Link to comment
Share on other sites

as for ahk_l i don't think it's a good idea to jump into it, thousands of bugs could appear

I've been using it for the current wip, then been adding necessary changes to convert back to ahk_standard, as long as you stick with ansi, the only differences as far as the end user is concerned are added features, most of the bugs in ahk_l were ironed out long ago, hence why ahk_l is the main developement branch now.

yes :: was wrapped in #ifwinactive but still it makes ahk stop, something similar is reported for modules - if you put :: to early in the module code script just stops on that row

Ahh, so another ahk bug regards #IfWin hotkeys, why does that not surprise me! It's possible to remap keys using the Hotkey command for slamit with something like:

Hotkey, $%StartKey%, sendS
Hotkey, $%StartKey% Up, sendSUp
;...
sendS:
send {Blind} {s DownTemp}
Return
;...
sendSUp:
send {Blind} {s Up}
Return

Edited by samwyze
Link to comment
Share on other sites

I'm looking for some good free command line image rotator??????

I need it to rotate screen shots.

I've made the code that reads the description of running table from xml, adds one hot key for print screen, on press of that key saves print screen image in hyperpin\media\blabla\table desc.

I just need to rotate it (since hp needs 180 degrees rotated images).

Found some image converter plus but it is commercial.

Found some linux tools also, but ...

So any body knows free windows program that will do this?

gdi+ with ahk will do this, just need to include gdip.ahk and read some of tics examples

also, the CaptureScreen function from wip4 is using gdip to convert image format and could be modified to rotate 180 before saving...give me some time and I'll look at it :)

Link to comment
Share on other sites

@Blur

If you add these functions to wip4:

;#####################################################################################
Gdip_CreateBitmapFromClipboard()
{
if !DllCall("OpenClipboard", "uint", 0)
	return -1
if !DllCall("IsClipboardFormatAvailable", "uint", 8)
	return -2
if !hBitmap := DllCall("GetClipboardData", "uint", 2)
	return -3
if !pBitmap := Gdip_CreateBitmapFromHBITMAP(hBitmap)
	return -4
if !DllCall("CloseClipboard")
	return -5
DeleteObject(hBitmap)
return pBitmap
}
Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette=0)
{
DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "uint", hBitmap, "uint", Palette, "uint*", pBitmap)
return pBitmap
}
Gdip_GetImageDimensions(pBitmap, ByRef Width, ByRef Height)
{
DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
}
; RotateNoneFlipNone   = 0
; Rotate90FlipNone     = 1
; Rotate180FlipNone    = 2
; Rotate270FlipNone    = 3
; RotateNoneFlipX      = 4
; Rotate90FlipX        = 5
; Rotate180FlipX       = 6
; Rotate270FlipX       = 7
; RotateNoneFlipY      = Rotate180FlipX
; Rotate90FlipY        = Rotate270FlipX
; Rotate180FlipY       = RotateNoneFlipX
; Rotate270FlipY       = Rotate90FlipX
; RotateNoneFlipXY     = Rotate180FlipNone
; Rotate90FlipXY       = Rotate270FlipNone
; Rotate180FlipXY      = RotateNoneFlipNone
; Rotate270FlipXY      = Rotate90FlipNone 

Gdip_ImageRotateFlip(pBitmap, RotateFlipType=1)
{
return DllCall("gdiplus\GdipImageRotateFlip", "uint", pBitmap, "int", RotateFlipType)
}
Gdip_SaveBitmapToFile(pBitmap, sOutput, Quality=75)
{
SplitPath, sOutput,,, Extension
if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
	return -1
Extension := "." Extension

DllCall("gdiplus\GdipGetImageEncodersSize", "uint*", nCount, "uint*", nSize)
VarSetCapacity(ci, nSize)
DllCall("gdiplus\GdipGetImageEncoders", "uint", nCount, "uint", nSize, "uint", &ci)
if !(nCount && nSize)
	return -2

Loop, %nCount%
{
	Location := NumGet(ci, 76*(A_Index-1)+44)
	if !A_IsUnicode
	{
		nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
		VarSetCapacity(sString, nSize)
		DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "str", sString, "int", nSize, "uint", 0, "uint", 0)
		if !InStr(sString, "*" Extension)
			continue
	}
	else
	{
		nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
		sString := ""
		Loop, %nSize%
			sString .= Chr(NumGet(Location+0, 2*(A_Index-1), "char"))
		if !InStr(sString, "*" Extension)
			continue
	}
	pCodec := &ci+76*(A_Index-1)
	break
}
if !pCodec
	return -3

if (Quality != 75)
{
	Quality := (Quality < 0) ? 0 : (Quality > 100) ? 100 : Quality
	if Extension in .JPG,.JPEG,.JPE,.JFIF
	{
		DllCall("gdiplus\GdipGetEncoderParameterListSize", "uint", pBitmap, "uint", pCodec, "uint*", nSize)
		VarSetCapacity(EncoderParameters, nSize, 0)
		DllCall("gdiplus\GdipGetEncoderParameterList", "uint", pBitmap, "uint", pCodec, "uint", nSize, "uint", &EncoderParameters)
		Loop, % NumGet(EncoderParameters)      ;%
		{
			if (NumGet(EncoderParameters, (28*(A_Index-1))+20) = 1) && (NumGet(EncoderParameters, (28*(A_Index-1))+24) = 6)
			{
			   p := (28*(A_Index-1))+&EncoderParameters
			   NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20)))
			   break
			}
		}      
  }
}

if !A_IsUnicode
{
	nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", 0, "int", 0)
	VarSetCapacity(wOutput, nSize*2)
	DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", &wOutput, "int", nSize)
	VarSetCapacity(wOutput, -1)
	if !VarSetCapacity(wOutput)
		return -4
	E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &wOutput, "uint", pCodec, "uint", p ? p : 0)
}
else
	E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &sOutput, "uint", pCodec, "uint", p ? p : 0)
return E ? -5 : 0
}
Gdip_DisposeImage(pBitmap)
{
  return DllCall("gdiplus\GdipDisposeImage", "uint", pBitmap)
}
Gdip_Startup()
{
if !DllCall("GetModuleHandle", "str", "gdiplus")
	DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", "uint*", pToken, "uint", &si, "uint", 0)
return pToken
}
Gdip_Shutdown(pToken)
{
DllCall("gdiplus\GdiplusShutdown", "uint", pToken)
if hModule := DllCall("GetModuleHandle", "str", "gdiplus")
	DllCall("FreeLibrary", "uint", hModule)
return 0
}
;#####################################################################################

then you should be able to take a screenshot using CaptureScreen, rotate it 180, then save to a file like this:

pToken := Gdip_Startup()
CaptureScreen(3,,0) ;capture current monitor to clipboard
pBitmap := Gdip_CreateBitmapFromClipboard()
pBitmap := Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0
Gdip_SaveBitmapToFile(pBitmap, A_ScriptDir "\WhereEver\"  tableTitle ".png")
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)

(with a relevant variable for tableTitle of course) without the need for gdip.ahk

theres some notes in the functions, I haven't tested but it's a start :)

If you didn't want to do it with script, I second IrfanView - there are plenty of examples at ahk forums using it via ahk and command line

Edited by samwyze
Link to comment
Share on other sites

I cannot find the link to download HyperSettings program

I see the screen shots it looks great.

It's not finished yet :P It's a work in progress :) I'll post the settings file today if you'd like - but it doesn't relate to the current FPLaunch in this thread, it's for the upcoming release - however, you could use it to configure HyperPin settings

Link to comment
Share on other sites

hm, hm, hm, looks like I have duplicate functions

i have capturescreen utility from sean, and gdip.ahk is included with #include

tried to comment whole capturescreen block - but then there is no capturescreen function in gdip

ok, uncommented everything from capturescreen block except capturescreen and now there is no duplilcate functions, but...

my gdip.ahk doesn't have imagerotate function, only rotate world.

what gdip.ahk wrapper do you use? mine is 1.43 by tic.

by the way - i have the code to get description with strx function from skan and parts of your code from some other thread so no need for you to investigate it, tnx for gdip quick intro :)

Edited by blur
Link to comment
Share on other sites

hm, hm, hm, looks like I have duplicate functions

i have capturescreen utility from sean, and gdip.ahk is included with #include

tried to comment whole capturescreen block - but then there is no capturescreen function in gdip

ok, uncommented everything from capturescreen block except capturescreen and now there is no duplilcate functions, but...

my gdip.ahk doesn't have imagerotate function, only rotate world.

what gdip.ahk wrapper do you use? mine is 1.43 by tic.

by the way - i have the code to get description with strx function from skan and parts of your code from some other thread so no need for you to investigate it, tnx for gdip quick intro :)

I'm using 1.45 from tic, If you just add those functions from previous post, you don't need to include gdip.ahk - that could be duplicate functions problem. If you're using gdip.ahk anyway (make sure it's 1.45) then you should be able to use capturescreen, just don't insert the other functions from my post (they're the parts of gdip.ahk that you need)

p.s. I don't know when tic added the Gdip_ImageRotateFlip, must have been 1.44 or 1.45, but wish I'd seen it earlier - can probably eliminate 1/4 of my gdip code in current fplaunch if it works! RotateWorld is a pain, cause you need to get all the new dimensions from rotation etc... whereas ImageRotateFlip works on 90 degree turns so the math is done internally - at least that looks like how it's done :)

oh yeah, sean+tic+skan=90% of my code :P

Edited by samwyze
Link to comment
Share on other sites

@Blur, if you're playing with ahk, can you test if sending a left alt (or was it right?) to future pinball causes a pause without hiscores showing?

I can't get future pinball running on my cab - having hassles with laptops onboard video and opengl and it just wont co-operate - it'll run a table (eventually) but at I'd say 1 or 2 frames per sec - no joke!

Could be caused by my whacko dual monitor setup mind you, a second laptop (an old p3 I think) running MaxiVista dualscreen software serving as the backglass :P

Anyway, the point was, I can't test FP stuff and wanted to see if that worked

Link to comment
Share on other sites

yup, downloaded 1.45 - it has rotateflip function

still have some problems - no image on disk, here is the code:

printScreen:

; CaptureScreen(3,false,pfName) ; old function - it works but no rotation

pToken := Gdip_Startup()

CaptureScreen(3,"",0) ;capture current monitor to clipboard

sleep 100

pBitmap := Gdip_CreateBitmapFromClipboard()

pBitmap1 := Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0

Gdip_SaveBitmapToFile(pBitmap1, pfName)

Gdip_DisposeImage(pBitmap)

Gdip_DisposeImage(pBitmap1)

Gdip_Shutdown(pToken)

return

pfname is full file name with png in the end

will try to test it some more

Link to comment
Share on other sites

it looks like image rotate will not return pointer to bitmap but instead it rotates input bitmap and returns return code (not sure just guessing) so i changed code to:

pToken := Gdip_Startup()

CaptureScreen(3,"",0) ;capture current monitor to clipboard

pBitmap := Gdip_CreateBitmapFromClipboard()

Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0

Gdip_SaveBitmapToFile(pBitmap, pfname)

Gdip_DisposeImage(pBitmap)

Gdip_Shutdown(pToken)

still no image

Link to comment
Share on other sites

@Blur, if you're playing with ahk, can you test if sending a left alt (or was it right?) to future pinball causes a pause without hiscores showing?

I can't get future pinball running on my cab - having hassles with laptops onboard video and opengl and it just wont co-operate - it'll run a table (eventually) but at I'd say 1 or 2 frames per sec - no joke!

Could be caused by my whacko dual monitor setup mind you, a second laptop (an old p3 I think) running MaxiVista dualscreen software serving as the backglass :P

Anyway, the point was, I can't test FP stuff and wanted to see if that worked

tested left and right alt in fp - no pause

Link to comment
Share on other sites

i did it :)

there is some problem with capture screen to clipboard, it doesn't work

so instead of getting bitmap over clipboard - i switched to getting it from file, and it worked on first run - yeeee - so expect print screen in next release

here is the final code (there is also some code where description is pulled from xml - it is not here - if you want it i can post that part also):

printScreen:

CaptureScreen(3,"",pfName)

pToken := Gdip_Startup()

pBitmap := Gdip_CreateBitmapFromFile(pfName)

Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0

Gdip_SaveBitmapToFile(pBitmap, pfName)

Gdip_DisposeImage(pBitmap)

Gdip_Shutdown(pToken)

return

Edited by blur
Link to comment
Share on other sites

You posted while I was writing this - glad you found a workaround :)

it looks like image rotate will not return pointer to bitmap but instead it rotates input bitmap and returns return code (not sure just guessing) so i changed code to:

pToken := Gdip_Startup()

CaptureScreen(3,"",0) ;capture current monitor to clipboard

pBitmap := Gdip_CreateBitmapFromClipboard()

Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0

Gdip_SaveBitmapToFile(pBitmap, pfname)

Gdip_DisposeImage(pBitmap)

Gdip_Shutdown(pToken)

still no image

OK, I'll have a closer look tomorrow, I've got to get some sleep now! Possibly CreateBitmapFromClipboard is wrong coz I've never used it or ImageRotateFlip. In the mean time you could try along these lines (coz I forgot to drawimage before):

pToken := Gdip_Startup()
CaptureScreen(3,"",0) ;capture current monitor to clipboard
pBitmap := Gdip_CreateBitmapFromClipboard()
;---or instead of those 2 lines-------
pBitmap := Gdip_BitmapFromScreen()
;--------------then-----------------
pBitmap2 := Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0
Width := Gdip_GetImageWidth(pBitmap2), Height := Gdip_GetImageHeight(pBitmap2)
G := Gdip_GraphicsFromImage(pBitmap2)
Gdip_DrawImage(G, pBitmap2, 0, 0, Width, Height, 0, 0, Width, Height)
Gdip_SaveBitmapToFile(pBitmap2, pfname)
Gdip_DisposeImage(pBitmap), Gdip_DisposeImage(pBitmap2)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)

tested left and right alt in fp - no pause

Ok, damn, must have been a fluke on my desktop

Link to comment
Share on other sites

Cool, how about:

pToken := Gdip_Startup()
pBitmap := Gdip_BitmapFromScreen(1)
Gdip_ImageRotateFlip(pBitmap, 2) ;rotate 180, flip 0
Gdip_SaveBitmapToFile(pBitmap, pfName)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)

to avoid the extra file write?

I think pBitmap := Gdip_BitmapFromScreen() or pBitmap := Gdip_BitmapFromScreen(0) is all screens,

pBitmap := Gdip_BitmapFromScreen(1) is monitor 1 pBitmap := Gdip_BitmapFromScreen(2) mon 2 etc...

Edited by samwyze
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...