GDI SubSystem
GDI SubSystem
...Well, judging by all compatibility problems with new 2D Drawing library, it seems that PB really needs some possibility to revert it into good/old GDI-based one. So why not just another subsystem for such purposes instead of forcing people to struggle helplessly with lots of new problems ? Very nice and simple solution, if you ask me....
P.S. Compiler option would be OK too.
P.S. Compiler option would be OK too.
Re: GDI SubSystem
So what ? We already have 2 DX-based subsystems. They aren't very multiplatform too, you know...
Re: GDI SubSystem
Exactly what I was thinking! Let's wait and see....Melissa wrote:...Well, judging by all compatibility problems with new 2D Drawing library, it seems that PB really needs some possibility to revert it into good/old GDI-based one. So why not just another subsystem for such purposes instead of forcing people to struggle helplessly with lots of new problems ? Very nice and simple solution, if you ask me....
P.S. Compiler option would be OK too.

Re: GDI SubSystem
The new 2D drawing lib is still in beta stage and you want to have a GDI subsystem because the new drawing lib is not stable?
I say: Just let the devs fix the new lib.
I say: Just let the devs fix the new lib.
Re: GDI SubSystem
Not only this: there are still some handy code which uses interaction with GDI, and (honestly) I liked doing such things myself.The new 2D drawing lib is still in beta stage and you want to have a GDI subsystem because the new drawing lib is not stable?
Code: Select all
I say: Just let the devs fix the new lib.
Re: GDI SubSystem
Hello Melissa,
You don't have to use GDI.
Ollivier
You don't have to use GDI.
Ollivier
Code: Select all
DisableDebugger
Structure LW ; Cf Procédures >> Alphablending >> Layered Window
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 $01FF0000)
X1.L ; Vista
Y1.L ; Vista
X2.L ; Vista
Y2.L ; Vista
Window.L ; n° de fenêtre
ImageID.L ; ID de l'image
VX.F
VY.F
AA.F
V.F
Flip.L
EndStructure
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 OpenLW(*LW.LW, X, Y, ImageID)
Protected Bmp.BITMAP
Protected PosiSrc.POINT
With *LW
\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
InitSprite()
InitSprite3D()
InitKeyboard()
OpenWindow(0, 0, 0, 1024, 768, "", $90000000)
OpenWindowedScreen(WindowID(0), 0, 0, 1024, 768, 0, 0, 0)
CreateSprite(0, 4, 4, #PB_Sprite_Texture)
StartDrawing(SpriteOutput(0) )
Box(0, 1, 2, 2, #White)
Box(2, 1, 2, 2, #Blue)
StopDrawing()
CreateSprite3D(0, 0)
Sprite3DQuality(1)
Distance.F = 256.0
Thickness.F = 8.0
;Repeat
Delay(1)
ClearScreen(0)
If Start3D()
Sprite3DBlendingMode(3, 9)
Angle.F = 0
For A = 0 To 360 Step 10
cx.F = 256
cy.F = 256
Angle = A * #PI / 180.0 + AngleR.F
ix.F = Cos(Angle)
iy.F = Sin(Angle)
jx.F = Cos(Angle + #PI / 2.0)
jy.F = Sin(Angle + #PI / 2.0)
ex1.F = 0.0
ey1.F = 0.0 - Thickness
ex2.F = Distance
ey2.F = 0.0 - Thickness
ex3.F = Distance
ey3.F = Thickness
ex4.F = 0.0
ey4.F = Thickness
gx1.F = ex1 * ix + ey1 * iy
gy1.F = ex1 * jx + ey1 * jy
gx2.F = ex2 * ix + ey2 * iy
gy2.F = ex2 * jx + ey2 * jy
gx3.F = ex3 * ix + ey3 * iy
gy3.F = ex3 * jx + ey3 * jy
gx4.F = ex4 * ix + ey4 * iy
gy4.F = ex4 * jx + ey4 * jy
DisplaySprite3D(0, 0, 0)
TransformSprite3D(0, cx+gx1, cy+gy1, cx+gx2, cy+gy2, cx+gx3, cy+gy3, cx+gx4, cy+gy4)
Next
Stop3D()
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left): AngleR = (AngleR + 0.005): EndIf
If KeyboardPushed(#PB_Key_Right): AngleR = (AngleR - 0.005): EndIf
FlipBuffers()
*X = AllocateMemory(1024 * 768 * 4 + 8)
PokeL(*X, 1024)
PokeL(*X + 4, 768)
If StartDrawing(ScreenOutput())
Buffer = DrawingBuffer() ; Get the start address of the screen buffer
Pitch = DrawingBufferPitch() ; Get the length (in byte) took by one horizontal line
PixelFormat = DrawingBufferPixelFormat() ; Get the pixel format.
*Ecran = Buffer
*Start = *X + 8
Qty = 1024 * 768
! mov esi, [p_Ecran]
! mov edi, [p_Start]
! mov ecx, [v_Qty]
Transfert:
! lodsd
! mov edx, eax
! xor ebx,ebx
! cmp bl, dl
! ja l_ici0
! mov bl, dl
ici0:
! shr edx, 8
! cmp bl, dl
! ja l_ici1
! mov bl, dl
ici1:
! shr edx, 8
! cmp bl, dl
! ja l_ici2
! mov bl, dl
ici2:
! shl ebx, 24
! or eax, ebx
! stosd
! loop l_transfert
; CopyMemory(*Ecran, *Start, 1024 * 768 * 4)
StopDrawing()
EndIf
AlphaImage.L = CreateBitmap_(1024, 768, 1, 32, *X + 8)
; OpenWindow(10, 100, 100, 512, 512, "Lissage", $CF0001)
ULW.LW
OpenLW(ULW, 100, 100, AlphaImage)
;ImageGadget(0, 0, 0, 1024, 768, AlphaImage)
; HideWindow(0, 1)
;Repeat
; Delay(1)
;Until WindowEvent() = 16
Delay(8000)
;Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()
CloseWindow(0)
End
Re: GDI SubSystem
...What if I don't want to use 3D Sprites (making ordinary windowed utility f.e.) ?
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: GDI SubSystem
I can see why that might influence your thinking, but that one isn't a representative sample. The original library wasn't written by the team. It was a special case where they acquired a library that was already in use by some PureBasic users and they decided to make it native. They knew there were bugs in it but rather than spend months trying to identify them all themselves, they released it as an alternative subsystem and let it have a good workout by the userbase. During this, the dx7 version was still native and if you didn't want to use the dx9 subsystem, you didn't have to.Well, think about DX9. Recalling it ? Was it in usable state when they released PB 4.20 ?
The current case with 2ddrawing is completely different. They designed and wrote it themselves, it is replacing what was there before, and you can believe that when 4.40 goes gold, it will be solid. It already is firming up nicely.
Tell me this, and answer honestly: has a frog ever lied to you?

BERESHEIT
Re: GDI SubSystem
I don't see where the big problem is with the new library. Most of the problems with it are simply because people mix in API calls in a way that is no longer supported.
quidquid Latine dictum sit altum videtur
Re: GDI SubSystem
Do what you want to do. I didn't understand you anywhere... I give you a stable code, that's all...Melissa wrote:...What if I don't want to use 3D Sprites (making ordinary windowed utility f.e.) ?
Ollivier