hi, which version of the magniferscript do you use ? we have about 4 variants in this thread
i quess the last one from lazlo?
one idea to draw the crosshair is to use some strechblt or bitblt to invert the crosshair over the magnified image.
the current copy-mode is "SRCCOPY" but there also is a mode which produces XOR i think. this would invert all pixels. then it would not be really black but invert, perhaps this is even better as you dont loose the colorinformation behind the crosshair (as its inverse and you can guess?)
or one uses DLLCall for drawing Lines with GDI, there are Commands for Draw Dot, Draw Circle?, Draw Line, FillRect.
one trick could also be to create a black buffer (DC) and then bitblt only the needed black line over to the magnifier window/gui/DC.
in the bitblt you define the source-coordinates and the destination-coordinates. so you would need 2 bitblts to create your crosshair by bitblt of something like. destx1=mag_size/2, desty1=0, destx2=mag_size/2 +1, desty2=magnifier_height...
you get the idea
you should also check lazlos link for crosshair scripts.
i guess using ddl-calls for gdi32.dll will be fastest performance!
the magnifier already makes heavy use of bitblt or strechblt so it would be natural to use it for the crosshair also.
(adding 2 stechblts with SCRINVERT for exampe, one for horizontal and one for vertical line)
eg. like here:
<!-- m -->
http://www.autohotke...opic.php?t=5273<!-- m -->
;############# draw cross lines ###########################################
DrawCross( p_x, p_y, p_w, p_h )
{
global hdc_frame, h_pen
;margin to the inside of the region to start drawing the lines
LineMargin = 10
;select the correct pen into DC
DllCall( "gdi32.dll\SelectObject"
, "uint", hdc_frame
, "uint", h_pen )
;update the current position to specified point
DllCall( "gdi32.dll\MoveToEx"
, "uint", hdc_frame
, "int", p_x+LineMargin
, "int", p_y+LineMargin
, "uint", 0)
;draw a line from the current position up to, but not including, the specified point.
DllCall( "gdi32.dll\LineTo"
, "uint", hdc_frame
, "int", p_x+p_w-LineMargin
, "int", p_y+p_h-LineMargin)
DllCall( "gdi32.dll\MoveToEx"
, "uint", hdc_frame
, "int", p_x+p_w-LineMargin
, "int", p_y+LineMargin
, "uint", 0)
DllCall( "gdi32.dll\LineTo"
, "uint", hdc_frame
, "int", p_x+LineMargin
, "int", p_y+p_h-LineMargin)
for the xor idea see:
<!-- m -->
http://msdn.microsof... ... bitblt.asp<!-- m -->
SRCAND Combines the colors of the source and destination rectangles by using the Boolean AND operator.
SRCCOPY Copies the source rectangle directly to the destination rectangle.
SRCERASE Combines the inverted colors of the destination rectangle with the colors of the source rectangle by using the Boolean AND operator.
SRCINVERT Combines the colors of the source and destination rectangles by using the Boolean XOR operator.
SRCPAINT Combines the colors of the source and destination rectangles by using the Boolean OR operator.
the integerss for the modes
public enum TernaryRasterOperations
{
SRCCOPY = 0x00CC0020, /* dest = source*/
SRCPAINT = 0x00EE0086, /* dest = source OR dest*/
SRCAND = 0x008800C6, /* dest = source AND dest*/
SRCINVERT = 0x00660046, /* dest = source XOR dest*/
SRCERASE = 0x00440328, /* dest = source AND (NOT dest )*/
NOTSRCCOPY = 0x00330008, /* dest = (NOT source)*/
NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)*/
MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest*/
PATCOPY = 0x00F00021, /* dest = pattern*/
PATPAINT = 0x00FB0A09, /* dest = DPSnoo*/
PATINVERT = 0x005A0049, /* dest = pattern XOR dest*/
DSTINVERT = 0x00550009, /* dest = (NOT dest)*/
BLACKNESS = 0x00000042, /* dest = BLACK*/
WHITENESS = 0x00FF0062, /* dest = WHITE*/
};
i also like the idea with
Gui +E0x20
for making the window "clickthrough" and allowing normal usage of mouse and context-menu. but this would interfere with moving the magnifierwindow as already discussed.
perhaps you already use the version which acts as a lens following the mouse directly.