Je l'avais publié en Août 2007.
Code : Tout sélectionner
En-tête }
;{ Déclarations nécessaires }
Declare.L CreateAlphaImage(W.L, H.L)
;}
;{ Macros }
;(ou procédures inacceptées actuellement en tant que macro)
Macro AlphaRGBCorrect(A, R, G, B)
If R > A: R = A: EndIf
If G > A: G = A: EndIf
If B > A: B = A: EndIf
EndMacro
Macro Argb(A, R, G, B)
((((A << 24) + (R << 16) ) + (G << 8) ) + B)
EndMacro
Procedure DrawLocate(x.L, y.L, *p)
*Adr = *p + (8 + (((y * PeekL(*p) ) + x) * 4) )
ProcedureReturn *Adr
EndProcedure
Macro Events(a = WEvent, b = EWindow)
a = WaitWindowEvent()
b = EventWindow()
EndMacro
Macro OnlyExitProcess(a)
Select WEvent
Case #WM_CLOSE, #WM_KEYDOWN
a = 2
Case #WM_RBUTTONDOWN
a = 1
Case #WM_RBUTTONUP
If a = 1
a = 2
EndIf
EndSelect
EndMacro
;}
;{ Structures }
Structure APIX ; Cf Procédures >> Alphablending
Alpha.B
Red.B
Green.B
Blue.B
EndStructure
Structure BBL
W.L
H.L
*Skin ; Pointeur vers les ImageIDs du Skin
EndStructure
Structure LW ; Cf Procédures >> Alphablending
WindowID.L ; Handle du DC de la fenêtre translucide
(WindowID)
*ptWnd ;#Pointe vers une structure POINT
(Position de la fenêtre, 0 = inchangée)
*szWnd ;#Pointe vers une structure SIZE (Taille
de la fenêtre, 0 = inchangée)
hdcAIm.L ; Handle du DC source (Image Alpha)
*ptAIm ;#Pointe vers une structure POINT
crKey.L ; Couleur clé (transparence)
*Blend ;#Pointe vers la structure BLENDFUNCTION
(fBlend plus bas)
*AImArea ;#Pointe vers 1 struc RECT spécifiant la
zone à copier depuis le DC source
X.L ; Coordonnées X de la fenêtre
Y.L ; Coordonnées Y de la fenêtre
W.L ; Largeur de la fenêtre
H.L ; Hauteur de la fenêtre
XA.L ; Coordonnées X dans l'image
YA.L ; Coordonnées Y dans l'image
fBlend.L ; Fonction Blend (toujours $1FF0000)
X1.L ; Vista
Y1.L ; Vista
X2.L ; Vista
Y2.L ; Vista
Window.L ; n° de fenêtre
ImageID.L ; ID de l'image
LWin.L
Bubble.L
; VX.F
; VY.F
; AA.F
; V.F
; Flip.L
EndStructure
Structure StringAreaStruc ; Cf Procédures >> Gestion des structures
AreaStringQty.L
AreaOffset.L
EndStructure
;}
;{ Procédures }
;{ Bureau }
Procedure BorderlessImage(ImageID.L) ; Visionner immédiatement une image
Protected Bmp.BITMAP
GetObject_(ImageID, SizeOf(BITMAP), @Bmp)
Protected W = Bmp\BmWidth
Protected H = Bmp\BmHeight
Protected Window.L = OpenWindow(-1, 0, 0, W, H, "", $80000000)
StartDrawing(WindowOutput(Window) )
DrawImage(ImageID, 0, 0)
StopDrawing()
Repeat
Events()
OnlyExitProcess(Quit)
Until Quit = 2
CloseWindow(Window)
EndProcedure
;}
;{ Maths }
Procedure.L ValHex(H.S)
Protected V.L
H = UCase(H)
a = Asc( Left(H, 1) ) - 48: If a > 16: a - 7: EndIf
b = Asc(Right(H, 1) ) - 48: If b > 16: b - 7: EndIf
V = 16 * a + b
ProcedureReturn V
EndProcedure
Procedure.f ATanFull(y.f, x.f) ;[0, 2Pi[ ; (Merci Dr Dri :)
!FLD dword [p.v_y]
!FLD dword [p.v_x]
!FPATAN
;l'angle est négatif ?
!FLDZ
!FCOMP
!FNSTSW ax
!TEST ah, $41
!JNE l_atanfull_ok
;on lui ajoute 2Pi
!FLDPI
!FADD st, st
!FADDP
atanfull_ok:
!RET 8
EndProcedure
;}
;{ Générateurs graphiques }
Procedure.L Lactee(Size.L, P0.F, P1.F, P2.F, D0.F, D1.F, D2.F,
Rotation.F, CR.F, CV.F, CB.F)
Protected Img.L
Protected Rn.F
Protected X1.L
Protected Y1.L
Protected X2.L
Protected Y2.L
Protected CX.L
Protected CY.L
Protected x.L
Protected y.L
Protected Dist.L
Protected ADist.F
Protected R.F
Protected V.F
Protected B.F
Protected Distf.F
Protected IDist.L
Protected IDistf.F
Protected G.L
Img = CreateImage(-1, Size, Size)
Rn = Size / 2
X1 = -Rn
X2 = Rn
Y1 = -Rn
Y2 = Rn
CX = Rn
CY = Rn
StartDrawing(ImageOutput(Img) )
For y = Y1 To Y2
For x = X1 To X2
Dist = Sqr(x * x + y * y)
ADist = ((Dist * 2) / Rn * #PI) * Rotation
R = (128 + Sin(Atanfull(x, y) * D0 + P0 + ADist) * 127) *
CR
V = (128 + Sin(Atanfull(x, y) * D1 + P1 + ADist) * 127) *
CV
B = (128 + Sin(Atanfull(x, y) * D2 + P2 + ADist) * 127) *
CB
Distf = Dist
DistF / Rn
IDistF = ((2 * Rn) - Distf) / (2 * Rn)
IDist = Dist
G = Dist * 2
If R < G: R = G: EndIf
If v < G: v = G: EndIf
If b < G: b = G: EndIf
If Dist > Rn
R = 0
V = 0
B = 0
EndIf
Color = RGB(R, V, B)
Plot(CX + x, CY + y, Color)
Next
Next
StopDrawing()
ProcedureReturn Img
EndProcedure
;}
;{ Alphablending }
;{ Image Alpha }
Procedure AlphaBox(X1.L, Y1.L, X2.L, Y2.L, AC.L, *AIm)
For iy = Y1 To Y2
For ix = X1 To X2
PokeL(DrawLocate(ix, iy, *AIm), AC)
Next
Next
EndProcedure
Procedure AlphaColorCorrect(C.L)
Protected RA.L = (C & $FF000000) >> 24
Protected RB.L = (C & $00FF0000) >> 16
Protected RC.L = (C & $0000FF00) >> 8
Protected RD.L = (C & $000000FF) >> 0
If RB > RA: RB = RA: EndIf
If RC > RA: RC = RA: EndIf
If RD > RA: RD = RA: EndIf
Protected EC.L = Argb(RA, RB, RC, RD)
ProcedureReturn EC
EndProcedure
Procedure AlphaBlendColor(C1.L, C2.L)
Protected C.L
Protected A.L
Protected R.L
Protected G.L
Protected B.L
Protected Alpha.F
Protected Red.F
Protected Green.F
Protected Blue.F
Protected A1.F
Protected R1.F
Protected G1.F
Protected B1.F
Protected A2.F
Protected R2.F
Protected G2.F
Protected B2.F
A = (C1 & $FF000000) >> 24
R = (C1 & $FF0000) >> 16
G = (C1 & $FF00) >> 8
B = C1 & $FF
A1 = A
R1 = R
G1 = G
B1 = B
A = (C2 & $FF000000) >> 24
R = (C2 & $FF0000) >> 16
G = (C2 & $FF00) >> 8
B = C2 & $FF
A2 = A
R2 = R
G2 = G
B2 = B
Alpha = (A1 + A2)
Red = (R1 * A1 + R2 * A2) / Alpha
Green = (G1 * A1 + G2 * A2) / Alpha
Blue = (B1 * A1 + B2 * A2) / Alpha
Alpha / 2
A = Alpha
R = Red
G = Green
B = Blue
C = AlphaColorCorrect(ARGB(A, R, G, B) )
ProcedureReturn C
EndProcedure
Procedure AlphaBlendPixel(x.L, y.L, *AIm, C2.L) ; Mélange le pixel d'une
image alpha avec une couleur
Protected C1.L
Protected *Adr
*Adr = DrawLocate(x, y, *AIm)
C1 = PeekL(*Adr)
PokeL(*Adr, AlphaBlendColor(C1, C2) )
EndProcedure
Procedure AlphaText(x.L, y.L, String.S, *AIm, C.L)
Protected Tmp.L
Protected i.L
Protected Fin.L
Protected A.S
Protected Dx.L
Protected Dy.L
Protected ix.L
Protected iy.L
Protected ShiftX.L
Tmp = CreateImage(-1, 64, 64)
Fin = Len(String)
StartDrawing(ImageOutput(Tmp) )
ShiftX = 0
For i = 1 To Fin
A = Mid(String, i, 1)
DrawText(0, 0, A, #Black, #White)
Dx = TextWidth(A)
Dy = TextHeight(A)
For iy = 0 To Dy - 1
For ix = 0 To Dx - 1
If Point(ix, iy) = 0
Col = C | ((iy * 16) << 16)
PokeL(DrawLocate(ShiftX + ix + x, iy + y, *AIm),
Col)
EndIf
Next
Next
ShiftX + Dx
Next
StopDrawing()
FreeImage(Tmp)
EndProcedure
Procedure AlphaRect(X1.L, Y1.L, X2.L, Y2.L, AC.L, *AIm)
For ix = X1 To X2
PokeL(DrawLocate(ix, Y1, *AIm), AC)
PokeL(DrawLocate(ix, Y2, *AIm), AC)
Next
For iy = Y1 To Y2
PokeL(DrawLocate(X1, iy, *AIm), AC)
PokeL(DrawLocate(X2, iy, *AIm), AC)
Next
EndProcedure
Procedure AlphaBlendRect(X1.L, Y1.L, X2.L, Y2.L, AC.L, *AIm)
For ix = X1 To X2
AlphaBlendPixel(ix, Y1, *AIm, AC)
AlphaBlendPixel(ix, Y2, *AIm, AC)
Next
For iy = Y1 To Y2
AlphaBlendPixel(X1, iy, *AIm, AC)
AlphaBlendPixel(X2, iy, *AIm, AC)
Next
EndProcedure
Procedure.L CatchBubble(Size.L, P0.F, P1.F, P2.F, D0.F, D1.F, D2.F,
Rotation.F, CR.F, CV.F, CB.F)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Récupère le skin 'Lactee' et lui fait subir un effet de transparence
; sur le principe d'une bulle
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Protected Img.L
Protected W.L
Protected H.L
Protected TT.F
Img = Lactee(Size, P0, P1, P2, D0, D1, D2, Rotation, CR, CV, CB)
W = ImageWidth(Img)
H = ImageHeight(Img)
*Alpha = CreateAlphaImage(W, H)
*Adr = DrawLocate(0, 0, *Alpha)
StartDrawing(ImageOutput(Img) )
For y = 0 To H - 1
For x = 0 To W - 1
*Adr = DrawLocate(x, y, *Alpha)
c = Point(x, y)
If c = 0
PokeL(*Adr, Argb(0, 1, 1, 1) )
Else
r.L = (c & $FF)
g.L = (c & $FF00) >> 8
b.L = (c & $FF0000) >> 16
dx.F = x - (W / 2)
dy.F = y - (H / 2)
Dist.F = Sqr(dx*dx + dy*dy)
Alpha.F = 2 * Dist / W
If Dist > ((W / 2) - 2)
Alpha / (Pow(2, (Dist - (W/2) ) + 2) )
;Alpha = 0
r = 0
g = 0
b = 0
EndIf
A.L = Alpha * 255
AlphaRGBCorrect(A, R, G, B)
PokeL(*Adr, Argb(A, r, g, b) )
EndIf
Next
Next
StopDrawing()
ProcedureReturn *Alpha
EndProcedure
Procedure.L CatchAlphaImage(*lpvBits)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Crée une image Alpha de 32 bits de profondeur à partir d'une zone mémoire
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Entrée Adresse pointant sur l'image
; ¯¯¯¯¯¯
; Sortie Retourne le handle de l'image (= ImageID)
; ¯¯¯¯¯¯
; Remarque La zone mémoire doit posséder une en-tête dont la structure est
; ¯¯¯¯¯¯¯¯ comme suit:
; ___________________________
; | $0 | Largeur de l'image |
; | $4 | Hauteur de l'image |
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Protected nWidth.L = PeekL(*lpvBits)
Protected nHeight.L = PeekL(*lpvBits + 4)
Protected AlphaImage.L = CreateBitmap_(nWidth, nHeight, 1, 32, *lpvBits
+ 8)
ProcedureReturn AlphaImage
EndProcedure
Procedure CopyAlphaImage(*Src, X1.L, Y1.L, X2.L, Y2.L, *Dst, X.L, Y.L)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Copie la zone spécifiée d'une image alpha dans une autre image alpha
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Entrées : *Src = Pointeur de l'image alpha source
; ¯¯¯¯¯¯¯ X1 = Coordonnées de la zone à copier
; Y1 = Idem
; X2 = Idem
; Y2 = Idem
; *Dst = Pointeur de l'image alpha destination
; X = Position de la zone copiée dans l'image destination
; Y = Idem
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
For SrcY = Y1 To Y2
For SrcX = X1 To X2
*Dest = DrawLocate(SrcX + X - X1, SrcY + Y - Y1, *Dst)
*Srce = DrawLocate(SrcX, SrcY, *Src)
PokeL(*Dest, PeekL(*Srce) )
Next
Next
EndProcedure
Procedure.L CreateAlphaImage(W.L, H.L)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Crée une zone mémoire pour l'édition d'une image Alpha
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Entrées W (LONG) Largeur de l'image
; ¯¯¯¯¯¯¯ H (LONG) Hauteur de l'image
;
; Sortie Retourne l'adresse pointant sur l'image
; ¯¯¯¯¯¯
; Remarque L'image possède une en-tête dont la structure est comme suit:
; ¯¯¯¯¯¯¯¯ ___________________________
; | $0 | Largeur de l'image |
; | $4 | Hauteur de l'image |
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*Alpha = AllocateMemory(((W * H) << 2) + 8)
PokeL(*Alpha, W)
PokeL(*Alpha + 4, H)
ProcedureReturn *Alpha
EndProcedure
;}
;{ LayeredWindow }
Procedure BorderLW(*Src, *LW, BackColor.L)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Crée une bordure en fonction d'une image alpha source (pointée par *Src)
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Ce dernier est divisé en 4 parties rectangulaires :
; >> haut gauche
; >> haut droit
; >> bas gauche
; >> bas droit
;
; Actuellement cette procédure est liée à CreateLW()
; Pour l'utiliser, préparer 1 zone mémoire ayant la structure d'une image
; alpha. Et préciser juste les largeur et hauteur du bitmap destination
; pointé par *LW
; Si un motif alpha est dessiné dans le bitmap (image de fond de la
; fenêtre), il sera effacé (BackColor) donc inscrire ce motif APRES appel
; de cette procédure.
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Protected Color.L
Protected SrcW.L
Protected SrcH.L
SrcW = PeekL(*Src)
SrcH = PeekL(*Src + 4)
W = PeekL(*LW)
H = PeekL(*LW + 4)
CopyAlphaImage(*Src, 0, 0, SrcW / 2 - 1, SrcH / 2 - 1, *LW, 0, 0)
For i = SrcW / 2 To (W - (SrcW / 2) ) - 2
CopyAlphaImage(*Src, SrcW / 2, 0, SrcW / 2, SrcH / 2 - 1, *LW, i,
0)
Next
CopyAlphaImage(*Src, SrcW / 2, 0, SrcW - 1, SrcH / 2 - 1, *LW, (W -
(SrcW / 2) ) - 1, 0)
For i = SrcH / 2 To (H - (SrcH / 2) ) - 2
CopyAlphaImage(*Src, 0, SrcH / 2, SrcW / 2 - 1, SrcH / 2, *LW, 0,
i)
Next
For i = SrcH / 2 To (H - (SrcH / 2) ) - 2
CopyAlphaImage(*Src, SrcW / 2, SrcH / 2, SrcW - 1, SrcH / 2, *LW,
(W - (SrcW / 2) ) - 1, i)
Next
CopyAlphaImage(*Src, 0, SrcH / 2, SrcW / 2 - 1, SrcH - 1, *LW, 0, (H -
(SrcH / 2) ) - 1)
For i = SrcW / 2 To (W - (SrcW / 2) ) - 2
CopyAlphaImage(*Src, SrcW / 2, SrcH / 2, SrcW / 2, SrcH - 1, *LW,
i, (H - (SrcH / 2) ) - 1)
Next
CopyAlphaImage(*Src, SrcW / 2, SrcH / 2, SrcW - 1, SrcH - 1, *LW, (W -
(SrcW / 2) ) - 1, (H - (SrcH / 2) ) - 1)
AlphaBox(SrcW / 2, SrcH / 2, (W - (SrcW / 2) ) - 1, (H - (SrcH / 2) )
- 1, BackColor, *LW)
For i = 0 To 7
Color = (BackColor & $FFFFFF) | (((8 - i) << 5) << 24)
Color = AlphaColorCorrect(Color)
If i = 0: Color = -1: EndIf
AlphaBlendRect(SrcW / 2 - i, SrcH / 2 - i, (W - (SrcW / 2) ) - 1
+ i, (H - (SrcH / 2) ) - 1 + i, Color, *LW)
Next
EndProcedure
Procedure CloseLW(*LW.LW)
With *LW
KillTimer_(WindowID(\Window), 0)
CloseWindow(\Window)
DeleteObject_(\LWin)
FreeMemory(\Bubble)
EndWith
EndProcedure
Procedure HideLW(*LW.LW, Stat.L)
With *LW
HideWindow(\Window, Stat)
EndWith
EndProcedure
Procedure LayeredWindow(Window.L, Stat.L)
Protected NewFlag.L = GetWindowLong_(WindowID(Window), #GWL_EXSTYLE) |
(#WS_EX_LAYERED * Stat)
SetWindowLong_(WindowID(Window), #GWL_EXSTYLE, NewFlag)
EndProcedure
Procedure MoveLW(Window.L, *Coord.POINT)
Static OldCoord.POINT
With *Coord
ResizeWindow(Window, \X, \Y, #PB_Ignore, #PB_Ignore)
EndWith
EndProcedure
Procedure OpenLW(*LW.LW, X, Y, ImageID)
Protected Bmp.BITMAP
Protected PosiSrc.POINT
With *LW
; \VX = X
; \VY = Y
\ImageID = ImageID
GetObject_(\ImageID, SizeOf(BITMAP), @Bmp)
\W = Bmp\BmWidth
\H = Bmp\BmHeight
\Window = OpenWindow(-1, X, Y, W, H, "", $90000000)
\WindowID = WindowID(\Window)
If \Window
StickyWindow(\Window, 1)
LayeredWindow(\Window, 1)
\hdcAIm = CreateCompatibleDC_(StartDrawing(WindowOutput
(\Window) ) )
SelectObject_(\hdcAIm, \ImageID)
Blend.L = $1FF0000
Result.L = UpdateLayeredWindow_(\WindowID, 0, 0, @\W,
\HdcAIm, PosiSrc, 0, @Blend, 2)
StopDrawing()
DeleteDC_(\hdcAIm)
HideWindow(\Window, 0)
EndIf
If Result = 0: CloseWindow(\Window): EndIf
EndWith
ProcedureReturn Result
EndProcedure
Procedure CreateLW(*TestLW.LW, X.L, Y.L, W.L, H.L, Size.L, P0.F, P1.F,
P2.F, D0.F, D1.F, D2.F, Rotation.F, CR.F, CV.F, CB.F, BackColor.L)
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; Cette procédure ouvre une fenêtre à transparence hétérogène
; Le seul skin actuel est surnommé «Lactee»
;
; *TestLW : Pointe vers une structure LW
; Il n'y a rien à préciser en entrée, juste créer cette
structure
; pour que les ressources nécessaires à la fenêtre y soient
; stockées
; X.L : Coordonnée X de la fenêtre
; Y.L : Coordonnée Y de la fenêtre
; W.L : Largeur de la fenêtre
; H.L : Hauteur de la fenêtre
; Size.L : Epaisseur de la bordure
; P0.F : Décalage angulaire de la couleur rouge (en radians)
; P1.F : Décalage angulaire de la couleur vert (en radians)
; P2.F : Décalage angulaire de la couleur bleu (en radians)
; D0.F : Coefficient angulaire pour la couleur rouge
; D1.F : Coefficient angulaire pour la couleur vert
; D2.F : Coefficient angulaire pour la couleur bleu
; Rotation : Coefficient de rotation des spires colorées
; 0.0 = Radial
; 1.0 = Spirale
; 2.0 = Spirale très prononcée
; CR.F : Coefficient de filtrage rouge
; De 0.0 (= pas de rouge du tout)
; à 1.0 rouge non filtré
; CV.F : Coefficient de filtrage vert
; CB.F : Coefficient de filtrage bleu
; BackColor : Couleur de fond de la fenêtre
;____________________________________________________________________________
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
With *TestLW
*LW = CreateAlphaImage(W, H)
\Bubble = CatchBubble(Size, P0, P1, P2, D0, D1, D2, Rotation, CR,
CV, CB)
BorderLW(\Bubble, *LW, BackColor)
\LWin = CatchAlphaImage(*LW)
OpenLW(*TestLW, X, Y, \LWin)
SetTimer_(WindowID(\Window), 0, 1, 0)
HideLW(*TestLW, 1)
EndWith
HideLW(*TestLW, 0)
EndProcedure
;}
;}
;{ Essais }
Procedure DEMO03()
TT = #PI / 3.0
Dim TestLW.LW(15)
CreateLW(TestLW(0), 10, 310, 400, 96, 64, 2.0 * TT, 1.0 * TT, 0.0,
0.0, 1.0, 2.0, 1.0, 1.0, 0.3, 1.0, Argb(228, 228, 228, 228) )
CreateLW(TestLW(1), 10, 100, 400, 96, 32, 1.0 * TT, 1.0 * TT, 0.0,
0.0, 1.0, 2.0, 1.0, 1.0, 0.3, 1.0, Argb(228, 228, 228, 228) )
CreateLW(TestLW(2), 450, 100, 400, 96, 48, 1.0 * TT, 1.0 * TT, 0.0,
1.0, 1.0, 2.0, 0.0, 1.0, 1.0, 1.0, Argb(228, 228, 228, 228) )
CreateLW(TestLW(3), 10, 10, 300, 96, 48, 2.0 * TT, 1.0 * TT, 0.0, 5.0,
3.0, 2.0, 0.0, 1.0, 1.0, 1.0, Argb(228, 228, 228, 228) )
CreateLW(TestLW(4), 10, 500, 200, 192, 48, 2.0 * TT, 1.0 * TT, 0.0,
5.0, 3.0, 2.0, 1.0, 1.0, 1.0, 1.0, Argb(228, 228, 228, 228) )
Repeat
For i = 0 To 2
With TestLW(i)
Events(WEvent, EWindow)
OnlyExitProcess(Quit)
If WEvent = #WM_LBUTTONDOWN
SendMessage_(WindowID(EWindow), #WM_NCLBUTTONDOWN,
#HTCAPTION, 0)
EndIf
EndWith
Next
Until Quit = 2
CloseLW(TestLW(0) )
CloseLW(TestLW(1) )
CloseLW(TestLW(2) )
CloseLW(TestLW(3) )
CloseLW(TestLW(4) )
EndProcedure
;}
;}
;}
DEMO03()
End