flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > [help] Saving a bitmap in memory to a png on disk? Goto page Previous 1, 2 |
Author |
|
bitRAKE 30 Sep 2024, 00:34
Do you have a github or something? Where can I see your work nasm?
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
30 Sep 2024, 00:34 |
|
nasm 30 Sep 2024, 06:36
bitRAKE, no github for me. I've never posted my code anywhere so far.
_________________ Do you think anyone will sell their soul over a 10 cent yoghurt with a bad after taste that lasts, a decade? |
|||
30 Sep 2024, 06:36 |
|
bitRAKE 03 Oct 2024, 14:52
Here is the brief way to load any WIC supported image format and write out as another supported format:
Code: .inputPath dq ? ; wide-string .outputPath dq ? ; wide-string ; needed COM objects: .pFactory IWICImagingFactory .pDecoder IWICBitmapDecoder .pFrame IWICBitmapFrameDecode .pConverter IWICFormatConverter .pStream IWICStream .pEncoder IWICBitmapEncoder .pFrameEncode IWICBitmapFrameEncode CoCreateInstance & CLSID_WICImagingFactory2, NULL, CLSCTX_INPROC_SERVER, & IID_IWICImagingFactory, & .pFactory IWICImagingFactory__CreateDecoderFromFilename [.pFactory], [.inputPath], NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, & .pDecoder IWICBitmapDecoder__GetFrame [.pDecoder], 0, & .pFrame ; create and configuring converter for desired output format: IWICImagingFactory__CreateFormatConverter [.pFactory], & .pConverter IWICFormatConverter__Initialize [.pConverter], [.pFrame], & GUID_WICPixelFormat32bppBGRA, WICBitmapDitherTypeNone, NULL, 0.0, WICBitmapPaletteTypeCustom IWICImagingFactory__CreateStream [.pFactory], & .pStream IWICStream__InitializeFromFilename [.pStream], [.outputPath], GENERIC_WRITE IWICImagingFactory__CreateEncoder [.pFactory], & GUID_ContainerFormatBmp, NULL, & .pEncoder IWICBitmapEncoder__Initialize [.pEncoder], [.pStream], WICBitmapEncoderNoCache IWICBitmapEncoder__CreateNewFrame [.pEncoder], & .pFrameEncode, NULL IWICBitmapFrameEncode__Initialize [.pFrameEncode], NULL {data:16} .format ddq ? ; format need to be readwrite movdqa xmm0, [GUID_WICPixelFormat32bppBGRA] movdqa [.format], xmm0 IWICBitmapFrameEncode__SetPixelFormat [.pFrameEncode], & .format ; write the converted pixels to the frame IWICBitmapFrameEncode__WriteSource [.pFrameEncode], [.pConverter], NULL IWICBitmapFrameEncode__Commit [.pFrameEncode] IWICBitmapEncoder__Commit [.pEncoder] Note: no error checking - lots of HRESULTS to examine, and IUnknown__Release all the objects when done. The important thing is to watch what data types and access restriction each parameter has. I've tested the code and it does work - this is the minimal process needed. |
|||
03 Oct 2024, 14:52 |
|
nasm 07 Oct 2024, 09:36
bitRAKE, I'm going to try it soon. You're one of the legends who still care about the assembly forum.
The truth is, we DO need more PNG code, this example will get us far, but we do need to have alternatives too. It's a great world, the needs are also great. Do we have more legends? The fact of the matter is that it can be more than just PNG, if you have a custom image format that works well for video processing, that too is welcome. |
|||
07 Oct 2024, 09:36 |
|
edfed 07 Oct 2024, 10:58
hem. an idea like this.. why don't develop a set of binaries that can be installed in ram and be called like any bios function? libpng can be one of these.
|
|||
07 Oct 2024, 10:58 |
|
revolution 07 Oct 2024, 11:33
Code: ~ find /lib* -iname "libpng*" /lib/x86_64-linux-gnu/libpng12.so.0.54.0 /lib/x86_64-linux-gnu/libpng12.so.0 /lib/i386-linux-gnu/libpng12.so.0.54.0 /lib/i386-linux-gnu/libpng12.so.0 ~ |
|||
07 Oct 2024, 11:33 |
|
bitRAKE 08 Oct 2024, 05:31
nasm wrote: You're one of the legends who still care about the assembly forum. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
08 Oct 2024, 05:31 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.