MobileWill Posted February 16, 2016 Report Share Posted February 16, 2016 Is there away to only load a certain pixel from a bmp? I am working on improving graphing performance while at the same time increasing the visual quality. I have a way to do it but I need a way to read back 1 pixel of a bmp of the graph background. Right now I just create an array of HTML color hex values but seems like there should be a better way to use some builtin function. I made the array myself. I haven't found a converter from BMP to C HTML Hex color array. Thanks. Link to comment Share on other sites More sharing options...
MobileWill Posted February 16, 2016 Author Report Share Posted February 16, 2016 Also can the studio add a bmp to the project without having to add it to an object? Can a container have an image background? Or shall I layer a imagebox on top? Then my label on top of the image box? I don't see a way for labels to be transparent. Thanks. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted February 16, 2016 Report Share Posted February 16, 2016 Reading just one specific pixel is not possible as the image gets decoded on the fly. Even if the image is cached the cache is specific to each image so we don't provide any API to access that. There are two workarounds to this: Use the native format to store your picture. As the native format is uncompressed by definition it's possible to access any pixel at any time. However, we don't provide an API for that, you'd have to write that yourself. Also note that this can be horribly slow depending on where your image is located and so on. After all, the main reason to use a native image format is that it doesn't need to be cached. The better approach would be to take your regular image, render it into a pixmap and then access the pixels from that pixmap. The pixmaps provide API to get direct access to each pixel. This would probably be the best solution. Regarding your second post: The studio allows you to specify files that get included in the generated romfs_files.h in the settings. You can specify your path to the BMP there. However, the studio won't open the image for you. We should probably think of introducing a resource manager for the next release where every resource (font, image, widget style, ...) is located in a central place. Please feel free to leave your suggestions in the corresponding uGFX-Studio forum. Yes, containers can have image backgrounds. You will find all about that in the API documentation: http://api.ugfx.org/group___renderings___container.html Labels don't have a transparent background rendering routine for several reasons which have been discussed before: Link to comment Share on other sites More sharing options...
MobileWill Posted February 16, 2016 Author Report Share Posted February 16, 2016 1. That will work. I am using another utility to convert images to RGB565 array of pixels. 3. I think I can use a white background for the label and use a container image with a white inset area where the label will line up with. Link to comment Share on other sites More sharing options...
inmarket Posted February 17, 2016 Report Share Posted February 17, 2016 If you are not planning on changing the text on a label at runtime you can also write your own custom redraw routine for the label in order to get transparency. It would be a simplified version of the standard default draw routine. The issues with a transparent label primarily relate to redraw issues if the text changes or the label is moved. If in your application the text doesn't change and the label doesn't move relative to its container then a transparent label makes some sense. Link to comment Share on other sites More sharing options...
MobileWill Posted February 17, 2016 Author Report Share Posted February 17, 2016 In my case I am updating the labels 1-2 times a second. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now