18 December 2021, 10:09 | #1 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
|
[blitz] mix system's commands arguments with original blitz commands
Hi,
this time AmiBlitz 3.8. I've been writing something using "system style" approach (thus commands like NewDTObjectA_() and so on) and finally I came to a stop - I need to make more reading before I go on. But ... I belive I can contiunue with my program if I mix blitz commands with system commands (when I finally know "the system" way for doing this I will replace these parts) My question (actually 2): 1) how to get blitz bitmap number having only pointer (from system commands) to a bitmap in memory? I want to save bitmap as ilbm (in a quick way for now) using SaveILBM Code:
"saveilbm" ("SaveILBM" "BitMap#,Filename$,BtmHeader,ViewMode.l,Palette#") Code:
"remap" ("ReMap" "colour# to replace,destination colour# [,BitMap destintion") Thanks |
10 January 2022, 15:38 | #2 |
Registered User
Join Date: Mar 2021
Location: Aberdeen / UK
Posts: 11
|
For (1) I think the problem you might have is that there will be a data structure associated with the bitmap number, that the Blitz library uses to manage the bitmap. For example, something like this but I do not know the exact internals:
width height depth pointer And the structure would have to exist at the bitmap number for you to be able to use it from SaveILBM(). I cannot remember but is there some command you can use to bring the external bitmap into the bitmap library? Failing that, could you create another bitmap using the bitmap library and use a system function to blit from your system bitmap into the bitmap library bitmap? I guess the other thing might be to find out what the structure is and poke your values in before you call SaveILBM() and then remove them afterwards, but that's a bit hacky. |
10 January 2022, 16:35 | #3 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
If you already have the bitmap allocated in memory, CludgeBitMap can be used to assign a Blitz object number to that bitmap. It's also useful for carrying out bitmap commands on things like shape objects... Be careful that the pointer is correct and the dimensions all match up, or you could trash memory.
For the ReMap command, you similarly need to have a Blitz palette object set up to be able to use the indices. Unfortunately, Blitz palette objects don't directly refer to any OS palette structures, so a CludgePalette trick doesn't exist. I'd say the simplest thing to do would be to maintain a Blitz palette object from the start. Blitz object structures typically do contain a pointer to the system structure amongst other properties. For the bitmap object however, it contains pointers to the individual bitplanes, so just be careful there too. Amigacoding.com had a useful list of structs, but it sadly seems to have gone offline... I've contacted the site owner to see if it can be resurrected, but in the meantime, here's the archive.org copy. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blitz basic] How much amiga-blitz friendly is this? | saimon69 | Coders. Blitz Basic | 105 | 21 April 2022 19:45 |
[blitz] amiga/blitz Mode speed question | peceha | Coders. Blitz Basic | 3 | 10 January 2021 18:52 |
[blitz] how to get names from ASL FileRequester (multiselect) using system functions? | peceha | Coders. Blitz Basic | 10 | 25 September 2019 17:59 |
Opening system libraries in Blitz. | peceha | Coders. Blitz Basic | 3 | 21 August 2018 12:10 |
Using System DOS commands within SAS-C | Zetr0 | Coders. System | 5 | 23 April 2017 18:14 |
|
|