okay, a question here from a pure beginner (no pun intended):
assume i have loaded 2 images (number 1 and 2) 'A' and 'B', both of them are 1024x768
i have created a third image (number 3) size 2048 x 768
now i want to draw / copy / whatever one and two into 3, so the result would be the two original images side by side 'AB'
is there a way to draw 'into' an image? (i.e. the opposite of GrabImage?)
any help would be appreciated, thanks in advance...
			
			
									
									
						side to side glueing of images
Use StartDrawing(ImageOutput()) to draw into image 3 and then
DrawImage() to draw the 2 other images into it. Of course, you have to
change the active used Image with UseImage() inbetween.
Like this:
Timo
			
			
									
									DrawImage() to draw the 2 other images into it. Of course, you have to
change the active used Image with UseImage() inbetween.
Like this:
Code: Select all
UseImage(3)  ; draw to numer 3
StartDrawing(ImageOutput()) ; start drawing session
  DrawImage( UseImage(1), 0, 0)  ; UseImage() changes the used Image, and returns the new ImageID for DrawImage()
  DrawImage( UseImage(2), 1024, 0) ; Draw numer 2 next to 1
StopDrawing() ; end drawing session
quidquid Latine dictum sit altum videtur
						i suddenly realised what i was doing wrong, there must be a reason for the different handling of image 'numbers' and 'image id's'... i was used to referring to images by their handles, then bitblitting from image one to image two using those handles... funny enough, drawimage uses imageid while the other image commandos do not... duh...
does that mean i always have to a useimage followed by imageid to obtain the imageid?
anyway, thanks... the next code works
void.l=0
If LoadImage(1,"c:\software\backgnds\random1.bmp")<>0
If LoadImage(2,"c:\software\backgnds\random2.bmp")<>0
ResizeImage(1,1024,768)
ResizeImage(2,1024,768)
CreateImage(3,2048,768)
StartDrawing(ImageOutput())
DrawImage(UseImage(1),0,0)
DrawImage(UseImage(2),1024,0)
StopDrawing()
void=SaveImage(3,"c:\software\backgnds\random3.bmp")
FreeImage(1)
FreeImage(2)
FreeImage(3)
EndIf
EndIf
			
			
									
									
						does that mean i always have to a useimage followed by imageid to obtain the imageid?
anyway, thanks... the next code works
void.l=0
If LoadImage(1,"c:\software\backgnds\random1.bmp")<>0
If LoadImage(2,"c:\software\backgnds\random2.bmp")<>0
ResizeImage(1,1024,768)
ResizeImage(2,1024,768)
CreateImage(3,2048,768)
StartDrawing(ImageOutput())
DrawImage(UseImage(1),0,0)
DrawImage(UseImage(2),1024,0)
StopDrawing()
void=SaveImage(3,"c:\software\backgnds\random3.bmp")
FreeImage(1)
FreeImage(2)
FreeImage(3)
EndIf
EndIf
When the help refers to #Imege, then you have to use the number you
gave it (1, 2, 3 in this case). When it says ImageID, then you have to use
the Value returned by the UseImage() and ImageID() functions.
This system gives experienced programmers the possibility to use
the PB Image functions together with the Windows API for example.
Timo
			
			
									
									gave it (1, 2, 3 in this case). When it says ImageID, then you have to use
the Value returned by the UseImage() and ImageID() functions.
This system gives experienced programmers the possibility to use
the PB Image functions together with the Windows API for example.
Timo
quidquid Latine dictum sit altum videtur
						yep, that's what i figured out after all 
i think the documentation needs some improvement, some of these things should be made a little clearer... how about, for example, the behaviour of the random() function?
according to the help file, it should generate a number BETWEEN 0 and maximum (the parameter), but try this:
For n=1 To 100
r=Int(Random(10))
Print(Str(r)+" ")
Next n
0 as well as 10 do show up... either the function or the documentation is incorrect...
i'll have a look around and post this in the appropriate forum)
			
			
									
									
						
i think the documentation needs some improvement, some of these things should be made a little clearer... how about, for example, the behaviour of the random() function?
according to the help file, it should generate a number BETWEEN 0 and maximum (the parameter), but try this:
For n=1 To 100
r=Int(Random(10))
Print(Str(r)+" ")
Next n
0 as well as 10 do show up... either the function or the documentation is incorrect...
i'll have a look around and post this in the appropriate forum)

