Minor edits to grammar.
This commit is contained in:
@@ -27,3 +27,4 @@ ENDIF (CMAKE_COMPILER_IS_GNUCC)
|
|||||||
add_executable(TGAReader ${SOURCE_FILES})
|
add_executable(TGAReader ${SOURCE_FILES})
|
||||||
|
|
||||||
target_include_directories(TGAReader PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
target_include_directories(TGAReader PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||||
|
target_link_libraries(TGAReader PUBLIC m)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ error:
|
|||||||
* 0x0E: (2 byte) Height
|
* 0x0E: (2 byte) Height
|
||||||
* 0x10: (1 byte) PixelDepth
|
* 0x10: (1 byte) PixelDepth
|
||||||
* 0x11: (1 byte) ImageDescriptor
|
* 0x11: (1 byte) ImageDescriptor
|
||||||
* Total Size: 18 Bytes
|
* Total Size: 18 Bytes
|
||||||
*/
|
*/
|
||||||
static int _read_tga_header(TGAImage *image, FILE *file)
|
static int _read_tga_header(TGAImage *image, FILE *file)
|
||||||
{
|
{
|
||||||
|
|||||||
16
src/test.c
16
src/test.c
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <TGAImage.h>
|
#include <TGAImage.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
static void print_tga_data(TGAImage *img)
|
static void print_tga_data(TGAImage *img)
|
||||||
{
|
{
|
||||||
@@ -59,17 +60,18 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
TGAImage *img = new_tga_image(TGA_TRUECOLOR, 32, 128, 255);
|
TGAImage *img = new_tga_image(TGA_TRUECOLOR, 32, 128, 255);
|
||||||
if(!img) {
|
if(!img) {
|
||||||
|
printf("An error occurred: %s\n", tga_error_str());
|
||||||
return tga_error();
|
return tga_error();
|
||||||
}
|
}
|
||||||
for(int x = 0; x < tga_get_width(img); x++)
|
for(int x = 0; x < tga_get_width(img); x++)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < tga_get_height(img); y++)
|
for(int y = 0; y < tga_get_height(img); y++)
|
||||||
{
|
{
|
||||||
tga_set_alpha_at(img, x, y, 255);
|
tga_set_alpha_at(img, x, y, 255);
|
||||||
tga_set_red_at(img, x, y, y);
|
tga_set_red_at(img, x, y, (y * x) % 255);
|
||||||
tga_set_green_at(img, x, y, y);
|
tga_set_green_at(img, x, y, y);
|
||||||
tga_set_blue_at(img, x, y, y);
|
tga_set_blue_at(img, x, y, x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *file_path = argc == 2 ? argv[1] : default_file;
|
char *file_path = argc == 2 ? argv[1] : default_file;
|
||||||
|
|||||||
Reference in New Issue
Block a user