Jump to content

Perforated image in GUI


GreenCan
 Share

Recommended Posts

Hi Martin,

Maybe _GDIPlus_GraphicsDrawCurve can help.

Look at this script. I only took the first Letter but it works. There are too many points to get a nice curve, in fact the result is the same as in your script I guess.

The curves should have less points to be smoothed. By reducing the number of coordinates, the result will get better, but that's the tricky part of course.

In the example, I had to replace the first element of the array by the total number of points.

Cheers,

GreenCan.

#include <StaticConstants.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)
Global $Scale = 2

_Main()

Func _Main()
    Local $hGUI, $hWnd, $hGraphic, $aPoints[8][2]

    ; Create GUI
    $hGUI = GUICreate("Outline using GDI+", 463 * $Scale, 145 * $Scale, (@DesktopWidth  - (463 * $Scale)) / 2 , (@DesktopHeight - (145 * $Scale)) / 2)
    $hWnd = WinGetHandle("Outline using GDI+")
    GUISetState()

    ; Draw a cardinal spline
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
    Dim $lines[348][2]
    $lines[0][0] = 347 ; I modified this because the method requires the amount of points 
    $lines[0][1] = 35 * $Scale
    $lines[1][0] = 39 * $Scale
    $lines[1][1] = 35 * $Scale
    $lines[2][0] = 40 * $Scale
    $lines[2][1] = 35 * $Scale
    $lines[3][0] = 41 * $Scale
    $lines[3][1] = 35 * $Scale
    $lines[4][0] = 42 * $Scale
    $lines[4][1] = 35 * $Scale
    $lines[5][0] = 43 * $Scale
    $lines[5][1] = 35 * $Scale
    $lines[6][0] = 44 * $Scale
    $lines[6][1] = 35 * $Scale
    $lines[7][0] = 45 * $Scale
    $lines[7][1] = 35 * $Scale
    $lines[8][0] = 46 * $Scale
    $lines[8][1] = 35 * $Scale
    $lines[9][0] = 47 * $Scale
    $lines[9][1] = 35 * $Scale
    $lines[10][0] = 48 * $Scale
    $lines[10][1] = 35 * $Scale
    $lines[11][0] = 49 * $Scale
    $lines[11][1] = 35 * $Scale
    $lines[12][0] = 50 * $Scale
    $lines[12][1] = 35 * $Scale
    $lines[13][0] = 51 * $Scale
    $lines[13][1] = 36 * $Scale
    $lines[14][0] = 52 * $Scale
    $lines[14][1] = 36 * $Scale
    $lines[15][0] = 53 * $Scale
    $lines[15][1] = 36 * $Scale
    $lines[16][0] = 54 * $Scale
    $lines[16][1] = 36 * $Scale
    $lines[17][0] = 55 * $Scale
    $lines[17][1] = 37 * $Scale
    $lines[18][0] = 56 * $Scale
    $lines[18][1] = 37 * $Scale
    $lines[19][0] = 57 * $Scale
    $lines[19][1] = 37 * $Scale
    $lines[20][0] = 58 * $Scale
    $lines[20][1] = 38 * $Scale
    $lines[21][0] = 59 * $Scale
    $lines[21][1] = 38 * $Scale
    $lines[22][0] = 60 * $Scale
    $lines[22][1] = 39 * $Scale
    $lines[23][0] = 61 * $Scale
    $lines[23][1] = 39 * $Scale
    $lines[24][0] = 62 * $Scale
    $lines[24][1] = 40 * $Scale
    $lines[25][0] = 63 * $Scale
    $lines[25][1] = 41 * $Scale
    $lines[26][0] = 64 * $Scale
    $lines[26][1] = 42 * $Scale
    $lines[27][0] = 65 * $Scale
    $lines[27][1] = 43 * $Scale
    $lines[28][0] = 66 * $Scale
    $lines[28][1] = 44 * $Scale
    $lines[29][0] = 67 * $Scale
    $lines[29][1] = 45 * $Scale
    $lines[30][0] = 67 * $Scale
    $lines[30][1] = 46 * $Scale
    $lines[31][0] = 68 * $Scale
    $lines[31][1] = 47 * $Scale
    $lines[32][0] = 68 * $Scale
    $lines[32][1] = 48 * $Scale
    $lines[33][0] = 69 * $Scale
    $lines[33][1] = 49 * $Scale
    $lines[34][0] = 69 * $Scale
    $lines[34][1] = 50 * $Scale
    $lines[35][0] = 70 * $Scale
    $lines[35][1] = 51 * $Scale
    $lines[36][0] = 70 * $Scale
    $lines[36][1] = 52 * $Scale
    $lines[37][0] = 70 * $Scale
    $lines[37][1] = 53 * $Scale
    $lines[38][0] = 70 * $Scale
    $lines[38][1] = 54 * $Scale
    $lines[39][0] = 69 * $Scale
    $lines[39][1] = 54 * $Scale
    $lines[40][0] = 68 * $Scale
    $lines[40][1] = 54 * $Scale
    $lines[41][0] = 67 * $Scale
    $lines[41][1] = 55 * $Scale
    $lines[42][0] = 66 * $Scale
    $lines[42][1] = 55 * $Scale
    $lines[43][0] = 65 * $Scale
    $lines[43][1] = 55 * $Scale
    $lines[44][0] = 64 * $Scale
    $lines[44][1] = 55 * $Scale
    $lines[45][0] = 63 * $Scale
    $lines[45][1] = 55 * $Scale
    $lines[46][0] = 62 * $Scale
    $lines[46][1] = 55 * $Scale
    $lines[47][0] = 61 * $Scale
    $lines[47][1] = 56 * $Scale
    $lines[48][0] = 60 * $Scale
    $lines[48][1] = 56 * $Scale
    $lines[49][0] = 59 * $Scale
    $lines[49][1] = 56 * $Scale
    $lines[50][0] = 59 * $Scale
    $lines[50][1] = 55 * $Scale
    $lines[51][0] = 58 * $Scale
    $lines[51][1] = 54 * $Scale
    $lines[52][0] = 58 * $Scale
    $lines[52][1] = 53 * $Scale
    $lines[53][0] = 57 * $Scale
    $lines[53][1] = 52 * $Scale
    $lines[54][0] = 57 * $Scale
    $lines[54][1] = 51 * $Scale
    $lines[55][0] = 56 * $Scale
    $lines[55][1] = 50 * $Scale
    $lines[56][0] = 55 * $Scale
    $lines[56][1] = 49 * $Scale
    $lines[57][0] = 54 * $Scale
    $lines[57][1] = 48 * $Scale
    $lines[58][0] = 53 * $Scale
    $lines[58][1] = 48 * $Scale
    $lines[59][0] = 52 * $Scale
    $lines[59][1] = 47 * $Scale
    $lines[60][0] = 51 * $Scale
    $lines[60][1] = 46 * $Scale
    $lines[61][0] = 50 * $Scale
    $lines[61][1] = 46 * $Scale
    $lines[62][0] = 49 * $Scale
    $lines[62][1] = 46 * $Scale
    $lines[63][0] = 48 * $Scale
    $lines[63][1] = 45 * $Scale
    $lines[64][0] = 47 * $Scale
    $lines[64][1] = 45 * $Scale
    $lines[65][0] = 46 * $Scale
    $lines[65][1] = 45 * $Scale
    $lines[66][0] = 45 * $Scale
    $lines[66][1] = 45 * $Scale
    $lines[67][0] = 44 * $Scale
    $lines[67][1] = 45 * $Scale
    $lines[68][0] = 43 * $Scale
    $lines[68][1] = 45 * $Scale
    $lines[69][0] = 42 * $Scale
    $lines[69][1] = 45 * $Scale
    $lines[70][0] = 41 * $Scale
    $lines[70][1] = 45 * $Scale
    $lines[71][0] = 40 * $Scale
    $lines[71][1] = 45 * $Scale
    $lines[72][0] = 39 * $Scale
    $lines[72][1] = 45 * $Scale
    $lines[73][0] = 38 * $Scale
    $lines[73][1] = 46 * $Scale
    $lines[74][0] = 37 * $Scale
    $lines[74][1] = 46 * $Scale
    $lines[75][0] = 36 * $Scale
    $lines[75][1] = 46 * $Scale
    $lines[76][0] = 35 * $Scale
    $lines[76][1] = 47 * $Scale
    $lines[77][0] = 34 * $Scale
    $lines[77][1] = 47 * $Scale
    $lines[78][0] = 33 * $Scale
    $lines[78][1] = 48 * $Scale
    $lines[79][0] = 32 * $Scale
    $lines[79][1] = 48 * $Scale
    $lines[80][0] = 31 * $Scale
    $lines[80][1] = 49 * $Scale
    $lines[81][0] = 30 * $Scale
    $lines[81][1] = 50 * $Scale
    $lines[82][0] = 29 * $Scale
    $lines[82][1] = 51 * $Scale
    $lines[83][0] = 28 * $Scale
    $lines[83][1] = 52 * $Scale
    $lines[84][0] = 27 * $Scale
    $lines[84][1] = 53 * $Scale
    $lines[85][0] = 27 * $Scale
    $lines[85][1] = 54 * $Scale
    $lines[86][0] = 26 * $Scale
    $lines[86][1] = 55 * $Scale
    $lines[87][0] = 26 * $Scale
    $lines[87][1] = 56 * $Scale
    $lines[88][0] = 25 * $Scale
    $lines[88][1] = 57 * $Scale
    $lines[89][0] = 25 * $Scale
    $lines[89][1] = 58 * $Scale
    $lines[90][0] = 25 * $Scale
    $lines[90][1] = 59 * $Scale
    $lines[91][0] = 25 * $Scale
    $lines[91][1] = 60 * $Scale
    $lines[92][0] = 24 * $Scale
    $lines[92][1] = 61 * $Scale
    $lines[93][0] = 24 * $Scale
    $lines[93][1] = 62 * $Scale
    $lines[94][0] = 24 * $Scale
    $lines[94][1] = 63 * $Scale
    $lines[95][0] = 24 * $Scale
    $lines[95][1] = 64 * $Scale
    $lines[96][0] = 24 * $Scale
    $lines[96][1] = 65 * $Scale
    $lines[97][0] = 24 * $Scale
    $lines[97][1] = 66 * $Scale
    $lines[98][0] = 24 * $Scale
    $lines[98][1] = 67 * $Scale
    $lines[99][0] = 24 * $Scale
    $lines[99][1] = 68 * $Scale
    $lines[100][0] = 24 * $Scale
    $lines[100][1] = 69 * $Scale
    $lines[101][0] = 24 * $Scale
    $lines[101][1] = 70 * $Scale
    $lines[102][0] = 24 * $Scale
    $lines[102][1] = 71 * $Scale
    $lines[103][0] = 24 * $Scale
    $lines[103][1] = 72 * $Scale
    $lines[104][0] = 24 * $Scale
    $lines[104][1] = 73 * $Scale
    $lines[105][0] = 24 * $Scale
    $lines[105][1] = 74 * $Scale
    $lines[106][0] = 25 * $Scale
    $lines[106][1] = 75 * $Scale
    $lines[107][0] = 25 * $Scale
    $lines[107][1] = 76 * $Scale
    $lines[108][0] = 25 * $Scale
    $lines[108][1] = 77 * $Scale
    $lines[109][0] = 25 * $Scale
    $lines[109][1] = 78 * $Scale
    $lines[110][0] = 26 * $Scale
    $lines[110][1] = 79 * $Scale
    $lines[111][0] = 26 * $Scale
    $lines[111][1] = 80 * $Scale
    $lines[112][0] = 27 * $Scale
    $lines[112][1] = 81 * $Scale
    $lines[113][0] = 27 * $Scale
    $lines[113][1] = 82 * $Scale
    $lines[114][0] = 28 * $Scale
    $lines[114][1] = 83 * $Scale
    $lines[115][0] = 28 * $Scale
    $lines[115][1] = 84 * $Scale
    $lines[116][0] = 29 * $Scale
    $lines[116][1] = 85 * $Scale
    $lines[117][0] = 30 * $Scale
    $lines[117][1] = 86 * $Scale
    $lines[118][0] = 31 * $Scale
    $lines[118][1] = 87 * $Scale
    $lines[119][0] = 32 * $Scale
    $lines[119][1] = 87 * $Scale
    $lines[120][0] = 33 * $Scale
    $lines[120][1] = 88 * $Scale
    $lines[121][0] = 34 * $Scale
    $lines[121][1] = 89 * $Scale
    $lines[122][0] = 35 * $Scale
    $lines[122][1] = 89 * $Scale
    $lines[123][0] = 36 * $Scale
    $lines[123][1] = 90 * $Scale
    $lines[124][0] = 37 * $Scale
    $lines[124][1] = 90 * $Scale
    $lines[125][0] = 38 * $Scale
    $lines[125][1] = 90 * $Scale
    $lines[126][0] = 39 * $Scale
    $lines[126][1] = 91 * $Scale
    $lines[127][0] = 40 * $Scale
    $lines[127][1] = 91 * $Scale
    $lines[128][0] = 41 * $Scale
    $lines[128][1] = 91 * $Scale
    $lines[129][0] = 42 * $Scale
    $lines[129][1] = 91 * $Scale
    $lines[130][0] = 43 * $Scale
    $lines[130][1] = 91 * $Scale
    $lines[131][0] = 44 * $Scale
    $lines[131][1] = 91 * $Scale
    $lines[132][0] = 45 * $Scale
    $lines[132][1] = 91 * $Scale
    $lines[133][0] = 46 * $Scale
    $lines[133][1] = 91 * $Scale
    $lines[134][0] = 47 * $Scale
    $lines[134][1] = 91 * $Scale
    $lines[135][0] = 48 * $Scale
    $lines[135][1] = 91 * $Scale
    $lines[136][0] = 49 * $Scale
    $lines[136][1] = 90 * $Scale
    $lines[137][0] = 50 * $Scale
    $lines[137][1] = 90 * $Scale
    $lines[138][0] = 51 * $Scale
    $lines[138][1] = 90 * $Scale
    $lines[139][0] = 52 * $Scale
    $lines[139][1] = 89 * $Scale
    $lines[140][0] = 53 * $Scale
    $lines[140][1] = 89 * $Scale
    $lines[141][0] = 54 * $Scale
    $lines[141][1] = 89 * $Scale
    $lines[142][0] = 55 * $Scale
    $lines[142][1] = 88 * $Scale
    $lines[143][0] = 56 * $Scale
    $lines[143][1] = 88 * $Scale
    $lines[144][0] = 57 * $Scale
    $lines[144][1] = 87 * $Scale
    $lines[145][0] = 58 * $Scale
    $lines[145][1] = 86 * $Scale
    $lines[146][0] = 59 * $Scale
    $lines[146][1] = 86 * $Scale
    $lines[147][0] = 60 * $Scale
    $lines[147][1] = 85 * $Scale
    $lines[148][0] = 60 * $Scale
    $lines[148][1] = 84 * $Scale
    $lines[149][0] = 60 * $Scale
    $lines[149][1] = 83 * $Scale
    $lines[150][0] = 60 * $Scale
    $lines[150][1] = 82 * $Scale
    $lines[151][0] = 60 * $Scale
    $lines[151][1] = 81 * $Scale
    $lines[152][0] = 60 * $Scale
    $lines[152][1] = 80 * $Scale
    $lines[153][0] = 60 * $Scale
    $lines[153][1] = 79 * $Scale
    $lines[154][0] = 60 * $Scale
    $lines[154][1] = 78 * $Scale
    $lines[155][0] = 60 * $Scale
    $lines[155][1] = 77 * $Scale
    $lines[156][0] = 59 * $Scale
    $lines[156][1] = 76 * $Scale
    $lines[157][0] = 58 * $Scale
    $lines[157][1] = 76 * $Scale
    $lines[158][0] = 57 * $Scale
    $lines[158][1] = 76 * $Scale
    $lines[159][0] = 56 * $Scale
    $lines[159][1] = 76 * $Scale
    $lines[160][0] = 55 * $Scale
    $lines[160][1] = 76 * $Scale
    $lines[161][0] = 54 * $Scale
    $lines[161][1] = 76 * $Scale
    $lines[162][0] = 53 * $Scale
    $lines[162][1] = 76 * $Scale
    $lines[163][0] = 52 * $Scale
    $lines[163][1] = 76 * $Scale
    $lines[164][0] = 51 * $Scale
    $lines[164][1] = 76 * $Scale
    $lines[165][0] = 50 * $Scale
    $lines[165][1] = 76 * $Scale
    $lines[166][0] = 49 * $Scale
    $lines[166][1] = 76 * $Scale
    $lines[167][0] = 48 * $Scale
    $lines[167][1] = 76 * $Scale
    $lines[168][0] = 47 * $Scale
    $lines[168][1] = 76 * $Scale
    $lines[169][0] = 46 * $Scale
    $lines[169][1] = 76 * $Scale
    $lines[170][0] = 45 * $Scale
    $lines[170][1] = 76 * $Scale
    $lines[171][0] = 45 * $Scale
    $lines[171][1] = 75 * $Scale
    $lines[172][0] = 45 * $Scale
    $lines[172][1] = 74 * $Scale
    $lines[173][0] = 45 * $Scale
    $lines[173][1] = 73 * $Scale
    $lines[174][0] = 45 * $Scale
    $lines[174][1] = 72 * $Scale
    $lines[175][0] = 45 * $Scale
    $lines[175][1] = 71 * $Scale
    $lines[176][0] = 45 * $Scale
    $lines[176][1] = 70 * $Scale
    $lines[177][0] = 45 * $Scale
    $lines[177][1] = 69 * $Scale
    $lines[178][0] = 45 * $Scale
    $lines[178][1] = 68 * $Scale
    $lines[179][0] = 45 * $Scale
    $lines[179][1] = 67 * $Scale
    $lines[180][0] = 45 * $Scale
    $lines[180][1] = 66 * $Scale
    $lines[181][0] = 46 * $Scale
    $lines[181][1] = 66 * $Scale
    $lines[182][0] = 47 * $Scale
    $lines[182][1] = 66 * $Scale
    $lines[183][0] = 48 * $Scale
    $lines[183][1] = 66 * $Scale
    $lines[184][0] = 49 * $Scale
    $lines[184][1] = 66 * $Scale
    $lines[185][0] = 50 * $Scale
    $lines[185][1] = 66 * $Scale
    $lines[186][0] = 51 * $Scale
    $lines[186][1] = 66 * $Scale
    $lines[187][0] = 52 * $Scale
    $lines[187][1] = 66 * $Scale
    $lines[188][0] = 53 * $Scale
    $lines[188][1] = 66 * $Scale
    $lines[189][0] = 54 * $Scale
    $lines[189][1] = 66 * $Scale
    $lines[190][0] = 55 * $Scale
    $lines[190][1] = 66 * $Scale
    $lines[191][0] = 56 * $Scale
    $lines[191][1] = 66 * $Scale
    $lines[192][0] = 57 * $Scale
    $lines[192][1] = 66 * $Scale
    $lines[193][0] = 58 * $Scale
    $lines[193][1] = 66 * $Scale
    $lines[194][0] = 59 * $Scale
    $lines[194][1] = 66 * $Scale
    $lines[195][0] = 60 * $Scale
    $lines[195][1] = 66 * $Scale
    $lines[196][0] = 61 * $Scale
    $lines[196][1] = 66 * $Scale
    $lines[197][0] = 62 * $Scale
    $lines[197][1] = 66 * $Scale
    $lines[198][0] = 63 * $Scale
    $lines[198][1] = 66 * $Scale
    $lines[199][0] = 64 * $Scale
    $lines[199][1] = 66 * $Scale
    $lines[200][0] = 65 * $Scale
    $lines[200][1] = 66 * $Scale
    $lines[201][0] = 66 * $Scale
    $lines[201][1] = 66 * $Scale
    $lines[202][0] = 67 * $Scale
    $lines[202][1] = 66 * $Scale
    $lines[203][0] = 68 * $Scale
    $lines[203][1] = 66 * $Scale
    $lines[204][0] = 69 * $Scale
    $lines[204][1] = 66 * $Scale
    $lines[205][0] = 70 * $Scale
    $lines[205][1] = 66 * $Scale
    $lines[206][0] = 71 * $Scale
    $lines[206][1] = 66 * $Scale
    $lines[207][0] = 71 * $Scale
    $lines[207][1] = 67 * $Scale
    $lines[208][0] = 71 * $Scale
    $lines[208][1] = 68 * $Scale
    $lines[209][0] = 71 * $Scale
    $lines[209][1] = 69 * $Scale
    $lines[210][0] = 71 * $Scale
    $lines[210][1] = 70 * $Scale
    $lines[211][0] = 71 * $Scale
    $lines[211][1] = 71 * $Scale
    $lines[212][0] = 71 * $Scale
    $lines[212][1] = 72 * $Scale
    $lines[213][0] = 71 * $Scale
    $lines[213][1] = 73 * $Scale
    $lines[214][0] = 71 * $Scale
    $lines[214][1] = 74 * $Scale
    $lines[215][0] = 71 * $Scale
    $lines[215][1] = 75 * $Scale
    $lines[216][0] = 71 * $Scale
    $lines[216][1] = 76 * $Scale
    $lines[217][0] = 71 * $Scale
    $lines[217][1] = 77 * $Scale
    $lines[218][0] = 71 * $Scale
    $lines[218][1] = 78 * $Scale
    $lines[219][0] = 71 * $Scale
    $lines[219][1] = 79 * $Scale
    $lines[220][0] = 71 * $Scale
    $lines[220][1] = 80 * $Scale
    $lines[221][0] = 71 * $Scale
    $lines[221][1] = 81 * $Scale
    $lines[222][0] = 71 * $Scale
    $lines[222][1] = 82 * $Scale
    $lines[223][0] = 71 * $Scale
    $lines[223][1] = 83 * $Scale
    $lines[224][0] = 71 * $Scale
    $lines[224][1] = 84 * $Scale
    $lines[225][0] = 71 * $Scale
    $lines[225][1] = 85 * $Scale
    $lines[226][0] = 71 * $Scale
    $lines[226][1] = 86 * $Scale
    $lines[227][0] = 71 * $Scale
    $lines[227][1] = 87 * $Scale
    $lines[228][0] = 71 * $Scale
    $lines[228][1] = 88 * $Scale
    $lines[229][0] = 71 * $Scale
    $lines[229][1] = 89 * $Scale
    $lines[230][0] = 71 * $Scale
    $lines[230][1] = 90 * $Scale
    $lines[231][0] = 71 * $Scale
    $lines[231][1] = 91 * $Scale
    $lines[232][0] = 71 * $Scale
    $lines[232][1] = 92 * $Scale
    $lines[233][0] = 70 * $Scale
    $lines[233][1] = 93 * $Scale
    $lines[234][0] = 69 * $Scale
    $lines[234][1] = 93 * $Scale
    $lines[235][0] = 68 * $Scale
    $lines[235][1] = 94 * $Scale
    $lines[236][0] = 67 * $Scale
    $lines[236][1] = 95 * $Scale
    $lines[237][0] = 66 * $Scale
    $lines[237][1] = 95 * $Scale
    $lines[238][0] = 65 * $Scale
    $lines[238][1] = 96 * $Scale
    $lines[239][0] = 64 * $Scale
    $lines[239][1] = 96 * $Scale
    $lines[240][0] = 63 * $Scale
    $lines[240][1] = 97 * $Scale
    $lines[241][0] = 62 * $Scale
    $lines[241][1] = 97 * $Scale
    $lines[242][0] = 61 * $Scale
    $lines[242][1] = 98 * $Scale
    $lines[243][0] = 60 * $Scale
    $lines[243][1] = 98 * $Scale
    $lines[244][0] = 59 * $Scale
    $lines[244][1] = 98 * $Scale
    $lines[245][0] = 58 * $Scale
    $lines[245][1] = 99 * $Scale
    $lines[246][0] = 57 * $Scale
    $lines[246][1] = 99 * $Scale
    $lines[247][0] = 56 * $Scale
    $lines[247][1] = 99 * $Scale
    $lines[248][0] = 55 * $Scale
    $lines[248][1] = 100 * $Scale
    $lines[249][0] = 54 * $Scale
    $lines[249][1] = 100 * $Scale
    $lines[250][0] = 53 * $Scale
    $lines[250][1] = 100 * $Scale
    $lines[251][0] = 52 * $Scale
    $lines[251][1] = 100 * $Scale
    $lines[252][0] = 51 * $Scale
    $lines[252][1] = 100 * $Scale
    $lines[253][0] = 50 * $Scale
    $lines[253][1] = 101 * $Scale
    $lines[254][0] = 49 * $Scale
    $lines[254][1] = 101 * $Scale
    $lines[255][0] = 48 * $Scale
    $lines[255][1] = 101 * $Scale
    $lines[256][0] = 47 * $Scale
    $lines[256][1] = 101 * $Scale
    $lines[257][0] = 46 * $Scale
    $lines[257][1] = 101 * $Scale
    $lines[258][0] = 45 * $Scale
    $lines[258][1] = 101 * $Scale
    $lines[259][0] = 44 * $Scale
    $lines[259][1] = 101 * $Scale
    $lines[260][0] = 43 * $Scale
    $lines[260][1] = 101 * $Scale
    $lines[261][0] = 42 * $Scale
    $lines[261][1] = 101 * $Scale
    $lines[262][0] = 41 * $Scale
    $lines[262][1] = 101 * $Scale
    $lines[263][0] = 40 * $Scale
    $lines[263][1] = 101 * $Scale
    $lines[264][0] = 39 * $Scale
    $lines[264][1] = 101 * $Scale
    $lines[265][0] = 38 * $Scale
    $lines[265][1] = 100 * $Scale
    $lines[266][0] = 37 * $Scale
    $lines[266][1] = 100 * $Scale
    $lines[267][0] = 36 * $Scale
    $lines[267][1] = 100 * $Scale
    $lines[268][0] = 35 * $Scale
    $lines[268][1] = 100 * $Scale
    $lines[269][0] = 34 * $Scale
    $lines[269][1] = 100 * $Scale
    $lines[270][0] = 33 * $Scale
    $lines[270][1] = 99 * $Scale
    $lines[271][0] = 32 * $Scale
    $lines[271][1] = 99 * $Scale
    $lines[272][0] = 31 * $Scale
    $lines[272][1] = 99 * $Scale
    $lines[273][0] = 30 * $Scale
    $lines[273][1] = 98 * $Scale
    $lines[274][0] = 29 * $Scale
    $lines[274][1] = 98 * $Scale
    $lines[275][0] = 28 * $Scale
    $lines[275][1] = 97 * $Scale
    $lines[276][0] = 27 * $Scale
    $lines[276][1] = 97 * $Scale
    $lines[277][0] = 26 * $Scale
    $lines[277][1] = 96 * $Scale
    $lines[278][0] = 25 * $Scale
    $lines[278][1] = 96 * $Scale
    $lines[279][0] = 24 * $Scale
    $lines[279][1] = 95 * $Scale
    $lines[280][0] = 23 * $Scale
    $lines[280][1] = 94 * $Scale
    $lines[281][0] = 22 * $Scale
    $lines[281][1] = 93 * $Scale
    $lines[282][0] = 21 * $Scale
    $lines[282][1] = 92 * $Scale
    $lines[283][0] = 20 * $Scale
    $lines[283][1] = 91 * $Scale
    $lines[284][0] = 19 * $Scale
    $lines[284][1] = 90 * $Scale
    $lines[285][0] = 18 * $Scale
    $lines[285][1] = 89 * $Scale
    $lines[286][0] = 18 * $Scale
    $lines[286][1] = 88 * $Scale
    $lines[287][0] = 17 * $Scale
    $lines[287][1] = 87 * $Scale
    $lines[288][0] = 16 * $Scale
    $lines[288][1] = 86 * $Scale
    $lines[289][0] = 16 * $Scale
    $lines[289][1] = 85 * $Scale
    $lines[290][0] = 16 * $Scale
    $lines[290][1] = 84 * $Scale
    $lines[291][0] = 15 * $Scale
    $lines[291][1] = 83 * $Scale
    $lines[292][0] = 15 * $Scale
    $lines[292][1] = 82 * $Scale
    $lines[293][0] = 14 * $Scale
    $lines[293][1] = 81 * $Scale
    $lines[294][0] = 14 * $Scale
    $lines[294][1] = 80 * $Scale
    $lines[295][0] = 14 * $Scale
    $lines[295][1] = 79 * $Scale
    $lines[296][0] = 13 * $Scale
    $lines[296][1] = 78 * $Scale
    $lines[297][0] = 13 * $Scale
    $lines[297][1] = 77 * $Scale
    $lines[298][0] = 13 * $Scale
    $lines[298][1] = 76 * $Scale
    $lines[299][0] = 13 * $Scale
    $lines[299][1] = 75 * $Scale
    $lines[300][0] = 13 * $Scale
    $lines[300][1] = 74 * $Scale
    $lines[301][0] = 12 * $Scale
    $lines[301][1] = 73 * $Scale
    $lines[302][0] = 12 * $Scale
    $lines[302][1] = 72 * $Scale
    $lines[303][0] = 12 * $Scale
    $lines[303][1] = 71 * $Scale
    $lines[304][0] = 12 * $Scale
    $lines[304][1] = 70 * $Scale
    $lines[305][0] = 12 * $Scale
    $lines[305][1] = 69 * $Scale
    $lines[306][0] = 12 * $Scale
    $lines[306][1] = 68 * $Scale
    $lines[307][0] = 12 * $Scale
    $lines[307][1] = 67 * $Scale
    $lines[308][0] = 12 * $Scale
    $lines[308][1] = 66 * $Scale
    $lines[309][0] = 12 * $Scale
    $lines[309][1] = 65 * $Scale
    $lines[310][0] = 12 * $Scale
    $lines[310][1] = 64 * $Scale
    $lines[311][0] = 12 * $Scale
    $lines[311][1] = 63 * $Scale
    $lines[312][0] = 13 * $Scale
    $lines[312][1] = 62 * $Scale
    $lines[313][0] = 13 * $Scale
    $lines[313][1] = 61 * $Scale
    $lines[314][0] = 13 * $Scale
    $lines[314][1] = 60 * $Scale
    $lines[315][0] = 13 * $Scale
    $lines[315][1] = 59 * $Scale
    $lines[316][0] = 13 * $Scale
    $lines[316][1] = 58 * $Scale
    $lines[317][0] = 14 * $Scale
    $lines[317][1] = 57 * $Scale
    $lines[318][0] = 14 * $Scale
    $lines[318][1] = 56 * $Scale
    $lines[319][0] = 14 * $Scale
    $lines[319][1] = 55 * $Scale
    $lines[320][0] = 15 * $Scale
    $lines[320][1] = 54 * $Scale
    $lines[321][0] = 15 * $Scale
    $lines[321][1] = 53 * $Scale
    $lines[322][0] = 15 * $Scale
    $lines[322][1] = 52 * $Scale
    $lines[323][0] = 16 * $Scale
    $lines[323][1] = 51 * $Scale
    $lines[324][0] = 16 * $Scale
    $lines[324][1] = 50 * $Scale
    $lines[325][0] = 17 * $Scale
    $lines[325][1] = 49 * $Scale
    $lines[326][0] = 17 * $Scale
    $lines[326][1] = 48 * $Scale
    $lines[327][0] = 18 * $Scale
    $lines[327][1] = 47 * $Scale
    $lines[328][0] = 19 * $Scale
    $lines[328][1] = 46 * $Scale
    $lines[329][0] = 20 * $Scale
    $lines[329][1] = 45 * $Scale
    $lines[330][0] = 21 * $Scale
    $lines[330][1] = 44 * $Scale
    $lines[331][0] = 22 * $Scale
    $lines[331][1] = 43 * $Scale
    $lines[332][0] = 23 * $Scale
    $lines[332][1] = 42 * $Scale
    $lines[333][0] = 24 * $Scale
    $lines[333][1] = 41 * $Scale
    $lines[334][0] = 25 * $Scale
    $lines[334][1] = 40 * $Scale
    $lines[335][0] = 26 * $Scale
    $lines[335][1] = 40 * $Scale
    $lines[336][0] = 27 * $Scale
    $lines[336][1] = 39 * $Scale
    $lines[337][0] = 28 * $Scale
    $lines[337][1] = 38 * $Scale
    $lines[338][0] = 29 * $Scale
    $lines[338][1] = 38 * $Scale
    $lines[339][0] = 30 * $Scale
    $lines[339][1] = 37 * $Scale
    $lines[340][0] = 31 * $Scale
    $lines[340][1] = 37 * $Scale
    $lines[341][0] = 32 * $Scale
    $lines[341][1] = 37 * $Scale
    $lines[342][0] = 33 * $Scale
    $lines[342][1] = 36 * $Scale
    $lines[343][0] = 34 * $Scale
    $lines[343][1] = 36 * $Scale
    $lines[344][0] = 35 * $Scale
    $lines[344][1] = 36 * $Scale
    $lines[345][0] = 36 * $Scale
    $lines[345][1] = 36 * $Scale
    $lines[346][0] = 37 * $Scale
    $lines[346][1] = 36 * $Scale
    $lines[347][0] = 38 * $Scale
    $lines[347][1] = 35 * $Scale


    _GDIPlus_GraphicsDrawCurve ($hGraphic, $lines)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()

