Page 1 sur 1

Application skinnable

Publié : jeu. 29/déc./2005 1:03
par Dorian
Bonjour

En reparcourant le forum je suis retomber sur un topic intéressant : ICI qui présente une DLL qui permet de skinner une application mais malheureusement ce n'est pas gratuit. Donc voilà je voulais savoir s'il éxiste une solution gratuite ou comment faire autrement pour skinner une app.

Merci d'avance

Publié : jeu. 29/déc./2005 2:20
par CameleonTH
Il y a PureVisionXP qui fait du bon travail
http://purevision.reelmedia.org
mais il n'est pas gratuit, dommage.

Publié : jeu. 29/déc./2005 9:53
par Heis Spiter
Il existe une lib pour ça, je crois. La lib PureTools de Danilo (sur purearea.net)

Publié : jeu. 29/déc./2005 15:08
par Coolman
Regarde la lib PBOSL :

http://pbosl.purearea.net/index.php?site=News

Il y'a tout ce qu'il faut et c'est gratos :)

Publié : jeu. 29/déc./2005 15:25
par Dorian
Merci pour vos réponses. J'avoue que j'aurais préférer un truc du même style que AppFace mais bon là ces gratuit alors pourquoi se plaindre ^^.

Je vais regarder aussi attentivement PureVision pour voir ce qu'il propose d'interessant.

PS : j'ai commencé a regarder les exemples de la lib et sa parait être une bonne solution ^^

Publié : jeu. 29/déc./2005 16:38
par Coolman
Sur ce site, la lib ou dll est apparement fonctionnelle avec purebasic mais le prix est a 89 $ 8O , trop cher pour ce que c'est :

http://www.appface.net/eng/buynow.htm

il existe des alternative gratos pbosl et plusieurs codes exemples dispo sur internet...

Publié : jeu. 29/déc./2005 16:43
par Dorian
Ouai c'est ce que j'ai vu : le prix. 30€ sa aurait pu aller même si je prefère un truc freeware mais là 89$ juste pour sa et encore si on veut on peut payer jusqu'à 2000€ pour : des skins. Y'en a qui on le sens des affaires ^^

Et encore j'ai trouvé mieux : SkinCrafter sa va de 300$ à 4000$ : Qui dit mieux ? ^^

Publié : mer. 04/janv./2006 15:22
par Gillou
C'est un code de Mischa à l'origine, je l'ai un peu modifié. Je suis en train de le réécrire complétement pour une de mes applis car je veux pouvoir changer de skin une fois l'application compilé. Si ça peux aider :?:

; PureBasic 3.93 Beta 2
; Mischa
; modifié par Gillou (très légèrement)
; janvier 2004

Procedure WindowCallback( WindowID , Message, lParam, wParam)
If Message = #WM_PAINT
StartDrawing ( WindowOutput ())
DrawImage ( UseImage (1), 0, 0)
StopDrawing ()
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

UseJPEGImageDecoder ()
UsePNGImageEncoder ()
UsePNGImageDecoder ()

Structure myBITMAPINFO
bmiHeader.BITMAPINFOHEADER
bmiColors.RGBQUAD[1]
EndStructure

Structure RGB
v.l
EndStructure

