
[Windows] 2DDrawing commands with AntiAliasing through GDI+
Re: [Windows] 2DDrawing commands with AntiAliasing through G
I have a question regarding this library. Is there a way to use a memory-loaded truetype font for drawing? A font loaded with AddFontMemResourceEx_ does not seem to work (gSetFont() fails). I tried looking at GdipPrivateAddMemoryFont but it wasn't defined in the include file and after adding it I don't get it to work. Any ideas? 

Re: [Windows] 2DDrawing commands with AntiAliasing through G
I added gLoadAppFont(filename.s) and gCatchAppFont(*memory,length) now for loading/catching TrueTypeFonts (.ttf).eesau wrote:I have a question regarding this library. Is there a way to use a memory-loaded truetype font for drawing?
Those loaded .ttf are private to your application. To use them, you have to specify the flag
#PB_Font_App for the functions gSetFont() and gGetFontList(). Please try examples 27 and 28.
Version 0.85b:
Code: Select all
gDrawing v0.85b, 14. April 2012
- added commands
gImage = gLoadMetafile( filename.s )
load .EMF and .WMF
gMetafileOutput( @metafile, Width, Height [, filename.s [, description.s ]] )
- added examples
example 25 - create and display .EMF metafile
example 26 - load and display .WMF or .EMF metafiles
creates the Metafile in memory only. Display it with gDrawImage.
Version 0.85b2:
Code: Select all
gDrawing v0.85b2, 23. April 2012
- added commands
success = gLoadAppFont( filename.s )
load .ttf font
and add it to the internal application font list
returns 0 if failed
gCatchAppFont( *memory, length )
catch/load .ttf font from memory
and add it to the internal application font list
returns 0 if failed
gFreeAppFonts()
release/free the internal application font list
Note: The internal application font list is automatically freed
at program end in the function gEnd().
You can use gFreeAppFonts() to free the list manually
if you don't need the internal application fonts anymore.
Maybe useful in applications that run for a long time period.
- changed commands
gGetFontList() has now optional flag parameter
the only valid flag is #PB_Font_App
for getting the internal application font list
gSetFont() has a new flag for FontStyle: #PB_Font_App
#PB_Font_App has to be used to set fonts
from the internal application font list
- fixed commands
gDrawText() did not work correctly after setting some flags (like alignment)
with gSetDrawTextFlags() and using gDrawFormattedText() thereafter.
Thanks to STARGÅTE for finding and reporting the issue!
- added Flags
#PB_Font_App
for gSetFont() -> FontStyle #PB_Font_App uses the internal application font list,
not the system font list.
You add fonts to the internal application font list by using
gLoadAppFont and gCatchAppFont.
for gGetFontList() -> If you specify the optional flag #PB_Font_App,
the internal application font list is added to
your linked list (1st argument).
- added examples
example 27 - gLoadAppFont - load true type font (.ttf)
example 28 - gCatchAppFont - load true type font (.ttf) from memory
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Excellent, thank you!Danilo wrote:I added gLoadAppFont(filename.s) and gCatchAppFont(*memory,length) now for loading/catching TrueTypeFonts (.ttf).eesau wrote:I have a question regarding this library. Is there a way to use a memory-loaded truetype font for drawing?
Those loaded .ttf are private to your application. To use them, you have to specify the flag
#PB_Font_App for the functions gSetFont() and gGetFontList(). Please try examples 27 and 28.

Re: [Windows] 2DDrawing commands with AntiAliasing through G
Hello,
I've got a problem with image's rotation.
With a rotation of -90 degrees the image is truncated but not with an angle of -30°, -60° etc.
An idea ?
I've got a problem with image's rotation.
With a rotation of -90 degrees the image is truncated but not with an angle of -30°, -60° etc.
An idea ?
Code: Select all
;{- Enumerations / DataSections
XIncludeFile "gDrawing.pbi"
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
Mesa.
;{ Gadgets
Enumeration
#Button_0
#ScrollArea_1
#ImageGadget_1
#Image_1
#Image_2
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;Define image$,outFichier$
;}
Global Dim Tableau(8000, 8000)
Procedure.s openimage()
Protected FichierParDefaut$,Filtre$,Filtre,image$
FichierParDefaut$ = ""
Filtre$ = "Images (*.bmp)|*.bmp|All (*.*)|*.*"
Filtre = 0
image$ = OpenFileRequester("Image", FichierParDefaut$, Filtre$, Filtre)
ProcedureReturn image$
EndProcedure
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 3, 2, 1020, 760, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
ButtonGadget(#Button_0, 20, 15, 135, 30, "Open image")
ScrollAreaGadget(#ScrollArea_1, 5, 60, 1000, 650, 4000, 3000, 100, #PB_ScrollArea_Single)
ImageGadget(#ImageGadget_1, 10, 10, 565, 450, 0, #PB_Image_Border)
CloseGadgetList()
EndIf
EndProcedure
Procedure rotation(image.l, pivotX.l, PivotY.l, Angle.f, WrapMode.l)
;beware pivotX in % and pivotY in %
wi=ImageWidth(image)
hi=ImageHeight(image)
Anglerad.f=angle*#PI/180 ; in radian
wf = wi * Abs(Cos(Anglerad)) + hi * Abs(Sin(Anglerad))+5 ; width final
hf = hi * Abs(Cos(Anglerad)) + wi * Abs(Sin(Anglerad))+5 ; height final
NewImageID = CreateImage(#PB_Any, wf, hf)
; Debug wf
; Debug hf
pivotX=pivotX*wi/100 ; transformation % to pix
pivotY=pivotY*hi/100 ; transformation % to pix
xi=pivotX+(0-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(0-PivotY)*Cos(Anglerad)
yi=-yi
; Debug xi
; Debug yi
If angle<-90
xi=pivotX+(wi-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(hi-PivotY)*Cos(Anglerad)
Debug xi
Debug yi
yi=-yi
EndIf
If gStartDrawing(ImageOutput(NewImageID))
;Box(0,0,wf,hf,#White)
logo = gBufferImage(ImageID(image))
gSetPenImage(logo,WrapMode)
gSetOrigin(-xi,yi)
;gSetPenTransform(pivotX,PivotY,Angle) ; Texture :pivot par rapport à ???
gRotateAt(pivotX,PivotY,Angle)
;gRotate(Angle)
; draw a cross at the pivot
gBox(0,0, wf, hf)
gResetTransform()
gLineXY(0,0+yi,wf,yi,$FFFFFF00)
gResetTransform()
gLineXY(wi/2-xi,0,wi/2-xi,hf,$FFFFFF00)
gStopdrawing()
EndIf
ProcedureReturn NewImageID
EndProcedure
OpenWindow_Window_0()
If gInit()
OpenWindow_Window_0()
; rotation 0 to -150°
rotationInDegrees = -90 ; I've got a problem with -90°, the image is truncated
pivotX=50 ; 50% of the with
pivotY=0
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Button_0
image$=openimage()
If image$
LoadImage(#Image_1,image$)
SetGadgetState(#ImageGadget_1,ImageID(#Image_1))
image2=rotation(#Image_1, pivotX, 0, rotationInDegrees, #WrapModeClamp)
; Enumeration ; WrapMode
; #WrapModeTile ; 0 ; fonctionne avec une grande image
; #WrapModeTileFlipX ; 1
; #WrapModeTileFlipY ; 2
; #WrapModeTileFlipXY ; 3
; #WrapModeClamp ; 4
; EndEnumeration
SetGadgetState(#ImageGadget_1,ImageID(Image2))
EndIf
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
gEnd()
EndIf
;}
Re: [Windows] 2DDrawing commands with AntiAliasing through G
The problem seems to be your line:Mesa wrote:Hello,
I've got a problem with image's rotation.
With a rotation of -90 degrees the image is truncated but not with an angle of -30°, -60° etc.
An idea ?
Code: Select all
gSetOrigin(-xi,yi)
If you change:
Code: Select all
gBox(0,0, wf, hf)
Code: Select all
gBox(0,0, wf+xi, hf+yi)
I added a TrackbarGadget at the top for the rotation.
Look at the line with comment "FIX" and try it.
Code: Select all
;{- Enumerations / DataSections
XIncludeFile "gDrawing.pbi"
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#Button_0
#ScrollArea_1
#ImageGadget_1
#Image_1
#Image_2
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;Define image$,outFichier$
;}
Global Dim Tableau(8000, 8000)
Procedure.s openimage()
Protected FichierParDefaut$,Filtre$,Filtre,image$
FichierParDefaut$ = ""
Filtre$ = "Images (*.bmp)|*.bmp|All (*.*)|*.*"
Filtre = 0
image$ = OpenFileRequester("Image", FichierParDefaut$, Filtre$, Filtre)
ProcedureReturn image$
EndProcedure
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 3, 2, 1020, 760, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
ButtonGadget(#Button_0, 20, 15, 135, 30, "Open image")
ScrollAreaGadget(#ScrollArea_1, 5, 60, 1000, 650, 4000, 3000, 100, #PB_ScrollArea_Single)
ImageGadget(#ImageGadget_1, 10, 10, 565, 450, 0, #PB_Image_Border)
CloseGadgetList()
EndIf
EndProcedure
Procedure rotation(image.l, pivotX.l, PivotY.l, Angle.f, WrapMode.l)
;beware pivotX in % and pivotY in %
wi=ImageWidth(image)
hi=ImageHeight(image)
Anglerad.f=angle*#PI/180 ; in radian
wf = wi * Abs(Cos(Anglerad)) + hi * Abs(Sin(Anglerad))+5 ; width final
hf = hi * Abs(Cos(Anglerad)) + wi * Abs(Sin(Anglerad))+5 ; height final
NewImageID = CreateImage(#PB_Any, wf, hf)
; Debug wf
; Debug hf
pivotX=pivotX*wi/100 ; transformation % to pix
pivotY=pivotY*hi/100 ; transformation % to pix
xi=pivotX+(0-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(0-PivotY)*Cos(Anglerad)
yi=-yi
; Debug xi
; Debug yi
If angle<-90
xi=pivotX+(wi-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(hi-PivotY)*Cos(Anglerad)
Debug xi
Debug yi
yi=-yi
EndIf
If gStartDrawing(ImageOutput(NewImageID))
Box(0,0,wf,hf,#White)
logo = gBufferImage(ImageID(image))
;logo=image
gSetPenImage(logo,WrapMode)
;gStartTransform()
gSetOrigin(-xi,yi)
;gSetPenTransform(pivotX,PivotY,Angle) ; Texture :pivot par rapport à ???
gRotateAt(pivotX,PivotY,Angle)
;gRotate(Angle)
; draw a cross at the pivot
gBox(0,0, wf , hf) ; <-- WITHOUT FIX
;gBox(0,0, wf+xi, hf+yi) ; <-- FIX
gResetTransform()
gLineXY(0,0+yi,wf,yi,$FFFFFF00)
;gResetTransform()
gLineXY(wi/2-xi,0,wi/2-xi,hf,$FFFFFF00)
gStopdrawing()
EndIf
ProcedureReturn NewImageID
EndProcedure
OpenWindow_Window_0()
If gInit()
OpenWindow_Window_0()
; rotation 0 to -150°
rotationInDegrees = -85;-90 ; I've got a problem with -90°, the image is truncated
pivotX=50 ; 50% of the with
pivotY=0
trackbar=TrackBarGadget(#PB_Any,200,20,400,20,0,180)
SetGadgetState(trackbar,rotationInDegrees+180)
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Button_0
image$=openimage()
If image$
LoadImage(#Image_1,image$)
SetGadgetState(#ImageGadget_1,ImageID(#Image_1))
image2=rotation(#Image_1, pivotX, 0, rotationInDegrees, #WrapModeClamp)
; Enumeration ; WrapMode
; #WrapModeTile ; 0 ; fonctionne avec une grande image
; #WrapModeTileFlipX ; 1
; #WrapModeTileFlipY ; 2
; #WrapModeTileFlipXY ; 3
; #WrapModeClamp ; 4
; EndEnumeration
SetGadgetState(#ImageGadget_1,ImageID(Image2))
EndIf
ElseIf EventGadget=trackbar
rotationInDegrees = GetGadgetState(trackbar)-180
FreeImage(image2)
image2=rotation(#Image_1, pivotX, 0, rotationInDegrees, #WrapModeClamp)
SetGadgetState(#ImageGadget_1,ImageID(Image2))
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
gEnd()
EndIf
;}
If you don't need image tiling, you could use gDrawImage directly:
Code: Select all
Procedure rotation(image.l, pivotX.l, PivotY.l, Angle.f, WrapMode.l)
;beware pivotX in % and pivotY in %
wi=ImageWidth(image)
hi=ImageHeight(image)
Anglerad.f=angle*#PI/180 ; in radian
wf = wi * Abs(Cos(Anglerad)) + hi * Abs(Sin(Anglerad))+5 ; width final
hf = hi * Abs(Cos(Anglerad)) + wi * Abs(Sin(Anglerad))+5 ; height final
NewImageID = CreateImage(#PB_Any, wf, hf)
; Debug wf
; Debug hf
pivotX=pivotX*wi/100 ; transformation % to pix
pivotY=pivotY*hi/100 ; transformation % to pix
xi=pivotX+(0-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(0-PivotY)*Cos(Anglerad)
yi=-yi
; Debug xi
; Debug yi
If angle<-90
xi=pivotX+(wi-pivotX)*Cos(Anglerad)+(0-PivotY)*Sin(Anglerad)
yi=PivotY-(0-pivotX)*Sin(Anglerad)+(hi-PivotY)*Cos(Anglerad)
Debug xi
Debug yi
yi=-yi
EndIf
If gStartDrawing(ImageOutput(NewImageID))
Box(0,0,wf,hf,#White)
gSetOrigin(-xi,yi)
gRotateAt(pivotX,PivotY,Angle)
gDrawImage(image,0,0)
gResetTransform()
gLineXY(0,0+yi,wf,yi,$FFFFFF00)
gLineXY(wi/2-xi,0,wi/2-xi,hf,$FFFFFF00)
gStopdrawing()
EndIf
ProcedureReturn NewImageID
EndProcedure
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: [Windows] 2DDrawing commands with AntiAliasing through G
I have got a problem matching the height of text in an EditorGadget and the same text drawn using GDI+.
According to the PB Help, the input for font height is measured in Points. I'm not sure that it is, because if I measure the height of some text in an Editor Gadget, PB seems to be using Pixel Height.
GDI+: gSetFont("Arial", 20, #PB_Font_Bold)
PB: LoadFont(#Font, "Arial", 20, #PB_Font_Bold):

On the left, the g text height is approx 15pixels, which sounds right if 1pixel = approx 0.75 points.
On the right is the PB Text in an Editor Gadget, the text height is approx 20pixels.
Confused!
According to the PB Help, the input for font height is measured in Points. I'm not sure that it is, because if I measure the height of some text in an Editor Gadget, PB seems to be using Pixel Height.
GDI+: gSetFont("Arial", 20, #PB_Font_Bold)
PB: LoadFont(#Font, "Arial", 20, #PB_Font_Bold):

On the left, the g text height is approx 15pixels, which sounds right if 1pixel = approx 0.75 points.
On the right is the PB Text in an Editor Gadget, the text height is approx 20pixels.
Confused!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: [Windows] 2DDrawing commands with AntiAliasing through G
gDrawing uses pixels for font size by default.
After "gSetUnit(#UnitMillimeter)", the command "gSetFont("Arial",40)" loads the font with size 40mm.
This makes sense to output to different devices with different DPI (screen, printers) at the same size.
40mm are 40mm on screen and on printers (example "Printing 01.pb").
You can change to other "#Unit..." enumerations:
Also, you have gGetDpiX() and gGetDpiY() to get the DPI of the output device (for example 600x600 DPI for a printer),
so you can convert DPI to any other sizes.
Don't forget that some characters go under the base line, for example (lowercase) 'g' and 'j'.
In your example text you can't see it.
See also: DPI and Device-Independent Pixels (Windows)
After "gSetUnit(#UnitMillimeter)", the command "gSetFont("Arial",40)" loads the font with size 40mm.
This makes sense to output to different devices with different DPI (screen, printers) at the same size.
40mm are 40mm on screen and on printers (example "Printing 01.pb").
You can change to other "#Unit..." enumerations:
Code: Select all
#UnitPixel ; 2 -- Each unit is one device pixel.
#UnitPoint ; 3 -- Each unit is a printer's point, or 1/72 inch.
#UnitInch ; 4 -- Each unit is 1 inch.
so you can convert DPI to any other sizes.
Don't forget that some characters go under the base line, for example (lowercase) 'g' and 'j'.
In your example text you can't see it.
See also: DPI and Device-Independent Pixels (Windows)
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Hi Danilo
Thanks for getting back to me.
There is something 'wrong' somewhere, because no matter what unit is set via gSetUnit(), the resulting text is always smaller than what PB displays in an EditorGadget for the same height value.........
Edit: ...and that something 'wrong' is a typo in my code!
Thanks for your help Danilo. Time for a coffee.
Thanks for getting back to me.
There is something 'wrong' somewhere, because no matter what unit is set via gSetUnit(), the resulting text is always smaller than what PB displays in an EditorGadget for the same height value.........
Edit: ...and that something 'wrong' is a typo in my code!
Thanks for your help Danilo. Time for a coffee.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Thanks for your Include.
But how can i draw alpha-blended sprites?
I tried to use it like that:
I also tried to set the gDrawingMode and tried to use gClear with $00000000 - no luck, i got fully transparent sprites.
But how can i draw alpha-blended sprites?
I tried to use it like that:
Code: Select all
CreateSprite(0,100,100,#PB_Sprite_AlphaBlending|#PB_Sprite_Texture)
gStartDrawing(SpriteOutput(0))
gCircle(50,50,50,50)
gStopDrawing()
CreateSprite3D(0,0)
...
Start3D()
DisplaySprite3D(0,0,0)
Stop3D()
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: [Windows] 2DDrawing commands with AntiAliasing through G
I don't use that library but the characteristics of the following sample code will apply to the gdiplus library too. There is a problem with #PB_Sprite_AlphaBlending when used with CreateSprite(). The alphas come out wrong. With LoadSprite(), all is well. For now, if you want to draw your own sprites with alphablending, they have to come in via LoadSprite(). Here is the sample:
Only the Sprite3D which came in via LoadSprite() displays correctly. It is unfortunately no better with the OpenGL subsystem as opposed to the native DX9.
Code: Select all
InitSprite():InitSprite3D():InitKeyboard()
OpenWindow(0,0,0,320,240,"Press any key to end...",#pb_window_screencentered)
OpenWindowedScreen(WindowID(0),0,0,128,64)
CreateSprite(0, 64,64, #PB_sprite_texture|#pb_sprite_alphablending)
CreateImage(0, 64,64, 32|#pb_image_transparent)
StartDrawing(ImageOutput(0))
DrawingMode(#pb_2ddrawing_alphablend)
Circle(26,26,16,RGBA(255,0,0,64))
Circle(36,36,16,RGBA(0,0,255,64))
StopDrawing()
StartDrawing(SpriteOutput(0))
DrawAlphaImage(ImageID(0),0,0)
StopDrawing()
CreateSprite3D(0,0)
UsePNGImageEncoder()
SaveImage(0, "c:\test.png", #pb_imageplugin_png)
UsePNGImageDecoder()
LoadSprite(1, "c:\test.png", #PB_sprite_texture|#pb_sprite_alphablending)
CreateSprite3D(1,1)
Repeat
While WindowEvent():Wend
ClearScreen(GetSysColor_(#COLOR_BTNFACE))
Start3D()
DisplaySprite3D(0,0,0)
DisplaySprite3D(1,64,0)
Stop3D()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#pb_key_all)
BERESHEIT
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Thanks!netmaestro wrote:if you want to draw your own sprites with alphablending, they have to come in via LoadSprite()
So... Is this a bug? Do devs know about it?
Re: [Windows] 2DDrawing commands with AntiAliasing through G
No Bug, alpha-channel is not support with StartDrawing() and SpriteOutput()
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
- VisualJump3D
- User
- Posts: 75
- Joined: Thu Jun 23, 2011 8:32 pm
- Location: italy
- Contact:
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Hi,
how can I use "gDrawing" with InitEngine3D () ?
thank
how can I use "gDrawing" with InitEngine3D () ?
thank
Re: [Windows] 2DDrawing commands with AntiAliasing through G
Did you mean how to use gDrawing with TextureOutput()?VisualJump3D wrote:how can I use "gDrawing" with InitEngine3D () ?
If so, I guess you have to draw to images, and draw the image onto the texture. Maybe like this:
Code: Select all
Procedure.i ImageToTexture(img)
Protected result, texture
If IsImage(img)
texture = CreateTexture(#PB_Any, ImageWidth(img), ImageHeight(img))
If texture
If StartDrawing(TextureOutput(texture))
DrawImage(ImageID(img),0,0)
StopDrawing()
ProcedureReturn texture
Else
FreeTexture(texture)
EndIf
EndIf
EndIf
EndProcedure
- VisualJump3D
- User
- Posts: 75
- Joined: Thu Jun 23, 2011 8:32 pm
- Location: italy
- Contact:
Re: [Windows] 2DDrawing commands with AntiAliasing through G
no ...
the problem is , when i work with InitEngine3D () + openwindowedscreen
Es 19
EnableExplicit
XIncludeFile "gDrawing.pbi"
Define mainWin, quit
InitEngine3D () ( NOT IN Example 19 but in my code yes ) ( I get an error )
InitSprite()
InitKeyboard()
Procedure Screen()
ClearScreen(0)
If gStartDrawing(ScreenOutput())
gSetFont("Arial",200,#PB_Font_Bold)
gDrawText(100,100,"Text",RGBA($00,$00,$FF,$FF))
gDrawingMode(#PB_2DDrawing_Outlined)
gDrawText(100,100,"Text",RGBA($FF,$FF,$FF,$FF))
gBox(100,100,gTextWidth("Text"),gTextHeight(),RGBA($FF,$FF,$FF,$FF))
gStopdrawing()
EndIf
FlipBuffers()
EndProcedure
If gInit()
mainWin = OpenWindow(#PB_Any,0,0,800,600,"gDrawing on screen",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(mainWin),0,0,800,600,0,0,0)
Repeat
Select WindowEvent()
Case #PB_Event_CloseWindow
quit = #True
EndSelect
Screen()
Until quit=#True
gEnd()
EndIf
the problem is , when i work with InitEngine3D () + openwindowedscreen
Es 19
EnableExplicit
XIncludeFile "gDrawing.pbi"
Define mainWin, quit
InitEngine3D () ( NOT IN Example 19 but in my code yes ) ( I get an error )
InitSprite()
InitKeyboard()
Procedure Screen()
ClearScreen(0)
If gStartDrawing(ScreenOutput())
gSetFont("Arial",200,#PB_Font_Bold)
gDrawText(100,100,"Text",RGBA($00,$00,$FF,$FF))
gDrawingMode(#PB_2DDrawing_Outlined)
gDrawText(100,100,"Text",RGBA($FF,$FF,$FF,$FF))
gBox(100,100,gTextWidth("Text"),gTextHeight(),RGBA($FF,$FF,$FF,$FF))
gStopdrawing()
EndIf
FlipBuffers()
EndProcedure
If gInit()
mainWin = OpenWindow(#PB_Any,0,0,800,600,"gDrawing on screen",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(mainWin),0,0,800,600,0,0,0)
Repeat
Select WindowEvent()
Case #PB_Event_CloseWindow
quit = #True
EndSelect
Screen()
Until quit=#True
gEnd()
EndIf