EndFunc   ;==>_Main

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

@Martin,

About the 1757-1759 event:

It's easier to notice bugs in otherone's code than in one's own I guess :)

I really need to get asleep now.

Good Night

GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

I haven't found the time (ie I've been wasting my time) to do much with the outliner so I'll post it anyway before it gets forgotten.

You need to choose a black and white image ideally for the script to find the outlines.

CODE

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.1

Author: A Greencan, martin

Name: ScanToLines_BW_Image.au3

Script Function: Scan BW Image

Creates an outline drawing.

1. Select an image

2. Choose Black or White to be removed

3. Scan the image and make an array of all remaining blocks, line by line

4. Totally useless, but who cares?

Use ONLY Black & White images with color depth of 1 bpp (only (almost) black and (almost) white are scanned for a good result)

Load a Black and White image (avoid images bigger than 300 x 300 because the generated code can be huge.

The more B/W alternation, the bigger the generated code

#ce ----------------------------------------------------------------------------

#NoTrayIcon

#include <GDIPlus.au3>

#include <WinAPI.au3>

#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Array.au3>

#include <StaticConstants.au3>

#include <Date.au3>

Global $Reducedby = 0

Global $toofar = 40;the square of the distance beyond which we assume the point is not the next one on the line.

Global Const $WS_EX_COMPOSITED = 0x2000000;stops the graphic refresh driving me nuts

$ImageName = FileOpenDialog("Select a Black & White image to be processed", @ScriptDir & "\", "Images (*.jpg;*.bmp)|All Files(*.*)", 1)

If @error Then

MsgBox(0, "", "No File chosen", 3)

Exit

EndIf

Local $ChangeText[2] = ['Black', 'White']

$iMsg = MsgBox(4, "Color option ", 'Erase the Black color' & @CR & 'No = Erase White (Negative effect)')

If $iMsg = 6 Then

$Erase_White = True

ElseIf $iMsg = 7 Then

$Erase_White = False

EndIf

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile($ImageName)

Opt("GUICloseOnESC", 1)

; get width and height of the image

Dim $iY, $iX

$iX = _GDIPlus_ImageGetWidth($hImage)

$iY = _GDIPlus_ImageGetHeight($hImage)

_GDIPlus_ImageDispose($hImage)

_GDIPlus_Shutdown()

Opt("PixelCoordMode", 2)

; Create GUI

$hGUI = GUICreate("Image", $iX, $iY * 2 + 40, (@DesktopWidth / 2) - $iX, (@DesktopHeight / 2) - $iY, -1, BitOr($WS_EX_TOPMOST,$WS_EX_COMPOSITED))

; and load the B/W image

GUICtrlCreatePic($ImageName, 0, 0, $iX, $iY)

$lab = GUICtrlCreatelabel("",0,$iY + 2,$iX - 4,36)

$gr1 = GUICtrlCreateGraphic(0,$iY+ 40, $iX, $iY)

GUICtrlSetBkColor(-1, 0xffffff)

;GUISetState()

GUICtrlSetColor(-1, 0)

GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00dd00)

GUISetState()

; make sure that the window is on top of all others

WinSetOnTop("Image", "", 1)

; Loop through the image and make an array of the white pixels because these are the ones that need to re-appear

Dim $PictArray[2 * ($iX + $iY)][3]

$iPA = 0

GUICtrlSetData($lab,"Scanning for edge points")

Opt("PixelCoordMode", 2)

; now scan the image

For $aY = 1 To $iY ; for each row

$previous_pixel = False

For $aX = 0 To $iX - 1 ; for each column

$Pixel_color = PixelGetColor($aX, $aY)

If ($Erase_White = True And $Pixel_color > 16610000) Or ($Erase_White = False And $Pixel_color < 100000) Then; almost white

;~ If $Pixel_color < 100000 Then ; almost black use thi if you want to remove the oposite color

If $previous_pixel = False Then

$first_pixel = $aX

$previous_pixel = True

EndIf

Else ; All other colors are considered as white, this is suposed to be a black and white image!

If $previous_pixel = True Then ; OK previous was a black area

$previous_pixel = False ; reset flag

; now fill the array

; parameters

; $nLeftRect - Specifies the x-coordinate of the upper-left corner of the region in logical units.

; $nTopRect - Specifies the y-coordinate of the upper-left corner of the region in logical units.

; $nRightRect - Specifies the x-coordinate of the lower-right corner of the region in logical units.

; $nBottomRect - Specifies the y-coordinate of the lower-right corner of the region in logical units.

;_ArrayAdd($PictArray, String($first_pixel) & "," & String($aY) & "," & String($aX - 1) & "," & String($aY))

$PictArray[$iPA][0] = $first_pixel

$PictArray[$iPA][1] = $aY

$PictArray[$iPA][2] = 0

$iPA += 1

If $iPA >= UBound($PictArray) - 20 Then ReDim $PictArray[$iPA + 40][3]

$PictArray[$iPA][0] = $aX - 1

$PictArray[$iPA][1] = $aY

$PictArray[$iPA][2] = 0

$iPA += 1

EndIf

EndIf

Next

; this is needed for last pixel being white

If $previous_pixel = True Then ; OK previous was a black area

$previous_pixel = False ; reset flag

$PictArray[$iPA][0] = $first_pixel

$PictArray[$iPA][1] = $aY

$PictArray[$iPA][2] = 0

$iPA += 1

If $iPA >= UBound($PictArray) - 20 Then ReDim $PictArray[$iPA + 40][3]

$PictArray[$iPA][0] = $aX - 1

$PictArray[$iPA][1] = $aY

$PictArray[$iPA][2] = 0

$iPA += 1

EndIf

;;ConsoleWrite(@CR)

Next

GUICtrlSetData($lab,"Scanning pass 2 for Edges")

;scan vertically

;many points will be duplicates so use AddNewPoints function

For $aX = 1 To $iX - 1 ; for each column

$previous_pixel = False

For $aY = 1 To $iY - 1 ; for each row

$Pixel_color = PixelGetColor($aX, $aY)

If ($Erase_White = True And $Pixel_color > 16610000) Or ($Erase_White = False And $Pixel_color < 100000) Then; almost white

If $previous_pixel = False Then

$first_pixel = $aY

$previous_pixel = True

EndIf

Else ; All other colors are considered as white, this is suposed to be a black and white image!

If $previous_pixel = True Then ; OK previous was a black area

$previous_pixel = False ; reset flag

; now fill the array

; parameters

; $nLeftRect - Specifies the x-coordinate of the upper-left corner of the region in logical units.

; $nTopRect - Specifies the y-coordinate of the upper-left corner of the region in logical units.

; $nRightRect - Specifies the x-coordinate of the lower-right corner of the region in logical units.

; $nBottomRect - Specifies the y-coordinate of the lower-right corner of the region in logical units.

AddNewPoints($aX,$first_pixel,$aX ,$aY- 1,$iPA,$PictArray)

EndIf

EndIf

Next

; this is needed for last pixel being white

If $previous_pixel = True Then ; OK previous was a black area

$previous_pixel = False ; reset flag

AddNewPoints($aX,$first_pixel,$aX ,$aY- 1,$iPA,$PictArray)

EndIf

;;ConsoleWrite(@CR)

Next

;GUIDelete($hGUI)

;$gui = GUICreate("outline", 600, 600, 200, 200);, -1, $WS_EX_COMPOSITED)

