CreateImage() with any color
CreateImage() with any color
Currently, CreateImage() defaults to black when used. Can an optional color be set, so we don't need to StartDrawing() a Box() with a specific color, after creating it?
Re: CreateImage() with any color
The picture is after the create empty
empty = 0 = $000000 = black
so its black
You can use a macro to expand the command:
empty = 0 = $000000 = black
so its black

You can use a macro to expand the command:
Code: Select all
Procedure CreateImageEx(Image.i, Width.i, Height.i, Depth.i=24, Color.l=$00000000)
If Image = #PB_Any
Image = CreateImage(Image, Width, Height, Depth)
Else
CreateImage(Image, Width, Height, Depth)
EndIf
If IsImage(Image)
StartDrawing(ImageOutput(Image))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, Width, Height, Color)
StopDrawing()
EndIf
EndProcedure
Macro CreateImage(Image, Width, Height, Depth=24, Color=$00000000)
CreateImageEx(Image, Width, Height, Depth, Color)
EndMacro
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
Re: CreateImage() with any color
My request is to avoid using StartDrawing() after it, like I said in my first post.
Especially since I only use CreateImage() once in my program, so making a macro for it is a waste of space. It'd be nice just to be able to type in CreateImage(#PB_Any,w,h,color) instead.

Re: CreateImage() with any color
How can i make the background transparent ? I tried all alpha channels but the background remains black for me. I need an "empty" background
Repeat
PureBasic
ForEver
PureBasic
ForEver
Re: CreateImage() with any color
use the #PB_Image_Transparent constant
this image is an empty image
Code: Select all
CreateImage(#Image, Width, Height, 32|#PB_Image_Transparent)
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