X2D - eXtended 2D
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.
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.
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:
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
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:
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
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: X2D - eXtended 2D
This sounds like a fabulous lib - can anyone resurrect it?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: X2D - eXtended 2D
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
are now native in PB...
Like DrawAlphaImage etc...
This is from 2004... PB 3.91
- Andre
- PureBasic Team
- Posts: 2139
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
- Contact:
Re: X2D - eXtended 2D
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...IdeasVacuum wrote:This sounds like a fabulous lib - can anyone resurrect it?

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: X2D - eXtended 2D
Thanks Andre, unfortunately the PureArea version is way out of date (2004) and the source is not included. 

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: X2D - eXtended 2D
....Danilo has up to date (PB4.60) GDI plus stuff:
http://www.purebasic.fr/english/viewtop ... 12&t=46987
http://www.purebasic.fr/english/viewtop ... 12&t=46987
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.