;GuiSwitch($gui)

ConsoleWrite("time started = " & _NowCalc() & @CRLF)

$ends = $PictArray;_GuiImageHole($gui, 0, 0, 500, 500)

;_ArrayDisplay($ends)

GUICtrlSetData($lab,"Searching points for enclosed shapes")

$segments = makelines($ends)

;_ArrayDisplay($segments)

ConsoleWrite("reduced no of point by " & $REducedby & @CRLF)

ConsoleWrite("time sfinished = " & _NowCalc() & @CRLF)

$newshape = True

$col = 1

For $k = 0 To UBound($segments) - 1

If $segments[$k][0] = -99 Then ; end of enclosed shape so start new one

$newshape = True

ConsoleWrite("starting new shape" & @CRLF)

Else

If $newshape Then

GUICtrlSetGraphic($gr1, $GUI_GR_MOVE, $segments[$k][0], $segments[$k][1])

$newshape = False

Else

GUICtrlSetGraphic($gr1, $GUI_GR_LINE, $segments[$k][0], $segments[$k][1])

EndIf

EndIf

Sleep(10)

GUICtrlSetGraphic($gr1, $GUI_GR_REFRESH)

Next

While GUIGetMsg() <> -3

Sleep(10)

WEnd

Func AddNewPoints($x1, $y1, $x2, $y2, ByRef $i, ByRef $arr)

