Is it possible to load images directly to be displayed on MARS bitmap displayer? It seems as if more complex file specifications like .jpeg and .png would be a no go but what about .BMP files? Is it as simple as loading the file into a buffer and displaying it how I would normally using base address for display?
After looking up the BMP spec I realize the spec is still pretty complicated so I guess the question is more along the lines of if I just grab the pixel array from the .BPM file how will it be affected without the other components?
Related
I'm using TexturePacker to create my sprite sheets for my iOS game. Everything is working fine with generated PNG textures (RGBA 4444), the textures are correctly loaded inside my code and correctly displayed on the iPad screen but as soon I remplace those textures by the PVRC format (pvr.ccz) with PVRTCI 4bpp RGBA pixel format, I get the following message for each of my textures from the console:
"SKTexture: Error loading image resource: "/var/containers/Bundle/Application/657D8692-594C-4180-AA8B-6CE35962C8D5/FurryLight Puzzles.app/Puzzle0.atlasc/Puzzle0.2.pvr.ccz"
The textures generated by TexturePacker are all POT and SQUARE format (2048x2048 max), the plist files are inside my directories .atlasc with the pvr.ccz files. In fact, I just replace the precedent .atlasc directories inside my tree shader inside Xcode with the PNG files by the new .atlasc directories with pvr.ccz files. All my code is in Swift 3.0
What am I missing, is there something to tune somewhere ? The pvr.ccz textures are correctly displayed by Xcode when I click on them inside the tree.
Here is the reply I got from the creators of TexturePacker:
"I am currently not sure if pvr works - you can try it. But pvr.ccz surely does not work.
pvr.ccz is a special format for cocos2d(x). It compresses the pvr files with zlib. This is not supported by SpriteKit.
Best
Andreas
"
I am using SVGKit to render the SVG which has a lot of embedded Base64 encoded png images in it.The problem is that the rendering takes around a minute which is terribly slowing down my app and uses a large amount of memory.The total size of the SVG is 10MB and at rendering the memory used is around 80-85 MB.Is there any way to get through it?
I have tried caching but memory issues still come up.
PNG is a compressed file format - it is guaranteed to use more memory when you display it. This is a fundamental limit of PNG; if you want to reduce memory usage, stop using PNGs, and instead include only vector graphics in your SVG.
Additionally, Apple usually stores extra information for each PNG to optimize the rendering speed.
(SVGKit may be storing extra info too, for the same reason: to increase rendering speed. But first you have to find out how big the PNGs are in memory)
I have milions of .PNG images which all have same colors. I would like to use this knowledge in order to save some space in following manner: Force all files to use same palette and store only IHDR and IDAT section and use same PLTE for all files. I would then inject PLTE when image is requested. As this is not trivial i am asking is this is sound approach? Is there some obstacle that i missed? Is there another approach for this problem? Initial observation is that this would save ~15% of storage.
Examle how much space is saved for single image if PLTE section is not storred:
Encode your images in grayscale format (instead of pal indexed). Keep your palette in single separate file.
On image request change fromat back to indexed palette and inject palette entries.
That looks a cost too high (developing a software to store and rebuild invalid PNG files) to gain too little. It sounds also strange that you have "millions" of images with the "same colours" - what does the later mean? do they really have the same palette (up to 256 colors)? If to "force a common palette" you have to sacrifice quality, wouldn't be more efficient to store them in JPEG.
Also, the images must be quite small if stripping the palette gives you 15% of gain. In that case, a more practical approach (especially if the files have the same size, in pixels) would be to store groups of them tiled together in a single PNG image, similar as CSS sprites.
I have a filmstrip of images in png format like this:
I'd like to know how to clip each of the images and put these images in a TImageList control, always preserving the transparency.
[EDIT]
Yes, at designtime the trick mentioned by RRUZ works fine, but I wanted to clip the images at runtime, i.e. by loading the filmstrip from resource or file
You must follow these steps:
set ColorDepth property to cd32Bit,
DrawingStyle to dsTransparent,
Height= 48,
Width=48,
then load the image and the result will be
Just import into the imagelist. It'll complain that it's too big and offer to break it into pieces for you. Works fine for me on D2005.
Another cool tip: I use AWIcons Pro http://www.awicons.com/icon-editor/ to edit icons (nice editor!). It has a feature that can export an icon as an imagelist (.bmp or .png format), thus making the filmstrip out of an icon. This makes it really handy to edit these things in .ico format, with a series of cells all the same size and depth, with each cell varying slightly. Then you export as an imagelist (I use .png) and then Delphi can break them back out into individual cells. Very slick. AWIcons isn't free, but features like this really make it productive.
At runtime, you would have to call TImageList.FileLoad. Except it won't work.
This in turn calls ImageList_LoadImage, with uFlags parameter value including the bit LR_LOADFROMFILE, which causes Windows to load from a file on disk. This underlying functionality only supports TBitmap (BMP) format.
See the nearly-duplicate question. PNG support is a designtime feature that is converting the PNG data into an internal non-PNG and not-exactly-a-BMP-either format, used internally by MS Common Controls library. View your DFM as text, and you will see what your PNG inputs have been turned into. The other answers show you that transparency is preserved, using bitmap-color based transparency.
If you want to keep your data in PNG format, you shouldn't be using a VCL TImageList to store it, because you're going to have to do a conversion from PNG to TBitmap to actually use TImageList.
In Delphi 7, I have to deal with pretty large 24bpp bitmaps (several 100 MB). Since I want to use the Graphcis32 library for further processing, they have to be converted to 32bpp (TBitmap32). The LoadFromFile method of TBitmap32, however, creates a temporary conventional TBitmap to load the original 24bpp bitmap which is then assigned to the TBitmap32 to do the required format conversion. Of course, memory load is roughly doubled by having two of these huge bitmaps in memory, and this can be fatal to my application.
What I am thinking of is a way to load the 24bpp bitmap into a preallocated buffer which is dimensioned such that the 32 bpp bitmap fits in. Then, starting from the buffer end, I want to move the RGB bytes to the offsets needed for 32bpp.
Is this possible? How can I load a bitmap into a preallocated buffer? Any idea?
I don't know much of how Graphics32 works. However if you use a standard file format and have direct access to the TBitmap32 pixel data you should be able create your own image loader for the format that does the loading and the up conversion to 32bpp in one go if nothing else works.
Specifications for common file formats are all over the internet, which one are you using?