Pixel distance visualization.
Code: Select all
;***************************************************************************************************
#Include <My Altered Gdip Lib> ;Replace with your GDIP LIB
;***************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Client
GDIP_Startup()
global PicHwnd , Start := New HB_Vector( 100, 100 ) , End := New HB_Vector()
Gui, 1:+AlwaysOnTop -DPIScale +E0x02000000 +E0x00080000
Gui, 1:Color, 22262A
Gui, 1:Margin, 0, 0
Gui, 1:Add, Picture, xm ym w200 h250 0xE HwndPicHwnd
Gui, 1:Show,,Distance
CursorMove()
OnMessage(0x200,"CursorMove")
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
CursorMove(){
MouseGetPos, x, y
DrawGraphics( End.X := x , End.Y := y , Start.Dist(End))
}
Class HB_Vector {
;Modified class from: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=89290
__New(x:=0,y:=0){
This.X:=x , This.Y:=y
}dist(in1){
return Sqrt(((This.X-In1.X)**2) + ((This.Y-In1.Y)**2))
}
}
DrawGraphics(x,y,Distance){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 200 , 250 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Pen := Gdip_CreatePen( "0xFF3399FF" , 1 ) , Gdip_DrawEllipse( G , Pen , 20 , 20 , 160 , 160 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFFffff00" , 1 ) , Gdip_DrawEllipse( G , Pen , 100 - distance , 100 - distance , distance*2 , distance * 2 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFF880000" , 1 ) , Gdip_DrawLine( G , Pen , 99 , 10 , 99 , 190 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFF33C833" , 1 ) , Gdip_DrawLine( G , Pen , 10 , 99 , 190 , 99 ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFFffff00" , 1 ) , Gdip_DrawLine( G , Pen , 99 , 100 , x , y ) , Gdip_DeletePen( Pen )
Pen := Gdip_CreatePen( "0xFFff00ff" , 1 ) , Gdip_DrawRectangle( G , Pen , (x>=99)?(99):(x) , (y>=99)?(99):(y) , (x>=99)?(x-99):(99-x) , (y>=99)?(y-99):(99-y) ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF3399FF" ) , Gdip_TextToGraphics( G , "Distance 80px" , "s12 Center vCenter Bold c" Brush " x0 y0" , "Segoe ui" , 200 , 17 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( G , "Distance: " Distance "px" , "s12 Center vCenter Bold c" Brush " x0 y220" , "Segoe ui" , 200 , 17 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G ) , hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap) , Gdip_DisposeImage( pBitmap ) , SetImage( PicHwnd , hBitmap ) , DeleteObject( hBitmap )
}