If $i >= UBound($arr) - 20 Then ReDim $arr[$i + 40][3]

If nopoint($x1, $y1, $i, $arr) Then

$arr[$i][0] = $x1

$arr[$i][1] = $y1

$arr[$i][2] = 0

$iPA += 1

endIf

If nopoint($x2, $y2, $i, $arr) Then

$arr[$i][0] = $x2

$arr[$i][1] = $y2

$arr[$i][2] = 0

$iPA += 1

EndIf

EndFunc ;==>AddNewPoints

Func makelines($points);$array)

Dim $result[uBound($points) + 20][2]

$index = -1;element in the array $result we are building

$shapenum = 1

$lastpoint = -1

Do

ConsoleWrite("making shape number " & $shapenum & @CRLF)

if $shapenum = 1 Then

GUICtrlSetData($lab,"Searching for an enclosed shape")

Else

GUICtrlSetData($lab,"Found " & $shapenum - 1 & " shape(s). Searching for another")

EndIf

If $lastpoint <> -1 Then

$next = $lastpoint

Else

$next = -1

findstart($next, $points)

EndIf

If $next > -1 Then

;ConsoleWrite("$next = " & $next & "$index to use = " & $index & @CRLF)

$nowx = $points[$next][0]

$nowy = $points[$next][1]