Procedure CreateMask()
hDC = StartDrawing ( ImageOutput ())
main = CreateRectRgn_ (0,0,0,0)
picl_X = ImageWidth ()
picl_Y = ImageHeight ()
mem = AllocateMemory (picl_X*picl_Y*4)
bmi.myBITMAPINFO
bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
bmi\bmiheader\biWidth = picl_X
bmi\bmiheader\biHeight = picl_Y
bmi\bmiheader\biPlanes = 1
bmi\bmiheader\biBitCount = 32
bmi\bmiheader\biCompression = #BI_RGB
GetDIBits_ (hDC, ImageID (),1,picl_Y-1,mem,bmi, #DIB_RGB_COLORS )
*pixel.RGB = mem
trans.RGB
trans\v = *pixel\v
If Blue (trans\v)=255 And Green (trans\v)=0 And Red (trans\v)=0 : messag$= " -> Rouge"
ElseIf Blue (trans\v)=0 And Green (trans\v)=255 And Red (trans\v)=0 : messag$= " -> Vert"
ElseIf Blue (trans\v)=0 And Green (trans\v)=0 And Red (trans\v)=255 : messag$= " -> Bleu"
ElseIf Blue (trans\v)=255 And Green (trans\v)=255 And Red (trans\v)=255 : messag$= " -> Blanc"
ElseIf Blue (trans\v)=0 And Green (trans\v)=0 And Red (trans\v)=0 : messag$= " -> Noir"
EndIf
coulon = MessageRequester ( "Sélection de la couleur du masque" , "Couleur détectée : " + "Rouge : " + Str ( Blue (trans\v))+ " ; Vert : " + Str ( Green (trans\v))+ " ; Bleu : " + Str ( Red (trans\v))+messag$+ Chr (13)+ Chr (13)+ "Acceptez-vous cette couleur? (Oui : Utiliser la couleur ; Non : Ouvrir la palette de couleur)" , #PB_MessageRequester_YesNo )
If coulon<>6
trans\v = ColorRequester ()
trans\v = RGB ( Blue (trans\v), Green (trans\v), Red (trans\v))
EndIf
For ay=0 To picl_Y-2
For ax=0 To picl_X-1
If *pixel\v <> trans\v
sub = CreateRectRgn_ (ax,picl_Y-ay-1,ax+1,picl_Y-ay-2)
CombineRgn_ (main,main,sub, #RGN_OR )
DeleteObject_ (sub)
EndIf
*pixel + 4
Next ax
Next ay
StopDrawing ()
ProcedureReturn main
EndProcedure

file.s= OpenFileRequester ( "Ouvrir une image" , "" , "BMP; PNG; JPG|*.bmp;*.png;*.jpg;*.jpeg" ,0)
If file
image= LoadImage (1,file)
w= ImageWidth ():h= ImageHeight ()
screenx= GetSystemMetrics_ ( #SM_CXSCREEN )
screeny= GetSystemMetrics_ ( #SM_CYSCREEN )
hwnd= OpenWindow (0,screenx,screeny,w,h, #WS_POPUP , "Image Masque" )
mask=CreateMask()
oldsize= GetRegionData_ (mask,0,0)
*source= AllocateMemory (oldsize)
GetRegionData_ (mask,oldsize,*source)
*target = AllocateMemory (oldsize+8 )
newsize = PackMemory (*source,*target,oldsize,9)
newfile.s = ReplaceString (file, GetExtensionPart (file), "png" )
SaveImage (1,newfile, #PB_ImagePlugin_PNG )
rest = newsize % 4

If CreateFile (0, ReplaceString ( ReplaceString (file, GetFilePart (file), "MaskWindow_" + GetFilePart (file)), GetExtensionPart (file), "pb" ))
WriteStringN ( "UsePNGImageDecoder()" )
WriteStringN ( "Procedure OpenMaskedWindow_" + Left ( GetFilePart (file), Len ( GetFilePart (file))-4)+ "(winID,x,y,title.s,imID)" )
WriteStringN ( " hwnd=OpenWindow(winID,GetSystemMetrics_(#SM_CXSCREEN),y," + Str (w)+ "," + Str (h)+ ",#WS_POPUP,title)" )
WriteStringN ( " memhandle=GlobalAlloc_(#GMEM_MOVEABLE," + Str (oldsize+8 )+ ")" )
WriteStringN ( " *mem=GlobalLock_(memhandle)" )
WriteStringN ( " UnpackMemory(?" + Left ( GetFilePart (file), Len ( GetFilePart (file))-4)+ "_mask,*mem)" )
WriteStringN ( " region=ExtCreateRegion_(0," + Str (oldsize)+ ",*mem)" )
WriteStringN ( " SetWindowRgn_(hwnd,region,#True)" )
WriteStringN ( " pic=CatchImage(imID,?" + Left ( GetFilePart (file), Len ( GetFilePart (file))-4)+ ")" )
WriteStringN ( " brush=CreatePatternBrush_(pic)" )
WriteStringN ( " SetClassLong_(hwnd,#GCL_HBRBACKGROUND,brush)" )
WriteStringN ( " MoveWindow(x,y)" )
WriteStringN ( " GlobalUnlock_(memhandle)" )
WriteStringN ( " GlobalFree_(memhandle)" )
WriteStringN ( " DeleteObject_(region)" )
WriteStringN ( " ProcedureReturn hwnd" )
WriteStringN ( " DataSection" )
WriteStringN ( " " + Left ( GetFilePart (file), Len ( GetFilePart (file))-4)+ ":" )
WriteStringN ( " IncludeBinary " + Chr (34)+ GetFilePart (newfile)+ Chr (34))
WriteStringN ( " " + Left ( GetFilePart (file), Len ( GetFilePart (file))-4)+ "_mask:" )
string.s= " Data.l "
For i=0 To newsize-4-rest Step 4
string+ "$" + LSet ( Hex ( PeekL (*target+i)),8, " " )
count+1
If count=10
count=0
WriteStringN (string)
string= " Data.l "
Else
string+ ","
EndIf
Next i
If count
string= Left (string, Len (string)-1)
WriteStringN (string)
EndIf
If rest
string= " Data.b "
For i=newsize-rest To newsize-1
string+ "$" + Hex ( PeekB (*target+i))+ ","
Next i
string= Left (string, Len (string)-1)
WriteStringN (string)
EndIf
WriteStringN ( " EndDataSection" )
WriteStringN ( "EndProcedure" )
CloseFile (0)
MessageRequester ( "Le masque a été créé ! (fichier .pb créé)" , "Cliquez avec le bouton droit de la souris pour quitter." ,0)


SetWindowRgn_ (hwnd,mask, #True )
MoveWindow ((screenx-w)/2,(screeny-h)/2)
SetWindowCallback (@WindowCallback())

Repeat
Select WaitWindowEvent ()
Case #WM_LBUTTONDOWN
SendMessage_ (hwnd, #WM_NCLBUTTONDOWN , #HTCAPTION ,0)
Case #WM_RBUTTONDOWN
Quit=1
EndSelect
Until Quit=1
DeleteObject_ (mask)
EndIf
RunProgram ( ReplaceString ( ReplaceString (file, GetFilePart (file), "MaskWindow_" + GetFilePart (file)), GetExtensionPart (file), "pb" ))
Else
MessageRequester ( "Erreur!" , "Le masque n' a pas pu être créé '" + ReplaceString ( ReplaceString (file, GetFilePart (file), "MaskWindow_" + GetFilePart (file)), GetExtensionPart (file), "pb'" ),0)
EndIf


Publié : mer. 04/janv./2006 15:37
par Dorian
@ Gillou : Je vais regarder ton code de plus près après mon dm de maths ^^.

Est-ce que si on mais un bouton sur la fenêtre il est caché par ton masque mais en restant cliquable ?

Publié : jeu. 05/janv./2006 18:29
par Gillou
En fait, le code que je viens de te poster permet de générer le skin de la fenêtre (Tu choisis une image et il se charge de créer le code PB affichant la fenêtre skinnée)

Pour mettre un bouton si tu veux garder le style de la fenêtre tu crées un boutonImage et tu vérifies quand l'utilisateur clique dessus ou alors tu regardes à quel endroit est la souris...

Si tu mets un bouton normal il est affiché par dessus

ex : http://www.penguinbyte.com/apps/pbwebst ... /Test2.zip

Publié : jeu. 05/janv./2006 18:42
par Dorian
Tu pourrais me passer la source de ton code test2 stp enfin si sa te gène pas ^^

Publié : jeu. 05/janv./2006 19:00
par Gillou
Pas de probs,

Le code


UseJPEGImageDecoder ()
UsePNGImageDecoder ()
Procedure OpenMaskedWindow_test1(winID,x,y,title.s,imID)
hwnd= OpenWindow (winID, GetSystemMetrics_ ( #SM_CXSCREEN ),y,770,509, #WS_POPUP ,title)
memhandle= GlobalAlloc_ ( #GMEM_MOVEABLE ,952)
*mem= GlobalLock_ (memhandle)
UnpackMemory (?test1_mask,*mem)
region= ExtCreateRegion_ (0,944,*mem)
SetWindowRgn_ (hwnd,region, #True )
pic= CatchImage (imID,?test1)
brush= CreatePatternBrush_ (pic)
SetClassLong_ (hwnd, #GCL_HBRBACKGROUND ,brush)
MoveWindow (x,y)
GlobalUnlock_ (memhandle)
GlobalFree_ (memhandle)
DeleteObject_ (region)
ProcedureReturn hwnd
DataSection
test1:
IncludeBinary "test1.png"
test1_mask:
Data.l $3B0434A ,$F3510000,$8A10000 ,$19CA20C8,$1B060101,$63F5908 ,$95B00026,$8086C025,$30108740,$22224A45
Data.l $21418A25,$9160C100,$A0A9128F,$B0408010,$64A34748,$20040850,$51926458,$214283A ,$B9162C10,$A122128
Data.l $8B040801,$A4A9458 ,$82000085,$A5132845,$214285 ,$891122C1,$10A14312,$48B06080,$50E4A944,$58204008
Data.l $7916A204,$42610428,$C21304C0,$9610C432,$CB01E21 ,$88659971,$9C5084CF,$4D788426,$109BCB08,$2C21A196
Data.l $86587143,$714337E2,$28784250,$10942C21,$CB08A196,$28655C50,$27144A3E,$12978425,$610B32C2,$30088A19
Data.l $AEC2A259,$7FC3839B,$C2101011,$810797B6,$45F117F ,$F027BC9C,$F010D041,$C0450117,$1F227C49,$7E81FB04
Data.l $9C047011,$41F307CA,$17E05F90,$9C0A701 ,$41F107D ,$117D45F7,$D69C4A70,$50418107,$117045F ,$7DA9F627
Data.l $F304D010,$7011C045,$7DE1F72 ,$5F107C81,$27019C04,$41F841F8,$17B81150,$49C0A701,$41F107E ,$117B45ED
Data.l $E89C9A70,$A0410107,$117045E ,$7EC9FAA7,$E704A410,$7011C045,$7F01FBA ,$5E307941,$A7019C04,$107F41FC
Data.l $45DC1780,$DA7049C0,$8107041F,$89101175,$F864
Data.b $0,$0
EndDataSection
EndProcedure


Enumeration
#Window_0
#Code_0
#Image_0
#Image_1
#Image_2
#Image_4
#Image_16
#Image_17
#Image_18
#Image_19
#Image_20
#Image_21
#ImageGadget_0
#ImageGadget_1
EndEnumeration


UsePNGImageDecoder ()
UseJPEGImageDecoder ()
UseTIFFImageDecoder ()
UseTGAImageDecoder ()

;- Les images peuvent etre utilisees dans une procedure

Global Image0
Global Image1
Global Image2
Global Image4
Global Image16
Global Image17
Global Image18
Global Image19
Global Image20

;- Mise en mémoire des images

Image0 = CatchImage ( #Image_0 , ?Image0)
Image1 = CatchImage ( #Image_1 , ?Image1)
Image2 = CatchImage ( #Image_2 , ?Image2)
Image4 = CatchImage ( #Image_4 , ?Image4)
Image16 = CatchImage ( #Image_16 , ?Image16)
Image17 = CatchImage ( #Image_17 , ?Image17)
Image18 = CatchImage ( #Image_18 , ?Image18 )
Image19 = CatchImage ( #Image_19 , ?Image19)
Image20 = CatchImage ( #Image_20 , ?Image20)

;- Les images seront inclus dans le programmes lors de la compilation

DataSection
Image0:
IncludeBinary "minimize.PNG"
Image1:
IncludeBinary "top1.PNG"
Image2:
IncludeBinary "top.PNG"
Image4:
IncludeBinary "top2.png"
Image16:
IncludeBinary "close1.PNG"
Image17:
IncludeBinary "close.PNG"
Image18:
IncludeBinary "maximize1.PNG"
Image19:
IncludeBinary "maximize.PNG"
Image20:
IncludeBinary "minimize1.PNG"
EndDataSection


hwnd=OpenMaskedWindow_test1( #Window_0 ,( GetSystemMetrics_ ( #SM_CXSCREEN )-770)/2,( GetSystemMetrics_ ( #SM_CYSCREEN )-509)/2, "Installeur - Skin 1" , #Code_0 )
CreateGadgetList ( WindowID ())
UseImage ( #Image_1 )
ImageGadget ( #ImageGadget_1 ,516,9,51,27, ImageID ())
;SetTimer_(WindowID(#Window_0),0,10,0)
Repeat
Select WaitWindowEvent ()
Case #WM_MOUSEMOVE
If WindowMouseX ()>577 And WindowMouseX ()<624 And WindowMouseY ()>10 And WindowMouseY ()<35 ; REDUIRE LA FENETRE
If minimize=0 : minimize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image0,576,9) : StopDrawing () : EndIf

ElseIf WindowMouseX ()>637 And WindowMouseX ()<684 And WindowMouseY ()>10 And WindowMouseY ()<34 ; AGRANDIR LA FENETRE OU RESTORER
If maximize=0 : maximize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image19,636,9) : StopDrawing () : EndIf

ElseIf WindowMouseX ()>697 And WindowMouseX ()<747 And WindowMouseY ()>10 And WindowMouseY ()<35 ; FERMER LA FENETRE
If close=0 : close=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image17,696,9) : StopDrawing () : EndIf

ElseIf WindowMouseX ()>516 And WindowMouseX ()<566 And WindowMouseY ()>10 And WindowMouseY ()<35 ; METTRE AU PREMIER PLAN
If top=0 : SetGadgetState ( #ImageGadget_1 , UseImage ( #Image_2 )) : top=1 : EndIf

Else
If minimize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image20,576,9) : StopDrawing () : minimize=0
ElseIf maximize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image18,636,9) : StopDrawing () : maximize=0
ElseIf close=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image16,696,9) : StopDrawing () : close=0
ElseIf top=1 And act=0 : SetGadgetState ( #ImageGadget_1 , UseImage ( #Image_1 )) : top=0 : EndIf
EndIf
Case #WM_LBUTTONDOWN
If WindowMouseX ()>577 And WindowMouseX ()<624 And WindowMouseY ()>10 And WindowMouseY ()<35 ; REDUIRE LA FENETRE
If minimize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image20,576,9) : StopDrawing () : minimize=0 : EndIf
ShowWindow_ ( WindowID ( #Window_0 ), #SW_MINIMIZE )

ElseIf WindowMouseX ()>637 And WindowMouseX ()<684 And WindowMouseY ()>10 And WindowMouseY ()<34 ; AGRANDIR LA FENETRE OU RESTORER
If maximize=1 : StartDrawing ( WindowOutput ()) : DrawImage (Image18,636,9) : StopDrawing () : maximize=0 : EndIf
If StatuWin=0 : ShowWindow_ ( WindowID ( #Window_0 ), #SW_MAXIMIZE ) : StatuWin=1
Else : ShowWindow_ ( WindowID ( #Window_0 ), #SW_RESTORE ) : StatuWin=0 : EndIf

ElseIf WindowMouseX ()>697 And WindowMouseX ()<747 And WindowMouseY ()>10 And WindowMouseY ()<35 ; FERMER LA FENETRE
Quit=1
ElseIf WindowMouseY ()<100
SendMessage_ (hwnd, #WM_NCLBUTTONDOWN , #HTCAPTION ,0)
EndIf
;Case #WM_TIMER
Case #PB_EventGadget
Select EventGadgetID ()
Case #ImageGadget_1 ; METTRE AU PREMIER PLAN
If act=0
top=1 : act=1 : SetGadgetState ( #ImageGadget_1 , UseImage ( #Image_4 ))
SetWindowPos_ ( WindowID (), #HWND_TOPMOST , 0, 0, 0, 0, #SWP_NOSIZE | #SWP_NOMOVE )
Else
act=0 : top=0 : SetGadgetState ( #ImageGadget_1 , UseImage ( #Image_1 ))
SetWindowPos_ ( WindowID (), #HWND_NOTOPMOST , 0, 0, 0, 0, #SWP_NOSIZE | #SWP_NOMOVE )
EndIf
EndSelect
Case #PB_Event_CloseWindow
quit=1
EndSelect
Until quit=1


Les Images : http://www.penguinbyte.com/apps/pbwebst ... __Skin.zip

Publié : mer. 11/janv./2006 18:53
par Dorian
@Gillou :

J'ai commencé à regarder ton code mais je bloque sur image_mask :?

tu pourrai me dire comment sa marche l'image_mask ? ^^

J'ai essayé divers trucs dessus pour comprendre son rôle mais rien ^^.

D'ailleurs si l'image et son masque sont inclu dans l'exe, comment fait-on pour modifier le skin sans avec à recompiler ?

Publié : mer. 11/janv./2006 19:35
par Gillou
@Dorian

Oui, c'est exact, une fois que l'appli est compilé, on ne peux plus changé le skin avec le code ci-dessus.
Image_mask contient les contours de génération du skin (qui ont été généré par le premier code)

En fait, comme je l'ai mis dans le premier post, je suis en train de réécrire le code de génération du skin pour intégrer une gestion complète des skins une fois l'appli compilé. Il y a pas mal de chose à intégrer, il faut gérer l'emplacement des gadgets, les menus,... Je pense que toutes ses informations seront dans un fichier de configuration lié à l'image (à moins que je m'emballe pour les gérer :lol: ). On va voir ça.

Avec le code ci-dessus tu peux changer l'image de fond mais pas le découpage de la fenêtre :roll:, ou alors il faudrait créer un fichier de configuration contenant tout le découpage :?:

Publié : sam. 14/janv./2006 12:33
par Dorian
J'ai trouvé une source en C :( qui à l'air pas mal.

Sa montre comment skinner tout ce qui est Bouton, list, ...

SkinCtrl

PS: Pour dl les sources et exemples il faut s'enregistrer mais c'est gratuit.