Page 4 sur 6

Publié : dim. 30/sept./2007 12:17
par Backup
Mytic a écrit :Ah j’ai trouvé, ça marchait pas parce que ma carte graphique était configurer pour 16 bits (Bizarre j’utilise d’habitude que le 32) :oops:
ha bah , je prefere ça !!


faudra qu'ont s'attelle au version 16 bits et 8 bits de la chose
perso , je ne peut pas utiliser le 24 bits chez moi , ça veut pas ouvrir l'ecran en 24 bit ! 8O (donc, je ne peut pas utiliser ton code Mytic)
je concerve donc la version ellegé 32 bits (le code coloré juste au dessus la :D )

par contre en 16 et 8 , je peux, je chercherai a mes moments perdu :D

Publié : dim. 30/sept./2007 12:17
par Mytic
Le Rapide_Point() n’est pas ma création. :lol:
Je lui ai ajouté que les modiff cité dans ce poste

http://www.purebasic.fr/french/viewtopic.php?t=7260

Publié : dim. 30/sept./2007 12:29
par Backup
Mytic a écrit :Le Rapide_Point() n’est pas ma création. :lol:
Je lui ai ajouté que les modiff cité dans ce poste

http://www.purebasic.fr/french/viewtopic.php?t=7260
pas grave :D

de toute façon ça fais longtemps que je reclame un autre point() :D
parce que celui du purebasic, me lamentais :D

http://www.purebasic.fr/french/viewtopi ... ight=point

mais je suis sur d'en avoir deja parlé sur le musé !!
et peut etre mem avant qu'on emigre sur le musé :lol: (ça date :lol: )

Cederavic ? il est mort le musé ?? 8O