$points[$next][2] = 1

$index += 1

$result[$index][0] = $nowx

$result[$index][1] = $nowy

$firstx = $nowx

$firsty = $nowy

$lastpoint = -1

$startElement = $index

ConsoleWrite("first x,y = " & $firstx & ', ' & $firsty & '. start element = ' & $startElement & @CRLF)

Do

$closest = 999999

$lastpoint = -1

For $p = 1 To UBound($points) - 1

If $points[$p][2] = 0 Then

$dist = (($nowx - $points[$p][0]) ^ 2) + (($nowy - $points[$p][1]) ^ 2)

If $dist < $closest Then;$dist < $toofar And

$posnear = $p

$closest = $dist

$lastpoint = $posnear

;If $dist < $toofar then $lastpoint = $posnear

;ConsoleWrite("didt = " & $dist & @CRLF)

EndIf

;ConsoleWrite("didt = " & $dist & @CRLF)

EndIf

Next

;ConsoleWrite("closest = " & $closest & @CRLF)

If $closest < $toofar Then

$index += 1

$result[$index][0] = $points[$posnear][0]

$result[$index][1] = $points[$posnear][1]

$points[$posnear][2] = 1

$nowx = $result[$index][0]

$nowy = $result[$index][1]

If $index - $startElement > 1 Then removeOnLinePoints($result, $index, $lastpoint)

