X2D - eXtended 2D

Developed or developing a new product in PureBasic? Tell the world about it.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Just arrived, haven't even tested 3.92 yet, but I hope all will work ok soon (included TailBite which, as Paul reported me by e-mail, has some problems with 3.92).

Regards,
El_Choni
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Looks like TailBite now works correctly with X2D, without having to install the helper libraries (TB_IncludeFont and TB_Include2DDrawing). At least, it works here now (TailBite 1.2 Beta 1.10)

Regards,
El_Choni
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Any updates for this library?
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post by Dräc »

Hi!
My request consists into filling easily an area by repeating an image (like the html background page process) without using For/Next loops and taking care about area boundaries.
But, X2D library doesn’t allow to change the size of the brush yet.

My suggestion: to set the brush size according to the image one when X2D_SetPatternBrush(image.l) is used !

Regards.
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post by Dräc »

I suppose having found a bug:

By setting a color different than $0 into X2D_DrawTransparentImage() command,
the drawing is correct the fist time but not after if the same image is used.
This, because whatever the specified transparent color is, it is then changed into $0 in the original image!!!

The following code illustrates the purpose:

Code: Select all

OpenWindow(1, 100, 100, 300, 300, #PB_Window_SystemMenu, "X2D")
CreateGadgetList(WindowID())
CreateImage(1, 300, 300)

CreateImage(2, 70, 24)
StartDrawing(ImageOutput())
Box(0,0,70,24,RGB(255,0,255))
X2D_RoundBox(0, 0, 9, 9, 3, 3, $FF0000)
Circle(5, 5, 2, $00FFFF)
FrontColor(255, 255, 0)
DrawingMode(1)
Locate(0, 10)
DrawText("PureBasic")
StopDrawing()

ImageGadget(1, 0, 0, 300, 300, UseImage(1))
x=Random(200)+50
y=Random(200)+50
xd=3
yd=4

loop=0
Repeat
  If x>230 Or x<0
    xd=-xd
  EndIf
  If y>274 Or y<0
    yd=-yd
  EndIf
  x+xd
  y+yd
  UseImage(1)
  StartDrawing(ImageOutput())
  For c=0 To 299
    FrontColor(0, c/2.5, c/2.5)
    Line(0, c, 300, 0)
  Next
  X2D_DrawTransparentImage(UseImage(2), x, y, RGB(255,0,255))
  ;X2D_DrawTransparentImage(UseImage(2), x, y, 0)
  StopDrawing()
  SetGadgetState(1, UseImage(1))
  Delay(25)
   
  If loop=0
    Delay(1000)
  EndIf
  event = WindowEvent()
  If event = #PB_Event_CloseWindow
    End
  EndIf
  loop=1
ForEver
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post by Dräc »

I have download the library source:
The raison of my previous posted observation takes place in the ImageList_AddMasked API function where the specified color used to generate the mask (parameter crMask) leads to a change to black of this color in the specified bitmap.
Does it suitable ?!
If not, I propose to copy the bitmap in order to not alterate the original image:

Code: Select all

ProcedureDLL X2D_DrawTransparentImage(ImageID.l, x.l, y.l, transpRGB.l) ; Draws an Image with one color set to transparent
  hDC.l
  MOV EAX, [_PB_2DDrawing_CurrentDC]
  MOV hDC, EAX
  GetObject_(ImageID, SizeOf(BITMAP), bm.BITMAP)
  ImageID=CopyImage_(ImageID, #IMAGE_BITMAP, bm\bmWidth, bm\bmHeight, 0)
  imglist = ImageList_Create_(bm\bmWidth, bm\bmHeight, #ILC_COLORDDB|#ILC_MASK, 1, 0)
  ImageList_AddMasked_(imglist, ImageID, transpRGB)
  ImageList_Draw_(imglist, 0, hDC, x, y, #ILD_TRANSPARENT)
  ImageList_Destroy_(imglist)
  DeleteObject_(ImageID)
EndProcedure
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Is there a newly compiled downloadable lib? im still getting the TB_INCLUDEFONT error. :(
--Kale

Image
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Oops, I'll have a look tonight.

EDIT: I have an old source, do you know where I can download the latest one? But maybe it's freedimension who needs just to recompile the lib with latest TailBite. I'm confused :lol:
El_Choni
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

But maybe it's freedimension who needs just to recompile the lib with latest TailBite.
Thats what im thinking too. c'mon freedimension give us some love! :twisted:
--Kale

Image
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: X2D - eXtended 2D

Post by IdeasVacuum »

This sounds like a fabulous lib - can anyone resurrect it?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Bisonte
Addict
Addict
Posts: 1313
Joined: Tue Oct 09, 2007 2:15 am

Re: X2D - eXtended 2D

Post by Bisonte »

I do not know the functions of this lib, but it seems that the most of them
are now native in PB...
Like DrawAlphaImage etc...
This is from 2004... PB 3.91
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2139
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: X2D - eXtended 2D

Post by Andre »

IdeasVacuum wrote:This sounds like a fabulous lib - can anyone resurrect it?
Even if I don't have the time to update www.PureArea.net regularly, especially with newer stuff, you can find many collected PureBasic stuff there. So also the X2D lib - just take a look at the "UserLibs" section... :)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: X2D - eXtended 2D

Post by IdeasVacuum »

Thanks Andre, unfortunately the PureArea version is way out of date (2004) and the source is not included. :cry:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: X2D - eXtended 2D

Post by IdeasVacuum »

....Danilo has up to date (PB4.60) GDI plus stuff:
http://www.purebasic.fr/english/viewtop ... 12&t=46987
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply