| 25 | namespace dmTexc |
| 26 | { |
| 27 | Image* CreateImage(const char* path, uint32_t width, uint32_t height, PixelFormat pixel_format, ColorSpace color_space, uint32_t data_size, uint8_t* data) |
| 28 | { |
| 29 | Image* image = new Image; |
| 30 | image->m_Path = strdup(path?path:"null"); |
| 31 | image->m_Width = width; |
| 32 | image->m_Height = height; |
| 33 | image->m_PixelFormat = pixel_format; |
| 34 | image->m_ColorSpace = color_space; |
| 35 | |
| 36 | image->m_DataCount = width * height * 4; |
| 37 | image->m_Data = (uint8_t*)malloc(image->m_DataCount); |
| 38 | |
| 39 | if (!ConvertToRGBA8888((uint8_t*)data, width, height, pixel_format, image->m_Data)) |
| 40 | { |
| 41 | DestroyImage(image); |
| 42 | return 0; |
| 43 | } |
| 44 | return image; |
| 45 | } |
| 46 | |
| 47 | void CreatePreviewImage(uint32_t width, uint32_t height, uint32_t data_size, const uint8_t* input_data, uint8_t* output_data) |
| 48 | { |