EndIf

;ConsoleWrite("closest = " & $closest & @CRLF)

Until $closest >= $toofar

ConsoleWrite("last x,y = " & $result[$index][0] & ', ' & $result[$index][1] & @CRLF)

;If $lastpoint <> -1 Then

;calc distance to the start of the line

$tostart = ($firstx - $result[$index][0]) ^ 2 + ($firsty - $result[$index][1]) ^ 2

;ConsoleWrite("to start from last = " & $tostart & @CRLF)

If $tostart < $toofar Then

$index += 1

ReDim $result[uBound($result) + 1][2]

$result[$index][0] = $firstx

$result[$index][1] = $firsty

EndIf

;EndIf

$index += 1

ReDim $result[uBound($result) + 1][2]

$result[$index][0] = -99;mark end of line

ConsoleWrite("element = " & $index & @CRLF)

ConsoleWrite("ended section with -99" & @CRLF)

Else

ExitLoop

EndIf

$shapenum += 1

Until $firstx = -1

;ConsoleWrite("index = " & $index & @CRLF)

ReDim $result[$index + 1][2]

GUICtrlSetData($lab,"finishing seatrching for shapes")

Return $result

EndFunc ;==>makelines

Func nopoint($x, $y, $i, $ar)

Local $g

For $g = 0 To $i - 1

