- Posts: 4402
GUI
- PhracturedBlue
- Offline
Transparent background on fonts is already there. just add '-DTRASNPARENT_FONT' (note the typo) in the makefile
I didn't enable it because it made no sense until we had a proper refresh function.
Please Log in or Create an account to join the conversation.
- FDR
- Offline
If we first read in the same viewport from the background image, then we can draw the new color if it is not magenta, otherwise the old one again. It can be complicated, if we aren't drawing directly to the bacground, but some intermediate layers...
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
I don't recommend using black for full transparency marker though because it is too valuable a color to be used. Though I suspect that the walkera routine actually does use a buffer because the background image renders black (could just be because the canvas is black), however the status bar animation on startup screws up when the background has transparency, this means it is not just drawing the background, then the status bar animation ontop, it is actually combining them together then drawing it, otherwise the status bar would not screw up on transparent parts of the background, it would just draw ontop.
I do not know how much ram we are working with on the device, for a single full screen buffer (which is what I suspect walkera is using).
It is slow though, and you can see the lines draw when it alphas, though it is applying alpha to almost the entire screen since it is the primary panel that gets it.
I am open to suggestions on it, at this moment I am not even going to focus on that so much as I am to get the GUI API in place so we can develop with it, looks can be refined later, but at this stage we do need to know if it is worth it or not to use a buffer since that is something we need to know now .
My goal today is:
Labels (Text holders)
Frames (Window/Canvas for GUI Objects)
Beginnings of a Dialog Box
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
I mentioned above I tried exactly that and it didn't work. I think I know why, so I may give it a shot in the future (you shouldn't actually need to write the pixel, since reading it should increment the pointer)
In any case, it is already done. Pull my latest code.
fonts will have a transparent background
bitmaps generated by GIMP in 1555 format will have transparent background.
You don't lose any colors, but do lose 1 bit of depth on green.
Included is such a bitmap
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Sorry if I didn't get a clear picture of what you said earlyer.
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
You can likely include any include file that is in libc. we have newlibc for the stm32.
You really shouldn't use HAS_FS for anything other than handling bitmaps. I see no reason why the label class would need to be bounded by that In fact, I can move HAS_FS into the bmp drawing code, such that DrawImage just draws a solid-color fill if it isn't defined. I don't want lots of #ifdefs in the code, and would like to be able to test as much functionality on real hardware at all times. I hope it won't be too long until I have USB stuff working.
It may make sense to just start over with main.c. It was designed purely as a proof of concept, and the current output does not need to be maintained (though the scanner that rcH4x0r implemented may be cool to keep as an option in the final firmware)
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Well at the moment all gui objects are stored in arrays, each with their own string, at the moment it's not the most effecient but as I go along I am improving it for memory use...
I am removing the ifdefs and only putting them where bmp is drawn...
Only reason I am even bothering with the current main.c is because we don't really have much else going on yet so it provides a good testbed at the moment.
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Without a buffer it's quite annoying as everything flashes as it's redrawn which I imagine will only get worse as more elements are on screen.
I am going to ponder over strings for a minute...
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
You say we have a 48k ram limit...
in the fonts file you create arrays of fonts, they are const, does this mean the ptr to them is pointing to a ROM location? Or is all of that allocated in RAM?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
So the fonts are in ROM. Any string that is specified in quotes is also in ROM (but sprintf will copy it to RAM of course)
printf("foo") : "foo" is in ROM
char foo[] = "bar" : "bar" is (probably) in RAM (if the string isn't modified, it could be in ROM)
const char foo[] = "bar" : bar is in ROM
sprintf(foo, "bar") : foo is in RAM but "bar" is in ROM
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Also what about scope... I assume locally declared variables are gone once the scope is done (I.E. in a function call).
Obviously we are going to need a string table...
48k really is not much...
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
you cannot have a modifyable string in ROM. By definition ROM is read-only, so it can't be changed.
you can use sprintf and friends to create a new variable based on a const string, which will go into RAM (generally on the stack). But you don't want to keep that string in memory, so you need enough info to regenerate it on demand for repainting.
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Program received signal SIGSEGV, Segmentation fault.
0x0000000000403da7 in GUI_DrawObjects () at gui/gui.c:136
136 buttonBox = GUI_Button_Array[GUI_Array[i].TypeID].box;
(gdb) p i
$1 = 206
I like the direction you are going. I'm not sure about hardcoding the arrays, but something like a linked-list or malloc could easily use up more RAM in overhead and be less predictable.
Your code currently uses 0x4370 = 17kB of RAM FYI
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
I thought about link lists or dynamic arrays as well...
Certainly a chalange point I am not used to but it's fun to figure it out none the less .
Please Log in or Create an account to join the conversation.
- MatCat
- Topic Author
- Offline
- Posts: 168
Please Log in or Create an account to join the conversation.