56#define IMAGETYPE_COLORMAPPED 1
57#define IMAGETYPE_TRUECOLOR 2
58#define IMAGETYPE_GRAYSCALE 3
59#define IMAGETYPE_RLE 8
61#define IMAGE_ATTRIBUTE_BITCOUNT_MASK 0xf
62#define IMAGE_RIGHTTOLEFT 0x10
63#define IMAGE_TOPTOBOTTOM 0x20
76 char author_comments[324];
94#define ATTRIBUTE_NO_ALPHA 0
95#define ATTRIBUTE_UNDEFINED 1
96#define ATTRIBUTE_UNDEFINED_PRESERVE 2
97#define ATTRIBUTE_ALPHA 3
98#define ATTRIBUTE_PALPHA 4
142 *
ppv = &
This->IWICBitmapDecoder_iface;
159 TRACE(
"(%p) refcount=%u\n", iface,
ref);
169 TRACE(
"(%p) refcount=%u\n", iface,
ref);
173 This->lock.DebugInfo->Spare[0] = 0;
176 IStream_Release(
This->stream);
209 int attribute_bitcount;
212 TRACE(
"(%p,%p,%u)\n", iface, pIStream, cacheOptions);
216 if (
This->initialized)
223 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_SET,
NULL);
229 TRACE(
"got only %u bytes\n", bytesread);
234 TRACE(
"imagetype=%u, colormap type=%u, depth=%u, image descriptor=0x%x\n",
235 This->header.image_type,
This->header.colormap_type,
236 This->header.depth,
This->header.image_descriptor);
240 switch (
This->header.image_type)
244 if (
This->header.colormap_type != 1)
246 mapped_depth =
This->header.colormap_entrysize;
250 if (
This->header.colormap_type != 0 &&
This->header.colormap_type != 1)
252 mapped_depth =
This->header.depth;
256 if (
This->header.colormap_type != 0)
264 if (
This->header.depth != 8 &&
This->header.depth != 16 &&
265 This->header.depth != 24 &&
This->header.depth != 32)
268 if ((
This->header.image_descriptor & 0xc0) != 0)
273 if (attribute_bitcount &&
274 !((mapped_depth == 32 && attribute_bitcount == 8) ||
275 (mapped_depth == 16 && attribute_bitcount == 1)))
280 WARN(
"bad tga header\n");
286 This->colormap_offset =
This->id_offset +
This->header.id_length;
287 if (
This->header.colormap_type == 1)
288 This->colormap_length = ((
This->header.colormap_entrysize+7)/8) *
This->header.colormap_length;
290 This->colormap_length = 0;
291 This->image_offset =
This->colormap_offset +
This->colormap_length;
295 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_END,
NULL);
298 hr = IStream_Read(pIStream, &footer,
sizeof(
tga_footer), &bytesread);
301 TRACE(
"got only %u footer bytes\n", bytesread);
312 This->extension_area_offset = 0;
313 This->developer_directory_offset = 0;
319 This->extension_area_offset = 0;
320 This->developer_directory_offset = 0;
324 if (
This->extension_area_offset)
326 seek.QuadPart =
This->extension_area_offset;
327 hr = IStream_Seek(pIStream,
seek, STREAM_SEEK_SET,
NULL);
333 TRACE(
"got only %u extension area bytes\n", bytesread);
338 TRACE(
"extension area is only %u bytes long\n",
This->extension_area.size);
344 IStream_AddRef(pIStream);
345 This->stream = pIStream;
354 GUID *pguidContainerFormat)
356 memcpy(pguidContainerFormat, &GUID_WineContainerFormatTga,
sizeof(
GUID));
363 TRACE(
"(%p,%p)\n", iface, ppIDecoderInfo);
371 FIXME(
"(%p,%p): stub\n", iface, pIPalette);
378 FIXME(
"(%p,%p): stub\n", iface, ppIMetadataQueryReader);
385 FIXME(
"(%p,%p): stub\n", iface, ppIBitmapSource);
392 FIXME(
"(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
399 FIXME(
"(%p,%p): stub\n", iface, ppIThumbnail);
416 TRACE(
"(%p,%p)\n", iface, ppIBitmapFrame);
422 IWICBitmapDecoder_AddRef(iface);
423 *ppIBitmapFrame = &
This->IWICBitmapFrameDecode_iface;
471 return IWICBitmapDecoder_AddRef(&
This->IWICBitmapDecoder_iface);
477 return IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
485 *puiWidth =
This->header.width;
486 *puiHeight =
This->header.height;
488 TRACE(
"(%p)->(%u,%u)\n", iface, *puiWidth, *puiHeight);
497 int attribute_bitcount;
500 TRACE(
"(%p,%p)\n", iface, pPixelFormat);
504 if (attribute_bitcount &&
This->extension_area_offset)
505 attribute_type =
This->extension_area.attributes_type;
506 else if (attribute_bitcount)
514 switch (
This->header.depth)
517 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppIndexed,
sizeof(
GUID));
520 FIXME(
"Unhandled indexed color depth %u\n",
This->header.depth);
525 switch (
This->header.depth)
528 switch (attribute_type)
533 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGR555,
sizeof(
GUID));
537 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGRA5551,
sizeof(
GUID));
540 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
545 memcpy(pPixelFormat, &GUID_WICPixelFormat24bppBGR,
sizeof(
GUID));
548 switch (attribute_type)
553 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGR,
sizeof(
GUID));
556 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGRA,
sizeof(
GUID));
559 memcpy(pPixelFormat, &GUID_WICPixelFormat32bppPBGRA,
sizeof(
GUID));
562 FIXME(
"Unhandled 32-bit attribute type %u\n", attribute_type);
567 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
572 switch (
This->header.depth)
575 memcpy(pPixelFormat, &GUID_WICPixelFormat8bppGray,
sizeof(
GUID));
578 memcpy(pPixelFormat, &GUID_WICPixelFormat16bppGray,
sizeof(
GUID));
581 FIXME(
"Unhandled grayscale depth %u\n",
This->header.depth);
586 ERR(
"Unknown image type %u\n",
This->header.image_type);
594 double *pDpiX,
double *pDpiY)
596 FIXME(
"(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
607 WORD *wcolormap_data;
608 DWORD *dwcolormap_data;
611 int depth, attribute_bitcount, attribute_type;
614 TRACE(
"(%p,%p)\n", iface, pIPalette);
616 if (!
This->colormap_length)
618 WARN(
"no colormap present in this file\n");
622 if (
This->header.colormap_firstentry +
This->header.colormap_length > 256)
624 FIXME(
"cannot read colormap with %i entries starting at %i\n",
625 This->header.colormap_firstentry +
This->header.colormap_length,
626 This->header.colormap_firstentry);
633 wcolormap_data = (
WORD*)colormap_data;
634 dwcolormap_data = (
DWORD*)colormap_data;
638 seek.QuadPart =
This->colormap_offset;
643 hr = IStream_Read(
This->stream, colormap_data,
This->colormap_length, &bytesread);
646 WARN(
"expected %i bytes in colormap, got %i\n",
This->colormap_length, bytesread);
657 if (attribute_bitcount &&
This->extension_area_offset)
658 attribute_type =
This->extension_area.attributes_type;
659 else if (attribute_bitcount)
671 memset(colors, 0,
sizeof(colors));
673 color = &colors[
This->header.colormap_firstentry];
679 switch (attribute_type)
684 for (
i=0;
i<
This->header.colormap_length;
i++)
686 WORD srcval = wcolormap_data[
i];
687 *
color++=0xff000000 |
688 ((srcval << 9) & 0xf80000) |
689 ((srcval << 4) & 0x070000) |
690 ((srcval << 6) & 0x00f800) |
691 ((srcval << 1) & 0x000700) |
692 ((srcval << 3) & 0x0000f8) |
693 ((srcval >> 2) & 0x000007);
698 for (
i=0;
i<
This->header.colormap_length;
i++)
700 WORD srcval = wcolormap_data[
i];
701 *
color++=((srcval & 0x8000) ? 0xff000000 : 0) |
702 ((srcval << 9) & 0xf80000) |
703 ((srcval << 4) & 0x070000) |
704 ((srcval << 6) & 0x00f800) |
705 ((srcval << 1) & 0x000700) |
706 ((srcval << 3) & 0x0000f8) |
707 ((srcval >> 2) & 0x000007);
711 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
716 for (
i=0;
i<
This->header.colormap_length;
i++)
718 *
color++=0xff000000 |
719 colormap_data[
i*3+2] |
720 colormap_data[
i*3+1] |
725 switch (attribute_type)
730 for (
i=0;
i<
This->header.colormap_length;
i++)
731 *
color++=dwcolormap_data[
i]|0xff000000;
734 for (
i=0;
i<
This->header.colormap_length;
i++)
735 *
color++=dwcolormap_data[
i];
740 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
745 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
753 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
760 int i=0,
j, bytesperpixel;
764 bytesperpixel =
This->header.depth / 8;
772 hr = IStream_Read(
This->stream, &rc, 1, &bytesread);
781 WARN(
"RLE packet too large\n");
789 hr = IStream_Read(
This->stream, pixeldata, bytesperpixel, &bytesread);
790 if (bytesread != bytesperpixel)
hr =
E_FAIL;
793 if (bytesperpixel == 1)
798 memcpy(&imagebits[
i+
j*bytesperpixel], pixeldata, bytesperpixel);
804 hr = IStream_Read(
This->stream, &imagebits[
i],
size, &bytesread);
827 if (!
This->imagebits)
831 FIXME(
"Right to left image reading not implemented\n");
867 This->stride =
This->header.width * (
This->header.depth / 8);
871 This->stride = -
This->header.width * (
This->header.depth / 8);
872 This->origin =
This->imagebits +
This->header.width * (
This->header.height - 1) * (
This->header.depth / 8);
901 prc, cbStride, cbBufferSize, pbBuffer);
910 FIXME(
"(%p,%p): stub\n", iface, ppIMetadataQueryReader);
917 FIXME(
"(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount);
924 FIXME(
"(%p,%p): stub\n", iface, ppIThumbnail);
961 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": TgaDecoder.lock");
963 ret = IWICBitmapDecoder_QueryInterface(&
This->IWICBitmapDecoder_iface, iid,
ppv);
964 IWICBitmapDecoder_Release(&
This->IWICBitmapDecoder_iface);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void copy_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *size, const struct pixel_format_desc *format) DECLSPEC_HIDDEN
#define HeapFree(x, y, z)
static GpStatus get_decoder_info(IStream *stream, const struct image_codec **result)
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define memcpy(s1, s2, n)
#define IsEqualIID(riid1, riid2)
int seek(void *fd, ulong off, int mode)
tga_extension_area extension_area
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
ULONG developer_directory_offset
ULONG extension_area_offset
IWICBitmapDecoder IWICBitmapDecoder_iface
DWORD color_correction_offset
char software_version_letter
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
@ WICDecodeMetadataCacheOnDemand
@ WICBitmapDecoderCapabilityCanDecodeSomeImages
@ WICBitmapDecoderCapabilityCanDecodeAllImages
static const char * debug_wic_rect(const WICRect *rect)
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
#define WINCODEC_ERR_PALETTEUNAVAILABLE
#define WINCODEC_ERR_CODECNOTHUMBNAIL
#define WINCODEC_ERR_FRAMEMISSING