If ($x = $ar[$g][0] And $y = $ar[$g][1]) Then Return False;the point alreday exists

Next

Return True;no such point exists yet

EndFunc ;==>nopoint

Func removeOnLinePoints(ByRef $array, ByRef $i, ByRef $lp)

$reduce = False

If ($array[$i - 1][1] = $array[$i - 2][1] and $array[$i - 1][1] = $array[$i][1]) Or _

($array[$i - 1][0] = $array[$i - 2][0] and $array[$i - 1][0] = $array[$i][0]) Then

$reduce = True;because we are on a straight line

Else;

If ($array[$i][1] - $array[$i - 2][1]) / ($array[$i][0] - $array[$i - 2][0]) = _

($array[$i][1] - $array[$i - 1][1]) / ($array[$i][0] - $array[$i - 1][0]) Then

$reduce = True

;ConsoleWrite("slope reducer :" & $array[$i][1] & ', ' & $array[$i - 1][1] & ', ' & $array[$i - 2][1] & @CRLF)

;ConsoleWrite("slope reducer :" & $array[$i][0] & ', ' & $array[$i - 1][0] & ', ' & $array[$i - 2][0] & @CRLF)

EndIf

EndIf

If $reduce Then

$Reducedby += 1

$array[$i - 1][0] = $array[$i][0]

$array[$i - 1][1] = $array[$i][1]

$i -= 1

Else

$lp = $i; shift start of possible line up one place

EndIf

EndFunc ;==>removeOnLinePoints

;find the

Func findstart(ByRef $freepoint, $arrayxy)

For $j = 0 To UBound($arrayxy) - 1

If $arrayxy[$j][2] = 0 Then;this point not used yet

$freepoint = $j

Return True

