How get the size of a bitmap (the image, not the control) (OpenInsight Specific)
At 15 SEP 1998 04:08:04PM Oystein Reigem wrote:
I have feeling this is something I found out earlier cannot be done, but I'll try anyway:
I have a BMP control where I show different bitmaps, of different sizes. I show them clipped, i.e the images aren't actually clipped, because the BMP control is larger than any of the images. Can I programatically find out the size of the bitmap? I mean the size of the image and not the control.
If that cannot be done - is there a Windows function I can use to get the size from the BMP file?
- Oystein -
At 16 SEP 1998 09:02AM Don Bakke wrote:
Oystein,
See below for a subroutine I wrote to return this information for BMP's. Note that you will have to create a structure within OI to get this to work, but I've included in a remark statement what this structure should look like:
<code> Compile subroutine Get_BMP_Info(File, Size, Width, Height) $insert LOGICAL Declare function Blank_Struct, Assigned, Msg Declare subroutine Parse_Struct If Assigned(File) EQ Yes$ then OSOpen File to BMP_file then /* This is a structure - UL, SL, SL, US, US, UL, UL, UL, UL, UL, UL */ Infoheader=Blank_Struct("BITMAPINFOHEADER") OSBRead Infoheader from BMP_file at 14 length 40 Parse_Struct(Infoheader, "BITMAPINFOHEADER", Size, Width, Height) OSClose BMP_file end else rv=Msg(@Window, "Error: Unable to open ":File:".") end end else rv=Msg(@Window, "Error: The file parameter was not assigned.") end Return</code>
At 17 SEP 1998 05:46AM Oystein Reigem wrote:
Don,
Thanks a lot! It worked like a charm!
I had no problems finding the necessary documentation for the missing pieces either (must confess I didn't know/remember there was such a thing as the Structure Editor), so thanks to RevSoft too for good documentation on the stuff about interfacing with Windows functions and structure. (I think I've complained a few times about the docs in the past, so it's time I said they're much improved in general.)
- Oystein -
At 17 SEP 1998 09:31AM Steve C. wrote:
Oystein,
So where did you find documentation on stuff about interfacing with Windows functions and structure and the Structure Editor?
Steve C.
At 18 SEP 1998 04:32AM Oystein Reigem wrote:
Steve,
Looking again at the online docs on DLLs and structures with a critical eye I must admit they *could* be better organized. But here are a few pointers (no pun intended):
For info on DLLs see e.g
- Help
- Contents
- Programmers Reference Help
- Chapter 7: Calling DLL Functions from BASIC+
In the above there seems to be no link to info on structures, which is unfortunate since many DLL function parameters are C structures.
For overview info on structures see e.g
- Help
- Contents
- Appendix B: BASIC+ Commands By Category
- Overview
- Pointers and Structures in BASIC+
And since the overview page on structures have no live links to the various functions that work with structures, you have to find the more detailed info yourself.
For detailed info on the OI/BASIC+ tools/functions for working with structures see e.g
- Chapter 3: BASIC+ Commands Reference
- e.g Define_Struct
- and follow the pointers to the other functions
Please tell me if you need more help. I don't exactly prototype new DLL functions every day, but I believe I understand the basics.
- Oystein -