Stretch BitMap

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

As i now, there is an API for Stretching Bitmaps.
BTW i wanna use an Imagegadget with a small Bitmap.This Bitmap should been streched to the dimensions of the gadget.Is this possible without use of
any cyle repainting ?

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Oh I think it must a bug.
The description of ImageGadget says:
Create an Image gadget in the current GadgetList. The ImageID represents a BMP file and can be obtained by using UseImage() or ImageID() from the Image library. The gadget dimension autofit the image size. The gadget doesn't have any input, so user interactions (mouse clicks etc...) aren't reported.
so 'autofit the image size' does not work on NT and Win2000(as i owned).
Any reports if this function works correct under other OS's guys ?

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
if you have a snippet to run...
okay here it is.Note that you need a small bmp!


hwnd=OpenWindow(0, 100, 100, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
If hwnd
IMG1=LoadImage(1,"TL.bmp");This bitmap must be in a small size
InitGadget(2)
CreateGadgetList(WindowID())
ButtonGadget(1,20,10,80,25,"EXIT")
ImageGadget(2,0,0,100,100,IMG1)
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventCloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
If EventID=#PB_EventGadget ;#PB_EventGadget
GadNR.l=EventGadgetID()
If GadNR.l=1
Quit=1
EndIf
EndIf
Until Quit = 1
EndIf
End

Getting better with a little help from my friends....thx Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Bug confirmed on Win98SE (with your code).
Autofit is not working. Tested with a bitmap size of 32x32 and 1024x768.


Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

When I mean AutoFit, it was than the ImageGadget is always sized like the image size. It seems to be a windows limitation. But I will add a ResizeImage() function to manipulate the bmp. I think you shouldn't have pb to use the WinAPI function to do it for now..

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
But I will add a ResizeImage() function to manipulate the bmp
Okay thx fred.
Yes ResizeImage should be a native PureBasicFunction.



Getting better with a little help from my friends....thx Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
But I will add a ResizeImage() function to manipulate the bmp
Okay thx fred.
Yes ResizeImage should be a native PureBasicFunction.



Getting better with a little help from my friends....thx Siggi
ResizeImage works now fine (2.90)

Getting better with a little help from my friends....thx Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.
ResizeImage works now fine (2.90)
Are you sure of that ? I don't have any ResizeImage function in my PureBasic version ...

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
ResizeImage works now fine (2.90)
Are you sure of that ? I don't have any ResizeImage function in my PureBasic version ...

Fred - AlphaSND
Oh help me.....i'm totally wrong.What to hell have i done at work.I take a close look...it could be ResizeGadget of course.

Getting better with a little help from my friends....thx Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

If you want to strech an Image use WinAPI StretchBlt.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
If you want to strech an Image use WinAPI StretchBlt.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
I know, but i have to done it every Windows-Repaint.
I wanna do it with native PureBasic-commands.Tile Image-Gadgets on the background.

Getting better with a little help from my friends....thx Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

The ImageGadget should definitely use the
size that is given in the command arguments
and stretch the bitmap to that size.

Fred:
You can change the command ImageGadget():
1st step: resize the bitmap to the size that is given as the argument
2nd step: create the ImageGadget with the right size

The ImageGadget command should handle
that automatically.
You only need to add a ResizeImage part
at the beginning of the ImageGadget
command.

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.
ResizeImage works now fine (2.90)
Are you sure of that ? I don't have any ResizeImage function in my PureBasic version ...

Fred - AlphaSND
It was ResizeGadget indeed.
And it works.But i also prefer Danilo's way.

Getting better with a little help from my friends....thx Siggi
Post Reply