EndIf

Next

Return False

EndFunc ;==>findstart

I used a codebox because the script is a bit long, but unfortunately the formatting will disappear.

This sort of project could go on and on, but I doubt it's really any use at all. It was fun for a while though.

Edit: Fixed probelm with RemoveOnLinePoints function.(2nd attempt)

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi Martin,

Your script is very nice. I like your approach and I'll see how I can enhance it.

Congrats for your original idea.

Greetz

GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

Hi Martin,

Your script is very nice. I like your approach and I'll see how I can enhance it.

Congrats for your original idea.

Greetz

GreenCan

I look forward to see what you can produce.

Meanwhile, here is a special version. It needs the file "pencil.bmp" in the same folder as the script, and the "greencan.bmp" is an example to try.

outliner.au3

pencil.bmp

EDIT:Outliner changed to save desktop space 13th Jan 2009

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

haha,

That is funny.

Well done Martin, so you're still busy with it, don't you?

I must admit that the quality of the writing is very good, 'It' is a much better calligrapher than I am. I write like a doctor...

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Link to comment
Share on other sites

wow.

ok for complex images, but for simple ones ? :)

this question can be understood as stupid but i've sub-question.

can i put over a running program (eg: skype) a perforated GUI that let see

only what I want ? (both gui must move in same directions)

thank you for reply, and maybe some example code.

m.

Link to comment
Share on other sites

wow.

ok for complex images, but for simple ones ? :)

this question can be understood as stupid but i've sub-question.

can i put over a running program (eg: skype) a perforated GUI that let see

only what I want ? (both gui must move in same directions)

thank you for reply, and maybe some example code.

m.

Sure!!! ... Just print it, cut it out, and hold it over the screen!!!

:o

8)

NEWHeader1.png

Link to comment
Share on other sites

I do see searching is spelt seatrching in finishing seatrching for shapes lol. Then it sits there.... maybe I picked to complex of an image. I like the pics martin has of his output. They look like waterjet programs.

Edit: it also makes it too tall for my screen. could you make it side by side?

Edited by youknowwho4eva

Giggity

Link to comment
Share on other sites

I do see searching is spelt seatrching in finishing seatrching for shapes lol. Then it sits there.... maybe I picked to complex of an image. I like the pics martin has of his output. They look like waterjet programs.

Edit: it also makes it too tall for my screen. could you make it side by side?

Speljing isn't won of my string points!

I have made the script so that the drawing is in a different window, see post #25.

If you have a complicated design then it could take a very long time.

Can you give me an example of something you have tried?

If you took a photo of an object with a good resolution camera then you could get an accuaracy of 1 part in 3000 say, so for something 3m x 3 m you could cut it out with a water jet cutter to an accuarcy of +/- 1mm. (Assuming you had some way to allow for perspective distortion like a standard rectangle placed on the object.)

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

ehm,

i'm here again. so is not possible use this script to create a GUI (always on top)

that partially hide program under it and let see only what i want ?

(related also to an old post [Hole in a GUI])

thank you, and sorry for bad english :)

m.

I don't see why not. What problem have you had?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

no problem but solution :)

find your script wonderfull.

need to hide some part of skype GUI to my grandmother.

She's scared from computer but i want that my family keep in touch,

so i put a computer in her house. Final goal is to give her simplest GUI possible.

with only video and 2 button visible and pressable (<- this word exists ?) :o

thank you for any help,

m.

Link to comment
Share on other sites

some raw code to explain better

open notepad and run script :

(remember to change $size = WinGetPos("Senza nome - Blocco note")

with your notepad language windows name)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

dim $old_x = 0, $old_y = 0, $old_width = 0, $old_height = 0

while 1
    $size = WinGetPos("Senza nome - Blocco note")
    _follow_me()
    sleep(500)
WEnd


Func _follow_me()

    
    if $old_x <> $size[0] or $old_y <> $size[1] or $old_width <> $size[2] or $old_height <> $size[3] then
        GUISetState(@SW_HIDE)
        
    ;~  WinMove("Senza nome - Blocco note", "", $size[0], $size[0], $size[0], $size[0])
        $gui = GUICreate("Background", $size[2], $size[3] - 50, $size[0], $size[1] + 25)

        GUISetState(@SW_SHOW)
        WinSetOnTop("Background", "", 1)

        $old_x = $size[0]
        $old_y = $size[1]
        $old_width = $size[2]
        $old_height = $size[3]

    endif


EndFunc

a GUI follow notepad window and hide it.

My idea is to create holes (cirlce, square, etc..) that allow user to use only small portion of hide program.

m.

Link to comment
Share on other sites

some raw code to explain better

open notepad and run script :

(remember to change $size = WinGetPos("Senza nome - Blocco note")

with your notepad language windows name)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

dim $old_x = 0, $old_y = 0, $old_width = 0, $old_height = 0

while 1
    $size = WinGetPos("Senza nome - Blocco note")
    _follow_me()
    sleep(500)
WEnd


Func _follow_me()

    
    if $old_x <> $size[0] or $old_y <> $size[1] or $old_width <> $size[2] or $old_height <> $size[3] then
        GUISetState(@SW_HIDE)
        
;~  WinMove("Senza nome - Blocco note", "", $size[0], $size[0], $size[0], $size[0])
        $gui = GUICreate("Background", $size[2], $size[3] - 50, $size[0], $size[1] + 25)

        GUISetState(@SW_SHOW)
        WinSetOnTop("Background", "", 1)

        $old_x = $size[0]
        $old_y = $size[1]
        $old_width = $size[2]
        $old_height = $size[3]

    endif


EndFunc

a GUI follow notepad window and hide it.

My idea is to create holes (cirlce, square, etc..) that allow user to use only small portion of hide program.

m.

Is the application you want to cover specially written or is it running in a browser? Could you apply the mask to the application rather than another window which covers it?

What has stopped you making the window you want with the holes cut out?

Perhaps this would suit you better?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I thought this was an interesting test. I tried a black and white image of Tesla, and it appears it never found any shapes. Which could be why it didn't work.

The bmp you showed is difficult to deal with though I agree it's an interesting test. The script was only meant to deal with high contrast monochrome so the results are not surprising.

It should find shapes in a any black and white image, but what's a Tesla (apart from a unit of magnetic field strength)?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Marty thank you for reply.

try to reply your questions to define request:

Is the application you want to cover specially written or is it running in a browser?

i need only for Skype

(but think idea is usefull to create script to cover most applications...)

Could you apply the mask to the application rather than another window which covers it?

think yes, but think also to personalize GUI to cover only one application

What has stopped you making the window you want with the holes cut out?

my ignorance :)

thank you for your time,

m.

Link to comment
Share on other sites

Tesla is the man that developed the unit of magnetic field strength :) Nicoli Tesla. I knew it was better for monochrome, but I wanted to see how it would come out, and I like the unique results.

It doesn't work with that, but if the picture is sharpened a bit it does a reasonable job.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...