kaotkbliss Posted February 11, 2010 Share Posted February 11, 2010 winapi draw line uses the x,y of the line start and x,y of the line end _WinAPI_DrawLine($guiname, x1, y1, x2, y2) I've been searching google all morning looking for the the simple formula to plot a curve using 2 given points but can't find it. I'm hoping that by using the formula in place of the coordinates, winapi will draw a curve instead of a straight line. Possible? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2010 Moderators Share Posted February 11, 2010 kaotkbliss,I've been searching google all morning looking for the the simple formula to plot a curve using 2 given points but can't find it.That might because you need 3 points to define a curve. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 11, 2010 Author Share Posted February 11, 2010 Well, I know what the 3rd point is, but winapi only accepts 2. I can't remember any of this graphing stuff from math class so I didn't know if there was a way to get this to work. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2010 Moderators Share Posted February 11, 2010 kaotkbliss,_WinAPI_DrawLine only draws straight lines, as its name suggests. Perhaps you should look at _GDIPlus_GraphicsDrawCurve - sounds like a better bet to me! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 11, 2010 Author Share Posted February 11, 2010 I tried gdi plus drawing commands, but they don't seem to want to draw on the window I need it to. Unless I can figure that out, it seems my only other option would be to draw many straight short lines in a curve shape. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Yashied Posted February 11, 2010 Share Posted February 11, 2010 Look at _GDIPlus_GraphicsDrawCurve... from Authenticity's GDIP.au3. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 11, 2010 Author Share Posted February 11, 2010 (edited) I've tried gdi+ drawing but can't get any to work on my particular window. expandcollapse popup#include <Misc.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <WinAPIEx.au3> $dll = DllOpen("user32.dll") Global $hParent, $hForm, $Pos, $hBitmap = 0, $Go = 1, $XPrev = MouseGetPos(0), $YPrev = MouseGetPos(1) Global $hDC, $hMemDC, $hSv, $pBlend, $tBlend, $pSize, $tSize, $pSource, $tSource, $hWnd,$iX,$iY,$iHeight Global $scope = 0 $hParent = GUICreate('', -1, -1, -1, -1, -1, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TRANSPARENT )) $hForm = GUICreate('', 150, 150, $XPrev + 25, $YPrev + 25, BitOR($WS_DISABLED, $WS_POPUPWINDOW), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST,$WS_EX_TRANSPARENT ), $hParent) GUISetState(@SW_HIDE, $hForm) While 1 If _IsPressed("1B", $dll) Then DllClose($dll) Exit (1) EndIf If _IsPressed("5A", $dll) And $scope = 0 Then $scope = 1 Sleep(500) EndIf If _IsPressed("5A", $dll) And $scope = 1 Then $scope = 0 GUISetState(@SW_HIDE, $hForm) Sleep(500) EndIf If $scope = 1 Then GUISetState(@SW_SHOWNOACTIVATE, $hForm) $Pos = MouseGetPos() If ($Go) Or ($Pos[0] <> $XPrev) Or ($Pos[1] <> $YPrev) Then WinMove($hForm, '', $Pos[0] - 75, $Pos[1] - 75) _Capture($Pos[0] - 25, $Pos[1] - 25, 50, 50) $XPrev = $Pos[0] $YPrev = $Pos[1] $Go = 0 EndIf _Capture($Pos[0] - 25, $Pos[1] - 25, 50, 50) EndIf WEnd Func _Capture($iX, $iY, $iWidth, $iHeight) Local $tRect, $hDC, $hMemDC, $hScreenshort = _ScreenCapture($iX, $iY, $iWidth, $iHeight) _WinAPI_FreeObject($hBitmap) $hBitmap = _WinAPI_FitToBitmap($hScreenshort, 150, 150) _WinAPI_FreeObject($hScreenshort) $hDC = _WinAPI_GetDC($hForm) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hMemDC, $hBitmap) _WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($NULL_BRUSH)) _WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($DC_PEN)) _WinAPI_SetDCPenColor($hMemDC, 0xA00000) _WinAPI_DrawLine($hMemDC, 150, 75, -150, 75) _WinAPI_DrawLine($hMemDC, 75, 150, 75, -150) _WinAPI_DrawLine($hMemDC, 70, 65, 80, 65) _WinAPI_DrawLine($hMemDC, 85, 70, 85, 80) _WinAPI_DrawLine($hMemDC, 70, 85, 80, 85) _WinAPI_DrawLine($hMemDC, 65, 70, 65, 80) _WinAPI_DrawLine($hMemDC, 65, 50, 85, 50) _WinAPI_DrawLine($hMemDC, 100, 65, 100, 85) _WinAPI_DrawLine($hMemDC, 65, 100, 85, 100) _WinAPI_DrawLine($hMemDC, 50, 65, 50, 85) _WinAPI_DrawLine($hMemDC, 60, 35, 90, 35) _WinAPI_DrawLine($hMemDC, 115, 60, 115, 90) _WinAPI_DrawLine($hMemDC, 60, 115, 90, 115) _WinAPI_DrawLine($hMemDC, 35, 60, 35, 90) _WinAPI_ReleaseDC($hForm, $hDC) _WinAPI_DeleteDC($hMemDC) _SetBitmap($hForm, $hBitmap, 254) EndFunc ;==>_Capture Func _ScreenCapture($iX, $iY, $iWidth, $iHeight) Local $hWnd, $hDC, $hMemDC, $hBitmap $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) _WinAPI_SelectObject($hMemDC, $hBitmap) _WinAPI_BitBlt($hMemDC, 0, 0, $iWidth, $iHeight, $hDC, $iX, $iY, $MERGECOPY) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hMemDC) Return $hBitmap EndFunc ;==>_ScreenCapture Func _SetBitmap($hWnd, $hBitmap, $iOpacity) $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hSv = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = _WinAPI_GetBitmapDimension($hBitmap) $pSize = DllStructGetPtr($tSize) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 0) _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_SelectObject($hMemDC, $hSv) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Edited February 11, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now