| |
|
|
p.specht
| O-Text Jonathan:
These code-shred can certainly someone use:
is ne simple routine, with the one on one . Develop as the Mainwindow one TrackMenu create can. MenuItem() functions so How had.
If one in a Program many Images draw and these not over ands over again from the Festplatte loaded go should, one but too no pleasure has, each Image at the beginning particularly To loading, can these routines take:
'to that Puffern of Images
Declare BufferedImageFiles$'list the already gepufferten Images, separated through "|"
Declare hBufferedImages&[]'Handles the gepufferten Images
SubProc Create.hPicBuffered
Parameters Typ&, s$
Declare NewImg&
If @Len(BufferedImageFiles$) = 0
BufferedImageFiles$ = "|"
EndIf
If Typ& = -1
Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))
BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)
EndIf
NewImg& = @Create("hPicCopy", hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])
Else
NewImg& = @Create("HPIC", Typ&, s$)
EndIf
Return NewImg&
ENDPROC
SubProc Create.hSizedPicBuffered
Parameters Typ&, s$, X&, Y&, N&
Declare NewImg&, XN&, YN&, factor1!, factor2!
If @Len(BufferedImageFiles$) = 0
BufferedImageFiles$ = "|"
EndIf
If Typ& = -1
Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))
BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)
EndIf
If N& = 1
factor1! = X& / @Width(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])
factor2! = Y& / @Height(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))])
If factor1! < factor2!
XN& = X&
YN& = @Height(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))]) * factor1!
Else
XN& = @Width(hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))]) * factor2!
YN& = Y&
EndIf
Else
XN& = X&
YN& = Y&
EndIf
NewImg& = @Create("hNewPic", XN&, YN&, 0)
StartPaint NewImg&
DrawSizedPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], 0, 0 - XN&, YN&; 0
EndPaint
Else
NewImg& = @Create("hSizedPic", Typ&, s$, X&, Y&, N&)
EndIf
Return NewImg&
ENDPROC
Proc DrawSizedPicBuffered
Parameters s$, X&, Y&, DX&, DY&, N&
If @Len(BufferedImageFiles$) = 0
BufferedImageFiles$ = "|"
EndIf
Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))
BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)
EndIf
DrawSizedPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], X&, Y& - DX&, DY&; N&
ENDPROC
Proc DrawPicBuffered
Parameters s$, X&, Y&, N&
If @Len(BufferedImageFiles$) = 0
BufferedImageFiles$ = "|"
EndIf
Ifnot @InStr("|" + @Upper $(s$) + "|", @Upper $(BufferedImageFiles$))
BufferedImageFiles$ = BufferedImageFiles$ + s$ + "|"
hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))] = @Create("HPIC", -1, s$)
EndIf
DrawPic hBufferedImages&[@InStr('|' + @Upper$(s$) + '|', @Upper$(BufferedImageFiles$))], X&, Y&; N&
ENDPROC
Proc DeleteImageBuffer
WhileLoop 0, @SizeOf(hBufferedImages&[]) - 1
If hBufferedImages&[&loop]
DeleteObject hBufferedImages&[&loop]
EndIf
EndWhile
ENDPROC
The Procs supplant Create("HPIC"), Create("hSizedPic"), DrawPic and DrawSizedPic in her shape to that loading of Images from the Festplatte. becomes one Image to that first time loaded, loading these routines the image into RAM and keep there a copy of it. becomes the image anew loaded, becomes The copy in the RAM using and not again from the Festplatte loaded. on the end ought to one DeleteImageBuffer not forget, so The whole Handles the copies again released go.
Greeting Jonathan |
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 06/12/21 ▲ |
|
|
|