Publié : dim. 30/sept./2007 12:58
par djes
J'ai vu sur le forum anglais un post sur la lib e2d (pb 3.94) de moebiusstefan (S.M. maintenant). Voilà le code source en asm (pas trop dur à comprendre). Fred parlait aussi de mettre en cache l'écran (voir http://www.purebasic.fr/english/viewtop ... =pointfast) pour faire des accès rapides.

Code : Tout sélectionner

format MS COFF


public PB_InitPointFast
public PB_FreePointFast
public PB_PointFast
public PB_GadgetOutput
public PB_DesktopOutput
public PB_CurrentBufferOutput

extrn _PB_DirectX_PixelFormat
extrn _PB_2DDrawing_DrawingInfo
extrn _PB_2DDrawing_CurrentDC 
extrn _GlobalAlloc@8
extrn _GlobalFree@4
extrn _PB_Point@8

extrn _GetDC@4
extrn _GetWindowDC@4
extrn _ReleaseDC@8
extrn PB_GadgetID

extrn _PB_ScreenOutput@0
extrn _PB_Sprite_CurrentBitmap
extrn _PB_DirectX_BackBuffer


macro align8 {rb 7-($-CodeSegment+7)mod 8}

section '.text' code readable executable
CodeSegment:


PB_InitPointFast:
Push Ecx
Push Ebx
Push Edi

Push 262140+4
Push 64
Call _GlobalAlloc@8
MOV [Table565],Eax

Push 262140+4
Push 64
Call _GlobalAlloc@8
MOV [Table555],Eax

MOV Ecx,65535
CreateTable565:

MOV Eax,Ecx
AND Eax,11111b
SHL Eax,3
MOV Edx,Eax
SHR Edx,5
OR Eax,Edx

MOV Edx,Ecx
SHR Edx,5
AND Edx,111111b
SHL Edx,2
MOV Ebx,Edx
SHR Ebx,6
OR Edx,Ebx
SHL Edx,8
OR Eax,Edx

MOV Edx,Ecx
SHR Edx,11
AND Edx,11111b
SHL Edx,3
MOV Ebx,Edx
SHR Ebx,5
OR Edx,Ebx
SHL Edx,16
OR Eax,Edx

BSWAP Eax 
SHR Eax,8 

MOV Edi,Ecx
SHL Edi,2
ADD Edi,[Table565]

MOV [Edi],Eax

DEC Ecx
JNZ CreateTable565


MOV Ecx,65535
CreateTable555:

MOV Eax,[Esp]
AND Eax,11111b
SHL Eax,3
MOV Edx,Eax
SHR Edx,5
OR Eax,Edx

MOV Edx,[Esp]
SHR Edx,5
AND Edx,11111b
SHL Edx,3
MOV Ebx,Edx
SHR Ebx,5
OR Edx,Ebx
SHL Edx,8
OR Eax,Edx

MOV Edx,[Esp]
SHR Edx,11
AND Edx,11111b
SHL Edx,3
MOV Ebx,Edx
SHR Ebx,5
OR Edx,Ebx
SHL Edx,16
OR Eax,Edx

BSWAP Eax 
SHR Eax,8 

MOV Edi,Ecx
SHL Edi,2
ADD Edi,[Table555]
MOV [Edi],Eax

DEC Ecx
JNZ CreateTable555

Pop Edi
Pop Ebx
Pop Ecx
RET

align8
PB_FreePointFast:
Push dword[Table565]
Call _GlobalFree@4
Push dword[Table555]
Call _GlobalFree@4
RET


align8
PB_PointFast:

MOV Edx,dword[_PB_DirectX_PixelFormat]
CMP EDX,2 
JL UseGetPixel ;8-Bit oder kein direkter speicherzugriff möglich

CMP EDX,3 ;#PB_PixelFormat_16Bits 
JNE TryBGR32

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
SHL Eax,1
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
AND Eax,65535

SHL Eax,2
ADD Eax,[Table565]
MOV Eax,[Eax]

RET 4


TryBGR32:
CMP EDX,7 ;#PB_PixelFormat_32Bits_BGR
JNE TryRGB15

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
SHL Eax,2
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
BSWAP Eax 
SHR Eax,8 

RET 4



align8
TryRGB15:
CMP EDX,2 ;#PB_PixelFormat_15Bits 
JNE TryRGB32

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
SHL Eax,1
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
AND Eax,32767 ;???

SHL Eax,2
ADD Eax,[Table555]

MOV Eax,[Eax]
RET 4



align8
TryRGB32:
CMP EDX,6  ;#PB_PixelFormat_32Bits_RGB  
JNE TryBGR24

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
SHL Eax,2
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
RET 4


align8
TryBGR24:
CMP EDX,5  ;#PB_PixelFormat_24Bits_BGR 
JNE TryRGB24

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
LEA Eax,[Eax*2+Eax]
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
BSWAP Eax 
SHR Eax,8

AND Eax,16777215
RET 4



align8
TryRGB24:
CMP EDX,4  ;#PB_PixelFormat_24Bits_RGB 
JNE UseGetPixel

MOV Edx,[Esp+4]
IMUL Edx,[_PB_2DDrawing_DrawingInfo+20];Pitch
LEA Eax,[Eax*2+Eax]
ADD Edx,Eax
ADD Edx,[_PB_2DDrawing_DrawingInfo+16];Addr

MOV Eax,[Edx]
AND Eax,16777215
RET 4

align8
UseGetPixel:
Push dword[Esp+4]
Push Eax
;Push dword[_PB_2DDrawing_CurrentDC]
Call _PB_Point@8
RET 4

align8
PB_GadgetOutput:
Call PB_GadgetID
MOV [GWindow],Eax
Push Eax
Call _GetWindowDC@4
MOV [GDC],Eax
MOV Eax,GDrawingInfoStruct
RET
GadgetStopDrawing:
Push dword[GDC]
Push dword[GWindow]
Call _ReleaseDC@8
RET


align8
PB_DesktopOutput:
Push 0
Call _GetDC@4
MOV [DDC],Eax
MOV Eax,DDrawingInfoStruct
RET
DesktopStopDrawing:
Push dword[DDC]
Push 0
Call _ReleaseDC@8
RET

align8
CBStopDrawing:
Call dword[OldReleaseProc]
MOV Eax,[BkBuffer]
MOV [_PB_DirectX_BackBuffer],Eax
RET

align8
PB_CurrentBufferOutput:
MOV Eax,[_PB_DirectX_BackBuffer]
MOV [BkBuffer],Eax
MOV Eax,[_PB_Sprite_CurrentBitmap]
MOV [_PB_DirectX_BackBuffer],Eax
Call _PB_ScreenOutput@0
MOV Edx,[Eax+12]
MOV [OldReleaseProc],Edx
MOV Edx,CBStopDrawing
MOV [Eax+12],Edx
RET


section '.data' readable writeable

Table565:
DQ 0
Table555:
DQ 0

BkBuffer:
DD 0
OldReleaseProc:
DD 0



DDrawingInfoStruct:
DType:
DD 2
DWindow:
DD 0
DDC:
DD 0
DReleaseProcedure:
DD DesktopStopDrawing
DPixelBuffer:
DD 0
DPitch:
DD 0
DWidth:
DD 0
DHeight:
DD 0
DDepth:
DD 0

GDrawingInfoStruct:
GType:
DD 2
GWindow:
DD 0
GDC:
DD 0
GReleaseProcedure:
DD GadgetStopDrawing
GPixelBuffer:
DD 0
GPitch:
DD 0
GWidth:
DD 0
GHeight:
DD 0
GDepth:
DD 0

Publié : dim. 30/sept./2007 16:48
par Mytic
Voici la nouvelle version du moteur : (plus rapide que l’ancienne)
Posté sur le premier post pour ne pas encombrer le Forum.
[Optimisé pour le mode16 bits]

:wink:

Publié : dim. 30/sept./2007 17:46
par Backup
Mytic a écrit :Voici la nouvelle version du moteur : (plus rapide que l’ancienne)
Posté sur le premier post pour ne pas encombrer le Forum.
[Optimisé pour le mode16 bits]

:wink:
j'ai donc repercuté ton travail sur les deux procedure Rapide_trucmuche :D
elle sont donc compatible mode 32 et 16 bit :D

et j'ai reposté mon code coloré "Eau ecarlate" :D
il marche maintenant en mode ecran 32 ou 16 bits :D

ya plus qu'a faire le mode 8 bits :lol:

Publié : dim. 30/sept./2007 18:19
par Mytic
Dobro a écrit : j'ai donc repercuté ton travail sur les deux procedure Rapide_trucmuche :D
elle sont donc compatible mode 32 et 16 bit :D

et j'ai reposté mon code coloré "Eau ecarlate" :D
il marche maintenant en mode ecran 32 ou 16 bits :D

ya plus qu'a faire le mode 8 bits :lol:
Marche sans problème, Bravo :)

