不确定如何做到这一点,但我用MLA编码了类似的函数。在MLA中,有低级别的调用将单个像素放在屏幕上;设置颜色以设置像素的颜色,并将像素添加到像素和指定的X和Y位置。我假设和声有相似的功能。最容易处理的图形格式是BMP。文件格式很简单,由三个部分组成,即头部的PaleTIT位图。头部给出了像X和Y的图像尺寸和其他两个部分的起始地址的信息。调色板部分是一个颜色列表,调色板中的每个颜色的索引由位图部分引用。例如,假设调色板中的索引3是蓝色的,索引5是绿色的,位图部分中的序列3、3、5、3给出三个蓝色像素和一个绿色像素。代码非常简单。1)从头部2得到高度和宽度。从头部3得到调色板的起始地址。他为位图中的每一个像素从位图4的循环开始位图的地址。5)获得位图条目(调色板索引)6)查找调色板表7中的颜色)将像素放在屏幕上,最好使用256色位图,这意味着调色板有256个条目和8位索引,因此位图中的每个条目是8位值。TTECHE/BMP/BMPFILFATAT.HTM对文件格式细节有很好的描述。
以上来自于百度翻译
以下为原文
Not sure how to do this in Harmony, but I coded a similar function using MLA. In MLA there is are low level calls to put single pixels on the screen; SetColor to set the color of a pixel, and PutPixel to add a pixel and a specified x and y location). I am assuming Harmony has similar functions.
The easiest graphics format to deal with is BMP. The file format is simple, consisting of three parts
A header
A Palette
A Bitmap.
The header gives information like the x and y dimensions of the image, and the start addresses of the other two sections. The palette section is a list of colors and the index of each color in the palette is referenced by the bitmap section. For example, say that index 3 in the palette is blue , and index 5 is green, the sequence 3,3,5,3 in the bitmap section with give three blue pixels and one green pixel.
The code is pretty simple
1) Get the height and width from the header
2) Get the start address of the palette from the header
3) Get the start address of the bitmap from the header
4) Loop for each pixel in the bitmap.
5) Get a bitmap entry (palette index)
6) Look up the color in the palette table
7) Put the pixel on the screen
Its best to stick with a 256 color bitmap, which means the palette has 256 entries and an 8 bit index, so each entry in the bitmap is an 8 bit value.
http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm has a very good description of the file format details.
不确定如何做到这一点,但我用MLA编码了类似的函数。在MLA中,有低级别的调用将单个像素放在屏幕上;设置颜色以设置像素的颜色,并将像素添加到像素和指定的X和Y位置。我假设和声有相似的功能。最容易处理的图形格式是BMP。文件格式很简单,由三个部分组成,即头部的PaleTIT位图。头部给出了像X和Y的图像尺寸和其他两个部分的起始地址的信息。调色板部分是一个颜色列表,调色板中的每个颜色的索引由位图部分引用。例如,假设调色板中的索引3是蓝色的,索引5是绿色的,位图部分中的序列3、3、5、3给出三个蓝色像素和一个绿色像素。代码非常简单。1)从头部2得到高度和宽度。从头部3得到调色板的起始地址。他为位图中的每一个像素从位图4的循环开始位图的地址。5)获得位图条目(调色板索引)6)查找调色板表7中的颜色)将像素放在屏幕上,最好使用256色位图,这意味着调色板有256个条目和8位索引,因此位图中的每个条目是8位值。TTECHE/BMP/BMPFILFATAT.HTM对文件格式细节有很好的描述。
以上来自于百度翻译
以下为原文
Not sure how to do this in Harmony, but I coded a similar function using MLA. In MLA there is are low level calls to put single pixels on the screen; SetColor to set the color of a pixel, and PutPixel to add a pixel and a specified x and y location). I am assuming Harmony has similar functions.
The easiest graphics format to deal with is BMP. The file format is simple, consisting of three parts
A header
A Palette
A Bitmap.
The header gives information like the x and y dimensions of the image, and the start addresses of the other two sections. The palette section is a list of colors and the index of each color in the palette is referenced by the bitmap section. For example, say that index 3 in the palette is blue , and index 5 is green, the sequence 3,3,5,3 in the bitmap section with give three blue pixels and one green pixel.
The code is pretty simple
1) Get the height and width from the header
2) Get the start address of the palette from the header
3) Get the start address of the bitmap from the header
4) Loop for each pixel in the bitmap.
5) Get a bitmap entry (palette index)
6) Look up the color in the palette table
7) Put the pixel on the screen
Its best to stick with a 256 color bitmap, which means the palette has 256 entries and an 8 bit index, so each entry in the bitmap is an 8 bit value.
http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm has a very good description of the file format details.
举报