Turbine1991 Posted December 26, 2013 Share Posted December 26, 2013 In the past I've managed to do this, since then the API has changed. I've looked through the wiki and it seems this is what I'd use: TSCARBitmapClient - SCAR Divi Manual But I'm uncertain how to use this functionality in the current state of the SCAR API. Previously I used these capabilities in this manner: debugCanvas := GetClientCanvas(); SafeDrawBitmap(img, debugCanvas, x1, y1); I've only been able to find deprecated examples. Would someone be able to guide me with the current method of drawing on top of a window with a primitive shape. Thank you. Quote Link to comment Share on other sites More sharing options...
Neron Posted December 27, 2013 Share Posted December 27, 2013 h!i Im not shore, if i understand ,but if you want to put immage in immage you can use img1.DrawTo(img2,x,y,Blend); Quote Link to comment Share on other sites More sharing options...
Turbine1991 Posted December 28, 2013 Author Share Posted December 28, 2013 (edited) I really am just trying to figure out the newest equivalent to GetClientCanvas. I've looked through the changelogs and wiki. Edited December 28, 2013 by Turbine1991 Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 29, 2013 Share Posted December 29, 2013 (edited) Um. There's a new client system using TScarClient To draw on top of a window, idk. There's GetClient. TScarBitmapClient. FastDraw? etc. Everything is explained in Freddys video tutorials he made. However i forget if its possible to do what you want, the canvas might not be editable. Unless maybe theres a debug canvas ontop of the clients canvas. Maybe Copy or Bitblt, or maybe Bitmap.DrawTo You could make a blank canvas and put it on top of the client too, adjust it to whatever size and position it. Then just use Canvas. Text or. draw or whatever methods. You could make your own form and draw on it. Ill figure this out later. Posted this from my phone. Edited December 29, 2013 by LordJashin Quote Link to comment Share on other sites More sharing options...
Turbine1991 Posted December 29, 2013 Author Share Posted December 29, 2013 (edited) Previously I understood how to do all this, perhaps I'll look through his more updated videos. It's how I found out about it awhile ago. But there wasn't really a mention in the version change-logs between 3.34 and 3.35. From what I saw, GetClient can be used to get the scar window object and from there this could be done. But there's not a canvas in sight nor any functions supporting this. I'm considering using 3.34, but it would have been nice to use the new image classes introduced in 3.35 and up. It's getting the client canvas which is the difficult thing. [Edit] I just watched through 2 of his videos of 3.35, neither touched the exact subject. Edited December 29, 2013 by Turbine1991 Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 31, 2013 Share Posted December 31, 2013 (edited) Well if you really wanted this badly, you'd probably need multi threading in SCAR OR you could make a delphi forms plugin for SCAR. Otherwise the window might freeze up? Idk. All I know is that I produced this same sort of functionality in Free Pascal with window layers, transparent window, and the like. And i drew on it, this was the Targeting (Crosshairs) window used in the program I made. It Overlays any window your cursor is on. http://forums.scar-divi.com/programming/2367-auto-licious-ide-development-uses-fpc-compiler.html Same thing as SCAR's target, or works the same way i think . And that's a transparent window w/ the form drawn on and everything. My source code is linked on there too... GL lol. e.g. utargetwindow.pas or w/e { uTargetSelection - SetTarget Form Unit Created by LordJashin32 Copyright 2013 LordJashin32 License: GPL/Others Last Updated: 8/9/2013 Created: 7/27/2013 Credits: Freddy Control: uAutolicious -> uTargetSelection: - procedure frmAutolicious.tbSetTargetMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); - var ButtonPDown: Boolean; } unit uTargetSelection; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, LCLType, LCLIntf; type TfrmTargetSelection = class(TForm) Shape1: TShape; // Colors the form Timer1: TTimer; public IsForShow: boolean; // Controls what instance does what in the timer private // CreateParams overrided to make the form transparent (Windows) {$IFDEF WINDOWS} procedure CreateParams(var Params: TCreateParams); override; {$ENDIF} // Used by the timer procedure CloseDown; published // Updates the form dynamically using GetWindowFromPoint (Windows method) procedure Timer1Timer(Sender: TObject); end; var frmTargetSelection: TfrmTargetSelection; // One form for Alpha transparency frmTargetSelection1: TfrmTargetSelection; // One form for transparent frmTargetSelectionHandle: HWND; // Targeted Window from GetWindowFromPoint // Various Variables TargetSet, KeyPressd: boolean; implementation uses uAutolicious{$IFDEF WINDOWS}, Windows{$ENDIF}; {$R *.lfm} {~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ procedure TfrmTargetSelection.CreateParams(var Params: TCreateParams); Description: Changes the create params for the SelectWindow form so that it is click through-able. (Windows Method) Last Modified: 7/8/12 By LordJashin. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~} {$IFDEF WINDOWS} procedure TfrmTargetSelection.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); Params.ExStyle := WS_EX_TRANSPARENT; end; {$ENDIF} {~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ procedure TfrmTargetSelection.CloseDown; Description: Run by the Timer, Closes down the 2 instances, resets, and debugs the target handle to the Debug SynEdit. Last Modified: 7/31/13 By LordJashin. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~} procedure TfrmTargetSelection.CloseDown; var DebugStr: string; begin {$IFDEF WINDOWS} frmTargetSelection.Timer1.Enabled := False; {$ENDIF} frmTargetSelection1.Timer1.Enabled := False; Screen.Cursor := crDefault; TargetSet := True; DebugStr := frmAutolicious.synDebug.Text; frmAutolicious.synDebug.Text := 'New Target Selected: ' + IntToStr(frmTargetSelectionHandle) + #13#10 + DebugStr; KeyPressd := False; ButtonPDown := False; {$IFDEF WINDOWS} frmTargetSelection.Close; {$ENDIF} frmTargetSelection1.Close; end; {~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ procedure TfrmTargetSelection.Timer1Timer(Sender: TObject); Description: Gets the Window From Point at the current mouse point. Changes the forms bounds to match the WindowFromPoint. One Instance is for SHOW only, to make the appearance look better. If the handle found = the handle of frmTargetSelection, then the shape is Disabled momentarily. The WindowFromPoint its handle is stored in frmTargetSelectionHandle. This is setting the Target window for Autolicious. If mbLeft is UP, or mbRight is DOWN. Then we call CloseDown(); Various Variables are used to make sure the user doesn't make this timer go on forever. Or doesn't click the button again while selecting a target, etc. Last Modified: 7/13/12 By LordJashin. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~} procedure TfrmTargetSelection.Timer1Timer(Sender: TObject); var P: TPoint; tempHandle: HWND; Rect: TRect; KeyState, KeyState1: boolean; begin if not IsForShow then begin KeyState := (GetKeyState(VK_LBUTTON) and $8000 <> 0); KeyState1 := (GetKeyState(VK_RBUTTON) and $8000 <> 0); if (not KeyState) or KeyState1 then KeyPressd := True; end; if KeyPressd then CloseDown(); P := Mouse.CursorPos; tempHandle := WindowFromPoint(P); if tempHandle = Handle then begin Shape1.Visible := False; Exit; end; GetWindowRect(tempHandle, Rect); BoundsRect := Rect; Shape1.Visible := True; if not IsForShow then frmTargetSelectionHandle := tempHandle; end; end. Edited December 31, 2013 by LordJashin Quote Link to comment Share on other sites More sharing options...
Turbine1991 Posted December 31, 2013 Author Share Posted December 31, 2013 I've just gone back to 3.34 (4.0 Titan also is the same) It's as simple as: SafeDrawBitmap(image, GetClientCanvas, x, y); I really do wonder about the direction of SCAR, for every improvement, there's major regressions. Quote Link to comment Share on other sites More sharing options...