Publié : dim. 30/sept./2007 18:20
par Chris
Le plan ultra-confidentiel du mélangeur anti-grumeaux pour la pâte à crèpes, créé par la mère klakdédan.

Image

Publié : dim. 30/sept./2007 18:31
par Mytic
Le filtre antibactérien :lol:
Image

Publié : dim. 30/sept./2007 18:31
par Backup
Mytic a écrit : Marche sans problème, Bravo :)
ben c'est a moi de te dire Bravo :lol:


(avec la voix de Jane berkin)
hum ! je crois que Chris commence a avoir mal a le tete non ? :lol:

---

Dépose vite le Brevet Chris :D

Publié : dim. 30/sept./2007 18:34
par Mytic
:lol:

Publié : dim. 30/sept./2007 21:34
par Mytic
J’ai ajouté un petit plus au moteur…
Appuyez sur la touche ENTRER pour générer un labyrinthe.
(Posté dans le premier post)
:D

Publié : dim. 30/sept./2007 22:45
par Backup
pour info j'ai ré-adapter le plot au mode 16 bit !!
il fallait faire un petit décalage de 2bit pour retomber sur nos pates :D
et inverser le rouge et le bleu :)

revoici les deux procedures qui marchent !!


Procedure rapide_Point(x,Y)
   Select DrawingBufferPixelFormat ()
     Case #PB_PixelFormat_16Bits : PF=2
      color = PeekW ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) )
     Case #PB_PixelFormat_32Bits_RGB : PF=4
      color= PeekL ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) )
     Case #PB_PixelFormat_32Bits_BGR : PF=4
      color= PeekL ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) )
      Rouge= Red (color)
      Vert= Green (color)
      Bleu= Blue (color)
      color= RGB (Bleu,Vert,Rouge)
   EndSelect
   ProcedureReturn color
EndProcedure


Procedure rapide_Plot(x,Y,color)
   Select DrawingBufferPixelFormat ()
     Case #PB_PixelFormat_16Bits : PF=2
      Rouge= Red (color)
      Vert= Green (color)
      Bleu= Blue (color)
      color= RGB (Bleu,Vert,Rouge)
      color=color>>2
       PokeW ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) , color )
     Case #PB_PixelFormat_32Bits_RGB : PF=4:t=0
       PokeL ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) ,color )
     Case #PB_PixelFormat_32Bits_BGR : PF=4:t=1
      Rouge= Red (color)
      Vert= Green (color)
      Bleu= Blue (color)
      color= RGB (Bleu,Vert,Rouge)
       PokeL ( DrawingBuffer () + (x * PF) + DrawingBufferPitch ()* ( Y ) ,color )
   EndSelect
EndProcedure

Publié : dim. 30/sept./2007 23:44
par Mytic
@Dobro
Merci...
Je vais ajouté ta conversion à mon code (si t’es d’accord bien sur )
:wink:

Publié : dim. 30/sept./2007 23:53
par Backup
Mytic a écrit :@Dobro
Merci...
Je vais ajouté ta conversion à mon code (si t’es d’accord bien sur )
:wink:
tu rigole ? 8O :lol: :lol:
je t'ai assez copié non ? :D

pour info , tout mes codes posté sur le Forum , sont libre ... :D

si de temps en temps, j'ai la surprise d'etre dans un greeting, ça me vas !! :D

j'ai eu la Surprise avec Lethal 4 :D (Merci Polux d'ailleurs :D )