After a lot of problems with my 2D drawings, AND STILL HAVE THEM ...
viewtopic.php?f=4&t=75865
I started my new CNC - MACH4 look alike program,
and I have had this problem ...
I like to create a transparent Image with only text on it ...
I see the RoundBox(), Box (), Line (), but I do not see the text ??
I used OPENGL and DIRECTX11 with the same result ...
This is what I want as result (created with PC drawing program)
This is created with WIN10 Home x64 - PB5.73B2 x64 and x32
Code: Select all
EnableExplicit
UsePNGImageDecoder ()
UsePNGImageEncoder ()
InitSprite ()
InitKeyboard ()
InitMouse ()
Global Event_i.i
;- LOAD FONTS
LoadFont (10, "Courier New", 8, #PB_Font_HighQuality)
LoadFont (11, "Courier New", 24, #PB_Font_Bold | #PB_Font_HighQuality)
;- CREATE IMAGE 1
CreateImage (1, 800, 400, 32, #PB_Image_Transparent)
StartDrawing ( ImageOutput (1))
DrawingMode (#PB_2DDrawing_AllChannels)
Box (0, 0, 800, 400, $00000000)
StopDrawing ()
;- CREATE IMAGE 2
CreateImage (2, 300, 125, 32, $FF808080) ;#PB_Image_Transparent)
StartDrawing ( ImageOutput (2))
DrawingMode (#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
RoundBox (0, 0, 300, 125, 3, 3, $FFE0E0E0)
DrawingFont ( FontID (11)) ;<--- TEXT FONT
DrawingMode (#PB_2DDrawing_Transparent) ;<--- DRAW NO BACKGROUND
DrawText (10, 25, "123456.789", $FFE0E0E0, $FF000000) ;<--- DRAW TEXT ON IMAGE WITH COLOR $FFE0E0E0
StopDrawing ()
;- CREATE IMAGE 3
CreateImage (3, 600, 250, 32) ;, #PB_Image_Transparent)
StartDrawing ( ImageOutput (3))
DrawingMode (#PB_2DDrawing_AllChannels)
Box (0, 0, 300, 250, $00000000)
DrawingMode (#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
RoundBox (0, 0, 300, 250, 3, 3, $FFE0E0E0)
DrawingFont ( FontID (11)) ;<--- TEXT FONT
DrawingMode (#PB_2DDrawing_AllChannels)
DrawText (10, 100, "CAD/CAM/CNC", $FFE0E0E0, $00000000) ;<--- DRAW TEXT ON IMAGE WITH COLOR $FFE0E0E0
DrawText (20, 115, "Computer Aided 3D Design", $FFE0E0E0, $00000000) ;<--- DRAW TEXT ON IMAGE WITH COLOR $FFE0E0E0
DrawingMode (#PB_2DDrawing_Transparent) ;<--- DRAW NO BACKGROUND
DrawText (30, 145, "Computer Aided Manufacture", $FFE0E0E0, $00000000) ;<--- DRAW TEXT ON IMAGE WITH COLOR $FFE0E0E0
DrawText (40, 160, "Computer Numeric Control", $FFE0E0E0, $00000000) ;<--- DRAW TEXT ON IMAGE WITH COLOR $FFE0E0E0
DrawingMode (#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
Circle (50, 50, 50, $FFE0E0E0)
Box (0, 0, 100, 100, $FFE0E0E0)
Box (100, 50, 50, 50, $FFE0E0E0)
LineXY (0, 0, 150, 150, $FFE0E0E0)
StopDrawing ()
;- CREATE WINDOW ZONE
OpenWindow (0, 0, 0, 800, 600, "TestZone", #PB_Window_BorderLess)
OpenWindowedScreen ( WindowID (0), 0, 0, 800, 600) ;1024, 800)
ClearScreen ($A00000)
;- DO LOOP
Repeat
ClearScreen ($A00000)
Repeat
Event_i = WindowEvent ()
Select Event_i
EndSelect
Until Not Event_i
ExamineKeyboard ()
ExamineMouse ()
StartDrawing ( ScreenOutput ())
DrawingMode (#PB_2DDrawing_AlphaClip)
DrawImage ( ImageID (3), 100, 50)
StopDrawing ()
FlipBuffers ()
Delay (10)
Until Event_i = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
End