ReactOS  0.4.14-dev-342-gdc047f9
image.c File Reference
#include <math.h>
#include <assert.h>
#include <stdio.h>
#include "initguid.h"
#include "objbase.h"
#include "gdiplus.h"
#include "wine/test.h"
#include "pshpack2.h"
#include "poppack.h"
Include dependency graph for image.c:

Go to the source code of this file.

Classes

struct  BITMAPINFOWITHBITFIELDS
 
union  BITMAPINFOUNION
 
struct  IFD_entry
 
struct  IFD_rational
 
struct  tiff_data
 
struct  tiff_1x1_data
 

Macros

#define COBJMACROS
 
#define expect(expected, got)   ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))
 
#define expectf(expected, got)   ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
 
#define IFD_BYTE   1
 
#define IFD_ASCII   2
 
#define IFD_SHORT   3
 
#define IFD_LONG   4
 
#define IFD_RATIONAL   5
 
#define IFD_SBYTE   6
 
#define IFD_UNDEFINED   7
 
#define IFD_SSHORT   8
 
#define IFD_SLONG   9
 
#define IFD_SRATIONAL   10
 
#define IFD_FLOAT   11
 
#define IFD_DOUBLE   12
 
#define PropertyTagTypeSByte   6
 
#define PropertyTagTypeSShort   8
 
#define PropertyTagTypeFloat   11
 
#define PropertyTagTypeDouble   12
 
#define PNG_COLOR_TYPE_GRAY   0
 
#define PNG_COLOR_TYPE_RGB   2
 
#define PNG_COLOR_TYPE_PALETTE   3
 
#define PNG_COLOR_TYPE_GRAY_ALPHA   4
 
#define PNG_COLOR_TYPE_RGB_ALPHA   6
 

Functions

 DEFINE_GUID (BlurEffectGuid, 0x633c80a4, 0x1843, 0x482b, 0x9e, 0xf2, 0xbe, 0x28, 0x34, 0xc5, 0xfd, 0xd4)
 
 DEFINE_GUID (SharpenEffectGuid, 0x63cbf3ee, 0xc526, 0x402c, 0x8f, 0x71, 0x62, 0xc5, 0x40, 0xbf, 0x51, 0x42)
 
 DEFINE_GUID (ColorMatrixEffectGuid, 0x718f2615, 0x7933, 0x40e3, 0xa5, 0x11, 0x5f, 0x68, 0xfe, 0x14, 0xdd, 0x74)
 
 DEFINE_GUID (ColorLUTEffectGuid, 0xa7ce72a9, 0x0f7f, 0x40d7, 0xb3, 0xcc, 0xd0, 0xc0, 0x2d, 0x5c, 0x32, 0x12)
 
 DEFINE_GUID (BrightnessContrastEffectGuid, 0xd3a1dbe1, 0x8ec4, 0x4c17, 0x9f, 0x4c, 0xea, 0x97, 0xad, 0x1c, 0x34, 0x3d)
 
 DEFINE_GUID (HueSaturationLightnessEffectGuid, 0x8b2dd6c3, 0xeb07, 0x4d87, 0xa5, 0xf0, 0x71, 0x08, 0xe2, 0x6a, 0x9c, 0x5f)
 
 DEFINE_GUID (LevelsEffectGuid, 0x99c354ec, 0x2a31, 0x4f3a, 0x8c, 0x34, 0x17, 0xa8, 0x03, 0xb3, 0x3a, 0x25)
 
 DEFINE_GUID (TintEffectGuid, 0x1077af00, 0x2848, 0x4441, 0x94, 0x89, 0x44, 0xad, 0x4c, 0x2d, 0x7a, 0x2c)
 
 DEFINE_GUID (ColorBalanceEffectGuid, 0x537e597d, 0x251e, 0x48da, 0x96, 0x64, 0x29, 0xca, 0x49, 0x6b, 0x70, 0xf8)
 
 DEFINE_GUID (RedEyeCorrectionEffectGuid, 0x74d29d05, 0x69a4, 0x4266, 0x95, 0x49, 0x3c, 0xc5, 0x28, 0x36, 0xb6, 0x32)
 
 DEFINE_GUID (ColorCurveEffectGuid, 0xdd6a0022, 0x58e4, 0x4a67, 0x9d, 0x9b, 0xd4, 0x8e, 0xb8, 0x81, 0xa5, 0x3d)
 
static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat
 
static UINT *static UINT UINT UINT UINT *static GdiplusAbort *static GpStatus (WINGDIPAPI *pGdipInitializePalette)(ColorPalette *
 
static BOOL color_match (ARGB c1, ARGB c2, BYTE max_diff)
 
static void expect_guid (REFGUID expected, REFGUID got, int line, BOOL todo)
 
static void expect_rawformat (REFGUID expected, GpImage *img, int line, BOOL todo)
 
static void test_bufferrawformat (void *buff, int size, REFGUID expected, int line, BOOL todo)
 
static void test_Scan0 (void)
 
static void test_FromGdiDib (void)
 
static void test_GetImageDimension (void)
 
static void test_GdipImageGetFrameDimensionsCount (void)
 
static void test_LoadingImages (void)
 
static void test_SavingImages (void)
 
static void test_encoders (void)
 
static void test_LockBits (void)
 
static void test_LockBits_UserBuf (void)
 
static void test_GdipCreateBitmapFromHBITMAP (void)
 
static void test_GdipGetImageFlags (void)
 
static void test_GdipCloneImage (void)
 
static void test_testcontrol (void)
 
static void test_fromhicon (void)
 
static void test_getrawformat (void)
 
static void test_loadwmf (void)
 
static void test_createfromwmf (void)
 
static void test_createfromwmf_noplaceable (void)
 
static void test_resolution (void)
 
static void test_createhbitmap (void)
 
static void test_getthumbnail (void)
 
static void test_getsetpixel (void)
 
static void check_halftone_palette (ColorPalette *palette)
 
static void test_palette (void)
 
static void test_colormatrix (void)
 
static void test_gamma (void)
 
static void test_multiframegif (void)
 
static void test_rotateflip (void)
 
static void test_remaptable (void)
 
static void test_colorkey (void)
 
static void test_dispose (void)
 
static LONG obj_refcount (void *obj)
 
static GpImageload_image (const BYTE *image_data, UINT image_size, BOOL valid_data, BOOL todo_load)
 
static void test_image_properties (void)
 
static UINT documented_type (UINT type)
 
static void test_tiff_properties (void)
 
static void test_GdipGetAllPropertyItems (void)
 
static void test_tiff_palette (void)
 
static void test_bitmapbits (void)
 
static void test_DrawImage (void)
 
static void test_DrawImage_SourceCopy (void)
 
static void test_GdipDrawImagePointRect (void)
 
static void test_image_format (void)
 
static void test_DrawImage_scale (void)
 
static void test_gif_properties (void)
 
static void test_ARGB_conversion (void)
 
static void test_CloneBitmapArea (void)
 
static BOOL get_encoder_clsid (LPCWSTR mime, GUID *format, CLSID *clsid)
 
static void test_supported_encoders (void)
 
static void test_createeffect (void)
 
static void test_getadjustedpalette (void)
 
static void test_histogram (void)
 
static void test_imageabort (void)
 
static void test_png_color_formats (void)
 
static void test_GdipLoadImageFromStream (void)
 
static BYTEinit_bitmap (UINT *width, UINT *height, UINT *stride)
 
static void test_GdipInitializePalette (void)
 
static void test_tiff_color_formats (void)
 
 START_TEST (image)
 

Variables

static UINT *static HistogramFormat
 
static UINT *static UINT
 
static UINT *static UINT UINT UINT UINT *static GdiplusAbort *static PaletteType
 
static UINT *static UINT UINT UINT UINT *static GdiplusAbort *static INT
 
static UINT *static UINT UINT UINT UINT *static GdiplusAbort *static BOOL
 
static const unsigned char pngimage [285]
 
static const unsigned char gifimage [35]
 
static const unsigned char transparentgif []
 
static const unsigned char bmpimage [66]
 
static const unsigned char jpgimage [285]
 
static const unsigned char tiffimage []
 
static const unsigned char wmfimage [180]
 
static const unsigned char gifanimation [72]
 
static const unsigned char gifanimation2 []
 
static ARGB gifanimation2_pixels [5][4]
 
static const struct tiff_data TIFF_data
 
static const BYTE animatedgif []
 
static const char png_1x1_data []
 
static const struct tiff_1x1_data tiff_1x1_data
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file image.c.

◆ expect

#define expect (   expected,
  got 
)    ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))

Definition at line 56 of file image.c.

◆ expectf

#define expectf (   expected,
  got 
)    ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))

Definition at line 57 of file image.c.

◆ IFD_ASCII

#define IFD_ASCII   2

Definition at line 3456 of file image.c.

◆ IFD_BYTE

#define IFD_BYTE   1

Definition at line 3455 of file image.c.

◆ IFD_DOUBLE

#define IFD_DOUBLE   12

Definition at line 3466 of file image.c.

◆ IFD_FLOAT

#define IFD_FLOAT   11

Definition at line 3465 of file image.c.

◆ IFD_LONG

#define IFD_LONG   4

Definition at line 3458 of file image.c.

◆ IFD_RATIONAL

#define IFD_RATIONAL   5

Definition at line 3459 of file image.c.

◆ IFD_SBYTE

#define IFD_SBYTE   6

Definition at line 3460 of file image.c.

◆ IFD_SHORT

#define IFD_SHORT   3

Definition at line 3457 of file image.c.

◆ IFD_SLONG

#define IFD_SLONG   9

Definition at line 3463 of file image.c.

◆ IFD_SRATIONAL

#define IFD_SRATIONAL   10

Definition at line 3464 of file image.c.

◆ IFD_SSHORT

#define IFD_SSHORT   8

Definition at line 3462 of file image.c.

◆ IFD_UNDEFINED

#define IFD_UNDEFINED   7

Definition at line 3461 of file image.c.

◆ PNG_COLOR_TYPE_GRAY

#define PNG_COLOR_TYPE_GRAY   0

Definition at line 5164 of file image.c.

◆ PNG_COLOR_TYPE_GRAY_ALPHA

#define PNG_COLOR_TYPE_GRAY_ALPHA   4

Definition at line 5167 of file image.c.

◆ PNG_COLOR_TYPE_PALETTE

#define PNG_COLOR_TYPE_PALETTE   3

Definition at line 5166 of file image.c.

◆ PNG_COLOR_TYPE_RGB

#define PNG_COLOR_TYPE_RGB   2

Definition at line 5165 of file image.c.

◆ PNG_COLOR_TYPE_RGB_ALPHA

#define PNG_COLOR_TYPE_RGB_ALPHA   6

Definition at line 5168 of file image.c.

◆ PropertyTagTypeDouble

#define PropertyTagTypeDouble   12

Definition at line 3472 of file image.c.

◆ PropertyTagTypeFloat

#define PropertyTagTypeFloat   11

Definition at line 3471 of file image.c.

◆ PropertyTagTypeSByte

#define PropertyTagTypeSByte   6

Definition at line 3469 of file image.c.

◆ PropertyTagTypeSShort

#define PropertyTagTypeSShort   8

Definition at line 3470 of file image.c.

Function Documentation

◆ check_halftone_palette()

static void check_halftone_palette ( ColorPalette palette)
static

Definition at line 2053 of file image.c.

2054 {
2055  static const BYTE halftone_values[6]={0x00,0x33,0x66,0x99,0xcc,0xff};
2056  UINT i;
2057 
2058  for (i=0; i<palette->Count; i++)
2059  {
2060  ARGB expected=0xff000000;
2061  if (i<8)
2062  {
2063  if (i&1) expected |= 0x800000;
2064  if (i&2) expected |= 0x8000;
2065  if (i&4) expected |= 0x80;
2066  }
2067  else if (i == 8)
2068  {
2069  expected = 0xffc0c0c0;
2070  }
2071  else if (i < 16)
2072  {
2073  if (i&1) expected |= 0xff0000;
2074  if (i&2) expected |= 0xff00;
2075  if (i&4) expected |= 0xff;
2076  }
2077  else if (i < 40)
2078  {
2079  expected = 0x00000000;
2080  }
2081  else
2082  {
2083  expected |= halftone_values[(i-40)%6];
2084  expected |= halftone_values[((i-40)/6)%6] << 8;
2085  expected |= halftone_values[((i-40)/36)%6] << 16;
2086  }
2087  ok(expected == palette->Entries[i], "Expected %.8x, got %.8x, i=%u/%u\n",
2088  expected, palette->Entries[i], i, palette->Count);
2089  }
2090 }
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
Definition: glfuncs.h:248
unsigned char BYTE
Definition: mem.h:68
static HPALETTE palette
Definition: clipboard.c:1345
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
BOOL expected
Definition: store.c:2063
DWORD ARGB

Referenced by test_palette().

◆ color_match()

static BOOL color_match ( ARGB  c1,
ARGB  c2,
BYTE  max_diff 
)
static

Definition at line 59 of file image.c.

60 {
61  if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
62  c1 >>= 8; c2 >>= 8;
63  if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
64  c1 >>= 8; c2 >>= 8;
65  if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
66  c1 >>= 8; c2 >>= 8;
67  if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
68  return TRUE;
69 }
#define abs(i)
Definition: fconv.c:206
#define TRUE
Definition: types.h:120

Referenced by test_colorkey(), test_colormatrix(), test_gamma(), and test_remaptable().

◆ DEFINE_GUID() [1/11]

DEFINE_GUID ( BlurEffectGuid  ,
0x633c80a4  ,
0x1843  ,
0x482b  ,
0x9e  ,
0xf2  ,
0xbe  ,
0x28  ,
0x34  ,
0xc5  ,
0xfd  ,
0xd4   
)

◆ DEFINE_GUID() [2/11]

DEFINE_GUID ( SharpenEffectGuid  ,
0x63cbf3ee  ,
0xc526  ,
0x402c  ,
0x8f  ,
0x71  ,
0x62  ,
0xc5  ,
0x40  ,
0xbf  ,
0x51  ,
0x42   
)

◆ DEFINE_GUID() [3/11]

DEFINE_GUID ( ColorMatrixEffectGuid  ,
0x718f2615  ,
0x7933  ,
0x40e3  ,
0xa5  ,
0x11  ,
0x5f  ,
0x68  ,
0xfe  ,
0x14  ,
0xdd  ,
0x74   
)

◆ DEFINE_GUID() [4/11]

DEFINE_GUID ( ColorLUTEffectGuid  ,
0xa7ce72a9  ,
0x0f7f  ,
0x40d7  ,
0xb3  ,
0xcc  ,
0xd0  ,
0xc0  ,
0x2d  ,
0x5c  ,
0x32  ,
0x12   
)

◆ DEFINE_GUID() [5/11]

DEFINE_GUID ( BrightnessContrastEffectGuid  ,
0xd3a1dbe1  ,
0x8ec4  ,
0x4c17  ,
0x9f  ,
0x4c  ,
0xea  ,
0x97  ,
0xad  ,
0x1c  ,
0x34  ,
0x3d   
)

◆ DEFINE_GUID() [6/11]

DEFINE_GUID ( HueSaturationLightnessEffectGuid  ,
0x8b2dd6c3  ,
0xeb07  ,
0x4d87  ,
0xa5  ,
0xf0  ,
0x71  ,
0x08  ,
0xe2  ,
0x6a  ,
0x9c  ,
0x5f   
)

◆ DEFINE_GUID() [7/11]

DEFINE_GUID ( LevelsEffectGuid  ,
0x99c354ec  ,
0x2a31  ,
0x4f3a  ,
0x8c  ,
0x34  ,
0x17  ,
0xa8  ,
0x03  ,
0xb3  ,
0x3a  ,
0x25   
)

◆ DEFINE_GUID() [8/11]

DEFINE_GUID ( TintEffectGuid  ,
0x1077af00  ,
0x2848  ,
0x4441  ,
0x94  ,
0x89  ,
0x44  ,
0xad  ,
0x4c  ,
0x2d  ,
0x7a  ,
0x2c   
)

◆ DEFINE_GUID() [9/11]

DEFINE_GUID ( ColorBalanceEffectGuid  ,
0x537e597d  ,
0x251e  ,
0x48da  ,
0x96  ,
0x64  ,
0x29  ,
0xca  ,
0x49  ,
0x6b  ,
0x70  ,
0xf8   
)

◆ DEFINE_GUID() [10/11]

DEFINE_GUID ( RedEyeCorrectionEffectGuid  ,
0x74d29d05  ,
0x69a4  ,
0x4266  ,
0x95  ,
0x49  ,
0x3c  ,
0xc5  ,
0x28  ,
0x36  ,
0xb6  ,
0x32   
)

◆ DEFINE_GUID() [11/11]

DEFINE_GUID ( ColorCurveEffectGuid  ,
0xdd6a0022  ,
0x58e4  ,
0x4a67  ,
0x9d  ,
0x9b  ,
0xd4  ,
0x8e  ,
0xb8  ,
0x81  ,
0xa5  ,
0x3d   
)

◆ documented_type()

static UINT documented_type ( UINT  type)
static

Definition at line 3475 of file image.c.

3476 {
3477  switch (type)
3478  {
3483  default: return type;
3484  }
3485 }
#define PropertyTagTypeUndefined
#define PropertyTagTypeFloat
Definition: image.c:3471
#define PropertyTagTypeSByte
Definition: image.c:3469
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PropertyTagTypeByte
#define PropertyTagTypeShort
#define PropertyTagTypeSShort
Definition: image.c:3470
#define PropertyTagTypeDouble
Definition: image.c:3472

Referenced by test_tiff_properties().

◆ expect_guid()

static void expect_guid ( REFGUID  expected,
REFGUID  got,
int  line,
BOOL  todo 
)
static

Definition at line 71 of file image.c.

72 {
73  WCHAR bufferW[39];
74  char buffer[39];
75  char buffer2[39];
76 
77  StringFromGUID2(got, bufferW, ARRAY_SIZE(bufferW));
78  WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
79  StringFromGUID2(expected, bufferW, ARRAY_SIZE(bufferW));
80  WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer2, sizeof(buffer2), NULL, NULL);
82  ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
83 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
BOOL todo
Definition: filedlg.c:313
GLuint buffer
Definition: glext.h:5915
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by expect_rawformat(), test_GdipGetAllPropertyItems(), test_GdipImageGetFrameDimensionsCount(), test_gif_properties(), test_multiframegif(), test_supported_encoders(), and test_tiff_properties().

◆ expect_rawformat()

static void expect_rawformat ( REFGUID  expected,
GpImage img,
int  line,
BOOL  todo 
)
static

Definition at line 85 of file image.c.

86 {
87  GUID raw;
88  GpStatus stat;
89 
91  ok_(__FILE__, line)(stat == Ok, "GdipGetImageRawFormat failed with %d\n", stat);
92  if(stat != Ok) return;
93  expect_guid(expected, &raw, line, todo);
94 }
BOOL todo
Definition: filedlg.c:313
Definition: parser.c:48
GpStatus WINGDIPAPI GdipGetImageRawFormat(GpImage *image, GUID *format)
Definition: image.c:2306
GLint GLvoid * img
Definition: gl.h:1956
Definition: stat.h:55
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
BOOL expected
Definition: store.c:2063
static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo)
Definition: image.c:71
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by test_bufferrawformat(), test_fromhicon(), test_GdipCloneImage(), test_GdipCreateBitmapFromHBITMAP(), and test_multiframegif().

◆ get_encoder_clsid()

static BOOL get_encoder_clsid ( LPCWSTR  mime,
GUID format,
CLSID clsid 
)
static

Definition at line 4782 of file image.c.

4783 {
4784  GpStatus status;
4785  UINT n_codecs, info_size, i;
4787  BOOL ret = FALSE;
4788 
4789  status = GdipGetImageEncodersSize(&n_codecs, &info_size);
4790  expect(Ok, status);
4791 
4792  info = GdipAlloc(info_size);
4793 
4794  status = GdipGetImageEncoders(n_codecs, info_size, info);
4795  expect(Ok, status);
4796 
4797  for (i = 0; i < n_codecs; i++)
4798  {
4799  if (!lstrcmpW(info[i].MimeType, mime))
4800  {
4801  *format = info[i].FormatID;
4802  *clsid = info[i].Clsid;
4803  ret = TRUE;
4804  break;
4805  }
4806  }
4807 
4808  GdipFree(info);
4809  return ret;
4810 }
GpStatus WINGDIPAPI GdipGetImageEncoders(UINT numEncoders, UINT size, ImageCodecInfo *encoders)
Definition: image.c:5021
#define TRUE
Definition: types.h:120
const WCHAR * mime
Definition: mimefilter.c:512
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
void WINGDIPAPI GdipFree(void *ptr)
Definition: gdiplus.c:150
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
struct _test_info info[]
Definition: SetCursorPos.c:19
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
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define expect(expected, got)
Definition: image.c:56
int ret
REFCLSID clsid
Definition: msctf.c:82
GpStatus WINGDIPAPI GdipGetImageEncodersSize(UINT *numEncoders, UINT *size)
Definition: image.c:4997
Status
Definition: gdiplustypes.h:24
unsigned int UINT
Definition: ndis.h:50
void *WINGDIPAPI GdipAlloc(SIZE_T size)
Definition: gdiplus.c:142
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by test_supported_encoders().

◆ GpStatus() [1/2]

static GpStatus ( WINAPI pGdipBitmapGetHistogramSize)
static

Referenced by test_createeffect().

◆ GpStatus() [2/2]

static UINT* static UINT UINT UINT UINT* static GdiplusAbort* static GpStatus ( WINGDIPAPI pGdipInitializePalette)
static

◆ init_bitmap()

static BYTE* init_bitmap ( UINT width,
UINT height,
UINT stride 
)
static

Definition at line 5359 of file image.c.

5360 {
5361  BYTE *src;
5362  UINT i, j, scale;
5363 
5364  *width = 256;
5365  *height = 256;
5366  *stride = (*width * 3 + 3) & ~3;
5367  trace("width %d, height %d, stride %d\n", *width, *height, *stride);
5368 
5369  src = HeapAlloc(GetProcessHeap(), 0, *stride * *height);
5370 
5371  scale = 256 / *width;
5372  if (!scale) scale = 1;
5373 
5374  for (i = 0; i < *height; i++)
5375  {
5376  for (j = 0; j < *width; j++)
5377  {
5378  src[i * *stride + j*3 + 0] = scale * i;
5379  src[i * *stride + j*3 + 1] = scale * (255 - (i+j)/2);
5380  src[i * *stride + j*3 + 2] = scale * j;
5381  }
5382  }
5383 
5384  return src;
5385 }
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
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
Definition: glfuncs.h:248
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
Definition: glfuncs.h:250
GLsizei stride
Definition: glext.h:5848
#define GetProcessHeap()
Definition: compat.h:403
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
unsigned int UINT
Definition: ndis.h:50

Referenced by test_GdipInitializePalette().

◆ load_image()

static GpImage* load_image ( const BYTE image_data,
UINT  image_size,
BOOL  valid_data,
BOOL  todo_load 
)
static

Definition at line 3239 of file image.c.

3240 {
3241  IStream *stream;
3242  HGLOBAL hmem;
3243  BYTE *data;
3244  HRESULT hr;
3245  GpStatus status;
3246  GpImage *image = NULL, *clone;
3247  ImageType image_type;
3248  LONG refcount, old_refcount;
3249 
3250  hmem = GlobalAlloc(0, image_size);
3251  data = GlobalLock(hmem);
3252  memcpy(data, image_data, image_size);
3253  GlobalUnlock(hmem);
3254 
3255  hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
3256  ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
3257  if (hr != S_OK) return NULL;
3258 
3259  refcount = obj_refcount(stream);
3260  ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount);
3261 
3263  todo_wine_if(todo_load)
3264  if (valid_data)
3265  ok(status == Ok || broken(status == InvalidParameter), /* XP */
3266  "GdipLoadImageFromStream error %d\n", status);
3267  else
3268  ok(status != Ok, "GdipLoadImageFromStream should fail\n");
3269  if (status != Ok)
3270  {
3271  IStream_Release(stream);
3272  return NULL;
3273  }
3274 
3275  status = GdipGetImageType(image, &image_type);
3276  ok(status == Ok, "GdipGetImageType error %d\n", status);
3277 
3278  refcount = obj_refcount(stream);
3279  if (image_type == ImageTypeBitmap)
3280  ok(refcount > 1, "expected stream refcount > 1, got %d\n", refcount);
3281  else
3282  ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount);
3283  old_refcount = refcount;
3284 
3285  status = GdipCloneImage(image, &clone);
3286  ok(status == Ok, "GdipCloneImage error %d\n", status);
3287  refcount = obj_refcount(stream);
3288  ok(refcount == old_refcount, "expected stream refcount %d, got %d\n", old_refcount, refcount);
3289  status = GdipDisposeImage(clone);
3290  ok(status == Ok, "GdipDisposeImage error %d\n", status);
3291  refcount = obj_refcount(stream);
3292  ok(refcount == old_refcount, "expected stream refcount %d, got %d\n", old_refcount, refcount);
3293 
3294  refcount = IStream_Release(stream);
3295  if (image_type == ImageTypeBitmap)
3296  ok(refcount >= 1, "expected stream refcount != 0\n");
3297  else
3298  ok(refcount == 0, "expected stream refcount 0, got %d\n", refcount);
3299 
3300  return image;
3301 }
GLeglImageOES image
Definition: gl.h:2204
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT hr
Definition: shlfolder.c:183
GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
Definition: image.c:2318
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
Definition: image.c:1308
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image)
Definition: image.c:4357
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
static LONG obj_refcount(void *obj)
Definition: image.c:3233
#define todo_wine_if(is_todo)
Definition: test.h:155
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
ImageType
Definition: gdiplusenums.h:191
static SERVICE_STATUS status
Definition: service.c:31
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4856
Definition: ps.c:97

Referenced by test_GdipGetAllPropertyItems(), test_gif_properties(), test_image_properties(), test_png_color_formats(), test_tiff_color_formats(), test_tiff_palette(), and test_tiff_properties().

◆ obj_refcount()

static LONG obj_refcount ( void obj)
static

Definition at line 3233 of file image.c.

3234 {
3235  IUnknown_AddRef((IUnknown *)obj);
3236  return IUnknown_Release((IUnknown *)obj);
3237 }

Referenced by load_image().

◆ START_TEST()

START_TEST ( image  )

Definition at line 5682 of file image.c.

5683 {
5684  HMODULE mod = GetModuleHandleA("gdiplus.dll");
5685  struct GdiplusStartupInput gdiplusStartupInput;
5687  HMODULE hmsvcrt;
5688  int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
5689 
5690  /* Enable all FP exceptions except _EM_INEXACT, which gdi32 can trigger */
5691  hmsvcrt = LoadLibraryA("msvcrt");
5692  _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
5693  if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
5694 
5695  gdiplusStartupInput.GdiplusVersion = 1;
5696  gdiplusStartupInput.DebugEventCallback = NULL;
5697  gdiplusStartupInput.SuppressBackgroundThread = 0;
5698  gdiplusStartupInput.SuppressExternalCodecs = 0;
5699 
5700  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
5701 
5702  pGdipBitmapGetHistogramSize = (void*)GetProcAddress(mod, "GdipBitmapGetHistogramSize");
5703  pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram");
5704  pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort");
5705 
5714  test_DrawImage();
5717  test_bitmapbits();
5723  test_Scan0();
5724  test_FromGdiDib();
5729  test_encoders();
5730  test_LockBits();
5735  test_testcontrol();
5736  test_fromhicon();
5738  test_loadwmf();
5741  test_resolution();
5744  test_getsetpixel();
5745  test_palette();
5746  test_colormatrix();
5747  test_gamma();
5749  test_rotateflip();
5750  test_remaptable();
5751  test_colorkey();
5752  test_dispose();
5755  test_histogram();
5756  test_imageabort();
5758 
5760 }
static void test_GdipCreateBitmapFromHBITMAP(void)
Definition: image.c:895
static void test_FromGdiDib(void)
Definition: image.c:185
static void test_DrawImage(void)
Definition: image.c:4142
static void test_getthumbnail(void)
Definition: image.c:1901
static void test_loadwmf(void)
Definition: image.c:1440
static void test_Scan0(void)
Definition: image.c:127
static void test_colorkey(void)
Definition: image.c:3116
static void test_createhbitmap(void)
Definition: image.c:1679
static void test_histogram(void)
Definition: image.c:4969
static void test_GdipImageGetFrameDimensionsCount(void)
Definition: image.c:327
static void test_GdipDrawImagePointRect(void)
Definition: image.c:4238
static void test_createeffect(void)
Definition: image.c:4863
static void test_getsetpixel(void)
Definition: image.c:1973
static void test_palette(void)
Definition: image.c:2092
static void test_GetImageDimension(void)
Definition: image.c:296
static void test_DrawImage_scale(void)
Definition: image.c:4369
static void test_LockBits_UserBuf(void)
Definition: image.c:799
static void test_png_color_formats(void)
Definition: image.c:5170
uint32_t ULONG_PTR
Definition: typedefs.h:63
static void test_GdipLoadImageFromStream(void)
Definition: image.c:5328
GLenum GLint GLuint mask
Definition: glext.h:6028
static void test_remaptable(void)
Definition: image.c:3040
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void test_LoadingImages(void)
Definition: image.c:396
static void test_CloneBitmapArea(void)
Definition: image.c:4757
static void test_encoders(void)
Definition: image.c:507
smooth NULL
Definition: ftsmooth.c:416
static void test_colormatrix(void)
Definition: image.c:2278
static void test_imageabort(void)
Definition: image.c:5097
static void test_rotateflip(void)
Definition: image.c:2920
static void test_bitmapbits(void)
Definition: image.c:3926
static void test_testcontrol(void)
Definition: image.c:1238
static void test_multiframegif(void)
Definition: image.c:2670
static void test_createfromwmf(void)
Definition: image.c:1511
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
Definition: cntrlfp.c:120
static void test_image_properties(void)
Definition: image.c:3303
static void test_supported_encoders(void)
Definition: image.c:4812
static void test_gamma(void)
Definition: image.c:2543
void WINAPI GdiplusShutdown(ULONG_PTR)
static void test_image_format(void)
Definition: image.c:4290
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:81
static ULONG_PTR gdiplusToken
Definition: CImage.cpp:79
static void test_gif_properties(void)
Definition: image.c:4519
static void test_createfromwmf_noplaceable(void)
Definition: image.c:1569
static void test_SavingImages(void)
Definition: image.c:443
static void test_tiff_color_formats(void)
Definition: image.c:5547
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static void test_tiff_palette(void)
Definition: image.c:3878
static void test_LockBits(void)
Definition: image.c:561
static void test_ARGB_conversion(void)
Definition: image.c:4686
static void test_tiff_properties(void)
Definition: image.c:3581
static void test_GdipCloneImage(void)
Definition: image.c:1206
#define CDECL
Definition: compat.h:21
static void test_getrawformat(void)
Definition: image.c:1430
static void test_GdipGetImageFlags(void)
Definition: image.c:1079
static void test_GdipInitializePalette(void)
Definition: image.c:5387
static void test_DrawImage_SourceCopy(void)
Definition: image.c:4194
static void test_getadjustedpalette(void)
Definition: image.c:4904
static void test_dispose(void)
Definition: image.c:3210
#define GetProcAddress(x, y)
Definition: compat.h:418
static void test_GdipGetAllPropertyItems(void)
Definition: image.c:3710
static void test_fromhicon(void)
Definition: image.c:1249
static void test_resolution(void)
Definition: image.c:1585
static int mod
Definition: i386-dis.c:1273
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ test_ARGB_conversion()

static void test_ARGB_conversion ( void  )
static

Definition at line 4686 of file image.c.

4687 {
4688  BYTE argb[8] = { 0x11,0x22,0x33,0x80, 0xff,0xff,0xff,0 };
4689  BYTE pargb[8] = { 0x09,0x11,0x1a,0x80, 0,0,0,0 };
4690  BYTE rgb32_xp[8] = { 0x11,0x22,0x33,0xff, 0xff,0xff,0xff,0xff };
4691  BYTE rgb24[6] = { 0x11,0x22,0x33, 0xff,0xff,0xff };
4692  BYTE *bits;
4693  GpBitmap *bitmap;
4694  BitmapData data;
4695  GpStatus status;
4696  int match;
4697 
4699  expect(Ok, status);
4700 
4702  expect(Ok, status);
4703  ok(data.Width == 2, "expected 2, got %d\n", data.Width);
4704  ok(data.Height == 1, "expected 1, got %d\n", data.Height);
4705  ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
4706  ok(data.PixelFormat == PixelFormat32bppPARGB, "expected PixelFormat32bppPARGB, got %d\n", data.PixelFormat);
4707  match = !memcmp(data.Scan0, pargb, sizeof(pargb));
4708  ok(match, "bits don't match\n");
4709  if (!match)
4710  {
4711  bits = data.Scan0;
4712  trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppPARGB,
4713  bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
4714  }
4716  expect(Ok, status);
4717 
4719  expect(Ok, status);
4720  ok(data.Width == 2, "expected 2, got %d\n", data.Width);
4721  ok(data.Height == 1, "expected 1, got %d\n", data.Height);
4722  ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
4723  ok(data.PixelFormat == PixelFormat32bppRGB, "expected PixelFormat32bppRGB, got %d\n", data.PixelFormat);
4724  match = !memcmp(data.Scan0, argb, sizeof(argb)) ||
4725  !memcmp(data.Scan0, rgb32_xp, sizeof(rgb32_xp));
4726  ok(match, "bits don't match\n");
4727  if (!match)
4728  {
4729  bits = data.Scan0;
4730  trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppRGB,
4731  bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
4732  }
4734  expect(Ok, status);
4735 
4737  expect(Ok, status);
4738  ok(data.Width == 2, "expected 2, got %d\n", data.Width);
4739  ok(data.Height == 1, "expected 1, got %d\n", data.Height);
4740  ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
4741  ok(data.PixelFormat == PixelFormat24bppRGB, "expected PixelFormat24bppRGB, got %d\n", data.PixelFormat);
4742  match = !memcmp(data.Scan0, rgb24, sizeof(rgb24));
4743  ok(match, "bits don't match\n");
4744  if (!match)
4745  {
4746  bits = data.Scan0;
4747  trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat24bppRGB,
4748  bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
4749  }
4751  expect(Ok, status);
4752 
4754 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: match.c:28
#define PixelFormat32bppRGB
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
struct match match
Definition: match.c:33
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
#define trace
Definition: atltest.h:70
#define expect(expected, got)
Definition: image.c:56
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
#define ok(value,...)
Definition: atltest.h:57
#define PixelFormat24bppRGB
#define PixelFormat32bppPARGB
static HBITMAP bitmap
Definition: clipboard.c:1344
static SERVICE_STATUS status
Definition: service.c:31
#define PixelFormat32bppARGB
Definition: ps.c:97

Referenced by START_TEST().

◆ test_bitmapbits()

static void test_bitmapbits ( void  )
static

Definition at line 3926 of file image.c.

3927 {
3928  /* 8 x 2 bitmap */
3929  static const BYTE pixels_24[48] =
3930  {
3931  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3932  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3933  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3934  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0
3935  };
3936  static const BYTE pixels_00[48] =
3937  {
3938  0,0,0, 0,0,0, 0,0,0, 0,0,0,
3939  0,0,0, 0,0,0, 0,0,0, 0,0,0,
3940  0,0,0, 0,0,0, 0,0,0, 0,0,0,
3941  0,0,0, 0,0,0, 0,0,0, 0,0,0
3942  };
3943  static const BYTE pixels_24_77[64] =
3944  {
3945  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3946  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3947  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3948  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3949  0xff,0xff,0xff, 0,0,0, 0xff,0xff,0xff, 0,0,0,
3950  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
3951  };
3952  static const BYTE pixels_77[64] =
3953  {
3954  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3955  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3956  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3957  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3958  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3959  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3960  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3961  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
3962  };
3963  static const BYTE pixels_8[16] =
3964  {
3965  0x01,0,0x01,0,0x01,0,0x01,0,
3966  0x01,0,0x01,0,0x01,0,0x01,0
3967  };
3968  static const BYTE pixels_8_77[64] =
3969  {
3970  0x01,0,0x01,0,0x01,0,0x01,0,
3971  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3972  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3973  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3974  0x01,0,0x01,0,0x01,0,0x01,0,
3975  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3976  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3977  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
3978  };
3979  static const BYTE pixels_1_77[64] =
3980  {
3981  0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3982  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3983  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3984  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3985  0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3986  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3987  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
3988  0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77
3989  };
3990  static const BYTE pixels_1[8] = {0xaa,0,0,0,0xaa,0,0,0};
3991  static const struct test_data
3992  {
3994  UINT bpp;
3996  UINT stride, size;
3997  const BYTE *pixels;
3998  const BYTE *pixels_unlocked;
3999  } td[] =
4000  {
4001  /* 0 */
4002  { PixelFormat24bppRGB, 24, 0xfff0, 24, 48, pixels_24, pixels_00 },
4003 
4004  { PixelFormat24bppRGB, 24, 0, 24, 48, pixels_24, pixels_00 },
4005  { PixelFormat24bppRGB, 24, ImageLockModeRead, 24, 48, pixels_24, pixels_00 },
4006  { PixelFormat24bppRGB, 24, ImageLockModeWrite, 24, 48, pixels_24, pixels_00 },
4007  { PixelFormat24bppRGB, 24, ImageLockModeRead|ImageLockModeWrite, 24, 48, pixels_24, pixels_00 },
4008  { PixelFormat24bppRGB, 24, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_24_77, pixels_24 },
4009  { PixelFormat24bppRGB, 24, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
4010  { PixelFormat24bppRGB, 24, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
4011  /* 8 */
4012  { PixelFormat8bppIndexed, 8, 0, 8, 16, pixels_8, pixels_24 },
4013  { PixelFormat8bppIndexed, 8, ImageLockModeRead, 8, 16, pixels_8, pixels_24 },
4014  { PixelFormat8bppIndexed, 8, ImageLockModeWrite, 8, 16, pixels_8, pixels_00 },
4015  { PixelFormat8bppIndexed, 8, ImageLockModeRead|ImageLockModeWrite, 8, 16, pixels_8, pixels_00 },
4016  { PixelFormat8bppIndexed, 8, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_8_77, pixels_24 },
4017  { PixelFormat8bppIndexed, 8, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
4018  { PixelFormat8bppIndexed, 8, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
4019  /* 15 */
4020  { PixelFormat1bppIndexed, 1, 0, 4, 8, pixels_1, pixels_24 },
4021  { PixelFormat1bppIndexed, 1, ImageLockModeRead, 4, 8, pixels_1, pixels_24 },
4022  { PixelFormat1bppIndexed, 1, ImageLockModeWrite, 4, 8, pixels_1, pixels_00 },
4023  { PixelFormat1bppIndexed, 1, ImageLockModeRead|ImageLockModeWrite, 4, 8, pixels_1, pixels_00 },
4024  { PixelFormat1bppIndexed, 1, ImageLockModeRead|ImageLockModeUserInputBuf, 32, 64, pixels_1_77, pixels_24 },
4025  { PixelFormat1bppIndexed, 1, ImageLockModeWrite|ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_00 },
4026  { PixelFormat1bppIndexed, 1, ImageLockModeUserInputBuf, 32, 64, pixels_77, pixels_24 },
4027  };
4028  BYTE buf[64];
4029  GpStatus status;
4030  GpBitmap *bitmap;
4031  UINT i;
4032  BitmapData data;
4033  struct
4034  {
4035  ColorPalette pal;
4036  ARGB entries[1];
4037  } palette;
4038  ARGB *entries = palette.pal.Entries;
4039 
4040  for (i = 0; i < ARRAY_SIZE(td); i++)
4041  {
4042  BYTE pixels[sizeof(pixels_24)];
4043  memcpy(pixels, pixels_24, sizeof(pixels_24));
4045  expect(Ok, status);
4046 
4047  /* associate known palette with pixel data */
4048  palette.pal.Flags = PaletteFlagsGrayScale;
4049  palette.pal.Count = 2;
4050  entries[0] = 0xff000000;
4051  entries[1] = 0xffffffff;
4053  expect(Ok, status);
4054 
4055  memset(&data, 0xfe, sizeof(data));
4056  if (td[i].mode & ImageLockModeUserInputBuf)
4057  {
4058  memset(buf, 0x77, sizeof(buf));
4059  data.Scan0 = buf;
4060  data.Stride = 32;
4061  }
4063  ok(status == Ok || broken(status == InvalidParameter) /* XP */, "%u: GdipBitmapLockBits error %d\n", i, status);
4064  if (status != Ok)
4065  {
4067  continue;
4068  }
4069  ok(data.Width == 8, "%u: expected 8, got %d\n", i, data.Width);
4070  ok(data.Height == 2, "%u: expected 2, got %d\n", i, data.Height);
4071  ok(td[i].stride == data.Stride, "%u: expected %d, got %d\n", i, td[i].stride, data.Stride);
4072  ok(td[i].format == data.PixelFormat, "%u: expected %d, got %d\n", i, td[i].format, data.PixelFormat);
4073  ok(td[i].size == data.Height * data.Stride, "%u: expected %d, got %d\n", i, td[i].size, data.Height * data.Stride);
4074  if (td[i].mode & ImageLockModeUserInputBuf)
4075  ok(data.Scan0 == buf, "%u: got wrong buffer\n", i);
4076  if (td[i].size == data.Height * data.Stride)
4077  {
4078  UINT j, match, width_bytes = (data.Width * td[i].bpp) / 8;
4079 
4080  match = 1;
4081  for (j = 0; j < data.Height; j++)
4082  {
4083  if (memcmp((const BYTE *)data.Scan0 + j * data.Stride, td[i].pixels + j * data.Stride, width_bytes) != 0)
4084  {
4085  match = 0;
4086  break;
4087  }
4088  }
4089  if ((td[i].mode & (ImageLockModeRead|ImageLockModeUserInputBuf)) || td[i].format == PixelFormat24bppRGB)
4090  {
4091  ok(match,
4092  "%u: data should match\n", i);
4093  if (!match)
4094  {
4095  BYTE *bits = data.Scan0;
4096  trace("%u: data mismatch for format %#x:", i, td[i].format);
4097  for (j = 0; j < td[i].size; j++)
4098  trace(" %02x", bits[j]);
4099  trace("\n");
4100  }
4101  }
4102  else
4103  ok(!match, "%u: data shouldn't match\n", i);
4104 
4105  memset(data.Scan0, 0, td[i].size);
4106  }
4107 
4109  ok(status == Ok, "%u: GdipBitmapUnlockBits error %d\n", i, status);
4110 
4111  memset(&data, 0xfe, sizeof(data));
4113  ok(status == Ok, "%u: GdipBitmapLockBits error %d\n", i, status);
4114  ok(data.Width == 8, "%u: expected 8, got %d\n", i, data.Width);
4115  ok(data.Height == 2, "%u: expected 2, got %d\n", i, data.Height);
4116  ok(data.Stride == 24, "%u: expected 24, got %d\n", i, data.Stride);
4117  ok(data.PixelFormat == PixelFormat24bppRGB, "%u: got wrong pixel format %d\n", i, data.PixelFormat);
4118  ok(data.Height * data.Stride == 48, "%u: expected 48, got %d\n", i, data.Height * data.Stride);
4119  if (data.Height * data.Stride == 48)
4120  {
4121  int match = memcmp(data.Scan0, td[i].pixels_unlocked, 48) == 0;
4122  ok(match, "%u: data should match\n", i);
4123  if (!match)
4124  {
4125  UINT j;
4126  BYTE *bits = data.Scan0;
4127  trace("%u: data mismatch for format %#x:", i, td[i].format);
4128  for (j = 0; j < 48; j++)
4129  trace(" %02x", bits[j]);
4130  trace("\n");
4131  }
4132  }
4133 
4135  ok(status == Ok, "%u: GdipBitmapUnlockBits error %d\n", i, status);
4136 
4138  expect(Ok, status);
4139  }
4140 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
ImageLockMode
Definition: match.c:28
#define PixelFormat1bppIndexed
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
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
Definition: glfuncs.h:248
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
struct match match
Definition: match.c:33
#define PixelFormat8bppIndexed
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
Definition: glfuncs.h:250
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
GLsizei stride
Definition: glext.h:5848
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define expect(expected, got)
Definition: image.c:56
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
INT PixelFormat
static UINT width_bytes(UINT width, UINT bpp)
Definition: tiffformat.c:846
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GLenum mode
Definition: glext.h:6217
static HPALETTE palette
Definition: clipboard.c:1345
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
#define PixelFormat24bppRGB
unsigned int UINT
Definition: ndis.h:50
GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette)
Definition: image.c:4696
DWORD bpp
Definition: surface.c:181
static HBITMAP bitmap
Definition: clipboard.c:1344
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97
DWORD ARGB

Referenced by START_TEST().

◆ test_bufferrawformat()

static void test_bufferrawformat ( void buff,
int  size,
REFGUID  expected,
int  line,
BOOL  todo 
)
static

Definition at line 96 of file image.c.

97 {
99  HGLOBAL hglob;
100  LPBYTE data;
101  HRESULT hres;
102  GpStatus stat;
103  GpImage *img;
104 
105  hglob = GlobalAlloc (0, size);
106  data = GlobalLock (hglob);
107  memcpy(data, buff, size);
108  GlobalUnlock(hglob); data = NULL;
109 
111  ok_(__FILE__, line)(hres == S_OK, "Failed to create a stream\n");
112  if(hres != S_OK) return;
113 
115  ok_(__FILE__, line)(stat == Ok, "Failed to create a Bitmap\n");
116  if(stat != Ok){
117  IStream_Release(stream);
118  return;
119  }
120 
122 
124  IStream_Release(stream);
125 }
static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo)
Definition: image.c:85
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL todo
Definition: filedlg.c:313
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
interface IStream * LPSTREAM
Definition: objfwd.h:10
GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream *stream, GpImage **image)
Definition: image.c:4357
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
GLint GLvoid * img
Definition: gl.h:1956
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
Definition: stat.h:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static unsigned char buff[32768]
Definition: fatten.c:17
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by test_getrawformat().

◆ test_CloneBitmapArea()

static void test_CloneBitmapArea ( void  )
static

Definition at line 4757 of file image.c.

4758 {
4759  GpStatus status;
4760  GpBitmap *bitmap, *copy;
4762 
4764  expect(Ok, status);
4765 
4767  expect(Ok, status);
4768 
4771 
4773  expect(Ok, status);
4774 
4776  expect(Ok, status);
4777 
4780 }
GpStatus WINGDIPAPI GdipCloneBitmapAreaI(INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap)
Definition: image.c:1300
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
#define expect(expected, got)
Definition: image.c:56
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
static const WCHAR data2[]
Definition: db.c:2971
#define PixelFormat24bppRGB
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
static HBITMAP bitmap
Definition: clipboard.c:1344
static SERVICE_STATUS status
Definition: service.c:31
Definition: tftpd.h:137
Definition: ps.c:97

Referenced by START_TEST().

◆ test_colorkey()

static void test_colorkey ( void  )
static

Definition at line 3116 of file image.c.

3117 {
3118  GpStatus stat;
3119  GpImageAttributes *imageattr;
3120  GpBitmap *bitmap1, *bitmap2;
3121  GpGraphics *graphics;
3122  ARGB color;
3123 
3126 
3127  stat = GdipCreateImageAttributes(&imageattr);
3128  expect(Ok, stat);
3129 
3130  stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeCount, TRUE, 0xff405060, 0xff708090);
3132 
3133  stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeAny, TRUE, 0xff405060, 0xff708090);
3135 
3136  stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeDefault, TRUE, 0xff405060, 0xff708090);
3137  expect(Ok, stat);
3138 
3140  expect(Ok, stat);
3141 
3143  expect(Ok, stat);
3144 
3145  stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0x20405060);
3146  expect(Ok, stat);
3147 
3148  stat = GdipBitmapSetPixel(bitmap1, 0, 1, 0x40506070);
3149  expect(Ok, stat);
3150 
3151  stat = GdipBitmapSetPixel(bitmap1, 1, 0, 0x60708090);
3152  expect(Ok, stat);
3153 
3154  stat = GdipBitmapSetPixel(bitmap1, 1, 1, 0xffffffff);
3155  expect(Ok, stat);
3156 
3158  expect(Ok, stat);
3159 
3160  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,2,2, 0,0,2,2,
3161  UnitPixel, imageattr, NULL, NULL);
3162  expect(Ok, stat);
3163 
3164  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
3165  expect(Ok, stat);
3166  ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
3167 
3168  stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color);
3169  expect(Ok, stat);
3170  ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
3171 
3172  stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color);
3173  expect(Ok, stat);
3174  ok(color_match(0x00000000, color, 1), "Expected 00000000, got %.8x\n", color);
3175 
3176  stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color);
3177  expect(Ok, stat);
3178  ok(color_match(0xffffffff, color, 1), "Expected ffffffff, got %.8x\n", color);
3179 
3181  expect(Ok, stat);
3182 
3183  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,2,2, 0,0,2,2,
3184  UnitPixel, imageattr, NULL, NULL);
3185  expect(Ok, stat);
3186 
3187  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
3188  expect(Ok, stat);
3189  ok(color_match(0x20405060, color, 1), "Expected 20405060, got %.8x\n", color);
3190 
3191  stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color);
3192  expect(Ok, stat);
3193  ok(color_match(0x40506070, color, 1), "Expected 40506070, got %.8x\n", color);
3194 
3195  stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color);
3196  expect(Ok, stat);
3197  ok(color_match(0x60708090, color, 1), "Expected 60708090, got %.8x\n", color);
3198 
3199  stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color);
3200  expect(Ok, stat);
3201  ok(color_match(0xffffffff, color, 1), "Expected ffffffff, got %.8x\n", color);
3202 
3203 
3204  GdipDeleteGraphics(graphics);
3205  GdipDisposeImage((GpImage*)bitmap1);
3207  GdipDisposeImageAttributes(imageattr);
3208 }
#define TRUE
Definition: types.h:120
static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff)
Definition: image.c:59
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap *bitmap, INT x, INT y, ARGB color)
Definition: image.c:494
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap *bitmap, INT x, INT y, ARGB *color)
Definition: image.c:288
GLuint color
Definition: glext.h:6243
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
#define expect(expected, got)
Definition: image.c:56
Definition: stat.h:55
GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh)
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes *imageAttr, ColorAdjustType type)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
Definition: graphics.c:3517
static HBITMAP bitmap2
Definition: clipboard.c:1344
#define PixelFormat32bppARGB
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
DWORD ARGB

Referenced by START_TEST().

◆ test_colormatrix()

static void test_colormatrix ( void  )
static

Definition at line 2278 of file image.c.

2279 {
2280  GpStatus stat;
2281  ColorMatrix colormatrix, graymatrix;
2282  GpImageAttributes *imageattr;
2283  const ColorMatrix identity = {{
2284  {1.0,0.0,0.0,0.0,0.0},
2285  {0.0,1.0,0.0,0.0,0.0},
2286  {0.0,0.0,1.0,0.0,0.0},
2287  {0.0,0.0,0.0,1.0,0.0},
2288  {0.0,0.0,0.0,0.0,1.0}}};
2289  const ColorMatrix double_red = {{
2290  {2.0,0.0,0.0,0.0,0.0},
2291  {0.0,1.0,0.0,0.0,0.0},
2292  {0.0,0.0,1.0,0.0,0.0},
2293  {0.0,0.0,0.0,1.0,0.0},
2294  {0.0,0.0,0.0,0.0,1.0}}};
2295  const ColorMatrix asymmetric = {{
2296  {0.0,1.0,0.0,0.0,0.0},
2297  {0.0,0.0,1.0,0.0,0.0},
2298  {0.0,0.0,0.0,1.0,0.0},
2299  {1.0,0.0,0.0,0.0,0.0},
2300  {0.0,0.0,0.0,0.0,1.0}}};
2301  GpBitmap *bitmap1, *bitmap2;
2302  GpGraphics *graphics;
2303  ARGB color;
2304 
2305  colormatrix = identity;
2306  graymatrix = identity;
2307 
2309  TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
2311 
2312  stat = GdipCreateImageAttributes(&imageattr);
2313  expect(Ok, stat);
2314 
2316  TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2317  expect(Ok, stat);
2318 
2322 
2324  TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
2325  expect(Ok, stat);
2326 
2328  TRUE, &colormatrix, NULL, ColorMatrixFlagsSkipGrays);
2329  expect(Ok, stat);
2330 
2332  TRUE, &colormatrix, NULL, ColorMatrixFlagsAltGray);
2334 
2336  TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsAltGray);
2337  expect(Ok, stat);
2338 
2340  TRUE, &colormatrix, &graymatrix, 3);
2342 
2344  TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
2346 
2348  TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
2350 
2353  expect(Ok, stat);
2354 
2355  /* Drawing a bitmap transforms the colors */
2356  colormatrix = double_red;
2358  TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2359  expect(Ok, stat);
2360 
2362  expect(Ok, stat);
2363 
2365  expect(Ok, stat);
2366 
2367  stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff40ccee);
2368  expect(Ok, stat);
2369 
2371  expect(Ok, stat);
2372 
2373  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
2374  UnitPixel, imageattr, NULL, NULL);
2375  expect(Ok, stat);
2376 
2377  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2378  expect(Ok, stat);
2379  expect(0xff80ccee, color);
2380 
2381  colormatrix = asymmetric;
2383  TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2384  expect(Ok, stat);
2385 
2386  stat = GdipBitmapSetPixel(bitmap2, 0, 0, 0);
2387  expect(Ok, stat);
2388 
2389  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
2390  UnitPixel, imageattr, NULL, NULL);
2391  expect(Ok, stat);
2392 
2393  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2394  expect(Ok, stat);
2395  ok(color_match(0xeeff40cc, color, 3), "expected 0xeeff40cc, got 0x%08x\n", color);
2396 
2397  /* Toggle NoOp */
2399  expect(Ok, stat);
2400 
2401  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2402  UnitPixel, imageattr, NULL, NULL);
2403  expect(Ok, stat);
2404 
2405  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2406  expect(Ok, stat);
2407  ok(color_match(0xfefe40cc, color, 3), "expected 0xfefe40cc, got 0x%08x\n", color);
2408 
2410  expect(Ok, stat);
2411 
2412  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2413  UnitPixel, imageattr, NULL, NULL);
2414  expect(Ok, stat);
2415 
2416  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2417  expect(Ok, stat);
2418  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2419 
2421  expect(Ok, stat);
2422 
2424  expect(Ok, stat);
2425 
2426  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2427  UnitPixel, imageattr, NULL, NULL);
2428  expect(Ok, stat);
2429 
2430  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2431  expect(Ok, stat);
2432  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2433 
2434  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2435  UnitPixel, imageattr, NULL, NULL);
2436  expect(Ok, stat);
2437 
2438  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2439  expect(Ok, stat);
2440  ok(color_match(0xff40ccee, color, 1), "Expected ff40ccee, got %.8x\n", color);
2441 
2442  /* Disable adjustment, toggle NoOp */
2444  FALSE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2445  expect(Ok, stat);
2446 
2448  expect(Ok, stat);
2449 
2450  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2451  UnitPixel, imageattr, NULL, NULL);
2452  expect(Ok, stat);
2453 
2454  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2455  expect(Ok, stat);
2456  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2457 
2459  expect(Ok, stat);
2460 
2461  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2462  UnitPixel, imageattr, NULL, NULL);
2463  expect(Ok, stat);
2464 
2465  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2466  expect(Ok, stat);
2467  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2468 
2469  /* Reset with NoOp on, enable adjustment. */
2471  expect(Ok, stat);
2472 
2474  TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2475  expect(Ok, stat);
2476 
2477  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2478  UnitPixel, imageattr, NULL, NULL);
2479  expect(Ok, stat);
2480 
2481  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2482  expect(Ok, stat);
2483  ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color);
2484 
2485  /* Now inhibit specific category. */
2487  expect(Ok, stat);
2488 
2490  TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
2491  expect(Ok, stat);
2492 
2493  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2494  UnitPixel, imageattr, NULL, NULL);
2495  expect(Ok, stat);
2496 
2497  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2498  expect(Ok, stat);
2499  ok(color_match(0xfffe41cc, color, 3), "expected 0xfffe41cc, got 0x%08x\n", color);
2500 
2502  expect(Ok, stat);
2503 
2504  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2505  UnitPixel, imageattr, NULL, NULL);
2506  expect(Ok, stat);
2507 
2508  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2509  expect(Ok, stat);
2510  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2511 
2513  expect(Ok, stat);
2514 
2516  expect(Ok, stat);
2517 
2518  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2519  UnitPixel, imageattr, NULL, NULL);
2520  expect(Ok, stat);
2521 
2522  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2523  expect(Ok, stat);
2524  ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color);
2525 
2527  expect(Ok, stat);
2528 
2529  stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
2530  UnitPixel, imageattr, NULL, NULL);
2531  expect(Ok, stat);
2532 
2533  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2534  expect(Ok, stat);
2535  ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
2536 
2537  GdipDeleteGraphics(graphics);
2538  GdipDisposeImage((GpImage*)bitmap1);
2540  GdipDisposeImageAttributes(imageattr);
2541 }
#define TRUE
Definition: types.h:120
static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff)
Definition: image.c:59
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap *bitmap, INT x, INT y, ARGB color)
Definition: image.c:494
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix *colorMatrix, GDIPCONST ColorMatrix *grayMatrix, ColorMatrixFlags flags)
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap *bitmap, INT x, INT y, ARGB *color)
Definition: image.c:288
GLuint color
Definition: glext.h:6243
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
GpStatus WINGDIPAPI GdipSetImageAttributesNoOp(GpImageAttributes *imageAttr, ColorAdjustType type, BOOL enableFlag)
#define expect(expected, got)
Definition: image.c:56
static const struct d3drm_matrix identity
Definition: frame.c:26
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes *imageAttr, ColorAdjustType type)
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes *imageAttributes, DrawImageAbort callback, VOID *callbackData)
Definition: graphics.c:3517
static HBITMAP bitmap2
Definition: clipboard.c:1344
#define PixelFormat32bppARGB
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
DWORD ARGB

Referenced by START_TEST().

◆ test_createeffect()

static void test_createeffect ( void  )
static

Definition at line 4863 of file image.c.

4864 {
4865  static const GUID noneffect = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa5 } };
4866  GpStatus (WINAPI *pGdipCreateEffect)( const GUID guid, CGpEffect **effect);
4867  GpStatus (WINAPI *pGdipDeleteEffect)( CGpEffect *effect);
4868  GpStatus stat;
4869  CGpEffect *effect;
4870  HMODULE mod = GetModuleHandleA("gdiplus.dll");
4871  int i;
4872  const GUID * const effectlist[] =
4873  {&BlurEffectGuid, &SharpenEffectGuid, &ColorMatrixEffectGuid, &ColorLUTEffectGuid,
4874  &BrightnessContrastEffectGuid, &HueSaturationLightnessEffectGuid, &LevelsEffectGuid,
4875  &TintEffectGuid, &ColorBalanceEffectGuid, &RedEyeCorrectionEffectGuid, &ColorCurveEffectGuid};
4876 
4877  pGdipCreateEffect = (void*)GetProcAddress( mod, "GdipCreateEffect");
4878  pGdipDeleteEffect = (void*)GetProcAddress( mod, "GdipDeleteEffect");
4879  if(!pGdipCreateEffect || !pGdipDeleteEffect)
4880  {
4881  /* GdipCreateEffect/GdipDeleteEffect was introduced in Windows Vista. */
4882  win_skip("GDIPlus version 1.1 not available\n");
4883  return;
4884  }
4885 
4886  stat = pGdipCreateEffect(BlurEffectGuid, NULL);
4888 
4889  stat = pGdipCreateEffect(noneffect, &effect);
4891 
4892  for(i=0; i < ARRAY_SIZE(effectlist); i++)
4893  {
4894  stat = pGdipCreateEffect(*effectlist[i], &effect);
4895  todo_wine expect(Ok, stat);
4896  if(stat == Ok)
4897  {
4898  stat = pGdipDeleteEffect(effect);
4899  expect(Ok, stat);
4900  }
4901  }
4902 }
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
Definition: glfuncs.h:248
const GUID * guid
smooth NULL
Definition: ftsmooth.c:416
#define expect(expected, got)
Definition: image.c:56
#define WINAPI
Definition: msvc.h:8
static GpStatus(WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat
#define todo_wine
Definition: test.h:154
Definition: stat.h:55
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ARRAY_SIZE(a)
Definition: main.h:24
#define GetProcAddress(x, y)
Definition: compat.h:418
#define win_skip
Definition: test.h:141
struct CGpEffect CGpEffect
static int mod
Definition: i386-dis.c:1273

Referenced by START_TEST().

◆ test_createfromwmf()

static void test_createfromwmf ( void  )
static

Definition at line 1511 of file image.c.

1512 {
1513  HMETAFILE hwmf;
1514  GpImage *img;
1515  GpStatus stat;
1516  GpRectF bounds;
1517  GpUnit unit;
1518  REAL res = 12345.0;
1520 
1521  hwmf = SetMetaFileBitsEx(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader),
1523  ok(hwmf != 0, "SetMetaFileBitsEx failed\n");
1524 
1527  expect(Ok, stat);
1528 
1529  stat = GdipGetImageBounds(img, &bounds, &unit);
1530  expect(Ok, stat);
1531  expect(UnitPixel, unit);
1532  expectf(0.0, bounds.X);
1533  expectf(0.0, bounds.Y);
1534  expectf(320.0, bounds.Width);
1535  expectf(320.0, bounds.Height);
1536 
1538  expect(Ok, stat);
1539  expectf(1440.0, res);
1540 
1542  expect(Ok, stat);
1543  expectf(1440.0, res);
1544 
1545  memset(&header, 0, sizeof(header));
1547  expect(Ok, stat);
1548  if (stat == Ok)
1549  {
1551  todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size);
1552  todo_wine expect(0x300, header.Version);
1553  expect(0, header.EmfPlusFlags);
1554  expectf(1440.0, header.DpiX);
1555  expectf(1440.0, header.DpiY);
1556  expect(0, header.X);
1557  expect(0, header.Y);
1558  expect(320, header.Width);
1559  expect(320, header.Height);
1560  expect(1, U(header).WmfHeader.mtType);
1561  expect(0, header.EmfPlusHeaderSize);
1562  expect(0, header.LogicalDpiX);
1563  expect(0, header.LogicalDpiY);
1564  }
1565 
1567 }
HMETAFILE WINAPI SetMetaFileBitsEx(_In_ UINT cbBuffer, _In_reads_bytes_(cbBuffer) CONST BYTE *lpData)
#define TRUE
Definition: types.h:120
Unit
Definition: gdiplusenums.h:25
GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit)
Definition: image.c:2148
GpStatus WINGDIPAPI GdipGetImageVerticalResolution(GpImage *image, REAL *res)
Definition: image.c:2330
#define U(x)
Definition: wordpad.c:44
GpStatus WINGDIPAPI GdipGetImageHorizontalResolution(GpImage *image, REAL *res)
Definition: image.c:2261
static const unsigned char wmfimage[180]
Definition: image.c:1416
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
REAL Height
Definition: gdiplustypes.h:264
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile *metafile, MetafileHeader *header)
Definition: metafile.c:3632
GLint GLvoid * img
Definition: gl.h:1956
REAL X
Definition: gdiplustypes.h:261
#define expect(expected, got)
Definition: image.c:56
#define todo_wine
Definition: test.h:154
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
REAL Width
Definition: gdiplustypes.h:263
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
Definition: metafile.c:3845
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define expectf(expected, got)
Definition: image.c:57
float REAL
Definition: types.h:41
REAL Y
Definition: gdiplustypes.h:262
#define memset(x, y, z)
Definition: compat.h:39
struct CFHEADER header
Definition: fdi.c:101

Referenced by START_TEST().

◆ test_createfromwmf_noplaceable()

static void test_createfromwmf_noplaceable ( void  )
static

Definition at line 1569 of file image.c.

1570 {
1571  HMETAFILE hwmf;
1572  GpImage *img;
1573  GpStatus stat;
1574 
1575  hwmf = SetMetaFileBitsEx(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader),
1577  ok(hwmf != 0, "SetMetaFileBitsEx failed\n");
1578 
1580  expect(Ok, stat);
1581 
1583 }
HMETAFILE WINAPI SetMetaFileBitsEx(_In_ UINT cbBuffer, _In_reads_bytes_(cbBuffer) CONST BYTE *lpData)
#define TRUE
Definition: types.h:120
static const unsigned char wmfimage[180]
Definition: image.c:1416
smooth NULL
Definition: ftsmooth.c:416
GLint GLvoid * img
Definition: gl.h:1956
#define expect(expected, got)
Definition: image.c:56
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
Definition: metafile.c:3845
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_createhbitmap()

static void test_createhbitmap ( void  )
static

Definition at line 1679 of file image.c.

1680 {
1681  GpStatus stat;
1682  GpBitmap *bitmap;
1683  HBITMAP hbitmap, oldhbitmap;
1684  BITMAP bm;
1685  int ret;
1686  HDC hdc;
1687  COLORREF pixel;
1688  BYTE bits[640];
1689  BitmapData lockeddata;
1690 
1691  memset(bits, 0x68, 640);
1692 
1693  /* create Bitmap */
1695  expect(Ok, stat);
1696 
1697  /* test NULL values */
1700 
1703 
1704  /* create HBITMAP */
1706  expect(Ok, stat);
1707 
1708  if (stat == Ok)
1709  {
1710  ret = GetObjectA(hbitmap, sizeof(BITMAP), &bm);
1711  expect(sizeof(BITMAP), ret);
1712 
1713  expect(0, bm.bmType);
1714  expect(10, bm.bmWidth);
1715  expect(20, bm.bmHeight);
1716  expect(40, bm.bmWidthBytes);
1717  expect(1, bm.bmPlanes);
1718  expect(32, bm.bmBitsPixel);
1719  ok(bm.bmBits != NULL, "got DDB, expected DIB\n");
1720 
1721  if (bm.bmBits)
1722  {
1723  DWORD val = *(DWORD*)bm.bmBits;
1724  ok(val == 0xff686868, "got %x, expected 0xff686868\n", val);
1725  }
1726 
1728 
1729  oldhbitmap = SelectObject(hdc, hbitmap);
1730  pixel = GetPixel(hdc, 5, 5);
1731  SelectObject(hdc, oldhbitmap);
1732 
1733  DeleteDC(hdc);
1734 
1735  expect(0x686868, pixel);
1736 
1738  }
1739 
1741  expect(Ok, stat);
1742 
1743  /* make (1,0) have no alpha and (2,0) a different blue value. */
1744  bits[7] = 0x00;
1745  bits[8] = 0x40;
1746 
1747  /* create alpha Bitmap */
1749  expect(Ok, stat);
1750 
1751  /* create HBITMAP */
1753  expect(Ok, stat);
1754 
1755  if (stat == Ok)
1756  {
1757  ret = GetObjectA(hbitmap, sizeof(BITMAP), &bm);
1758  expect(sizeof(BITMAP), ret);
1759 
1760  expect(0, bm.bmType);
1761  expect(8, bm.bmWidth);
1762  expect(20, bm.bmHeight);
1763  expect(32, bm.bmWidthBytes);
1764  expect(1, bm.bmPlanes);
1765  expect(32, bm.bmBitsPixel);
1766  ok(bm.bmBits != NULL, "got DDB, expected DIB\n");
1767 
1768  if (bm.bmBits)
1769  {
1770  DWORD val = *(DWORD*)bm.bmBits;
1771  ok(val == 0x682a2a2a, "got %x, expected 0x682a2a2a\n", val);
1772  val = *((DWORD*)bm.bmBits + (bm.bmHeight-1) * bm.bmWidthBytes/4 + 1);
1773  ok(val == 0x0, "got %x, expected 0x682a2a2a\n", val);
1774  }
1775 
1777 
1778  oldhbitmap = SelectObject(hdc, hbitmap);
1779  pixel = GetPixel(hdc, 5, 5);
1780  expect(0x2a2a2a, pixel);
1781  pixel = GetPixel(hdc, 1, 0);
1782  expect(0x0, pixel);
1783 
1784  SelectObject(hdc, oldhbitmap);
1785 
1786  DeleteDC(hdc);
1787 
1788 
1790  }
1791 
1792  /* create HBITMAP with bkgnd colour */
1793  /* gdiplus.dll 5.1 is broken and only applies the blue value */
1795  expect(Ok, stat);
1796 
1797  if (stat == Ok)
1798  {
1799  ret = GetObjectA(hbitmap, sizeof(BITMAP), &bm);
1800  expect(sizeof(BITMAP), ret);
1801 
1802  expect(0, bm.bmType);
1803  expect(8, bm.bmWidth);
1804  expect(20, bm.bmHeight);
1805  expect(32, bm.bmWidthBytes);
1806  expect(1, bm.bmPlanes);
1807  expect(32, bm.bmBitsPixel);
1808  ok(bm.bmBits != NULL, "got DDB, expected DIB\n");
1809 
1810  if (bm.bmBits)
1811  {
1812  DWORD val = *(DWORD*)bm.bmBits;
1813  ok(val == 0x68c12ac1 || broken(val == 0x682a2ac1), "got %x, expected 0x68c12ac1\n", val);
1814  val = *((DWORD*)bm.bmBits + (bm.bmHeight-1) * bm.bmWidthBytes/4 + 1);
1815  ok(val == 0xff00ff || broken(val == 0xff), "got %x, expected 0xff00ff\n", val);
1816  }
1817 
1819 
1820  oldhbitmap = SelectObject(hdc, hbitmap);
1821  pixel = GetPixel(hdc, 5, 5);
1822  ok(pixel == 0xc12ac1 || broken(pixel == 0xc12a2a), "got %x, expected 0xc12ac1\n", pixel);
1823  pixel = GetPixel(hdc, 1, 0);
1824  ok(pixel == 0xff00ff || broken(pixel == 0xff0000), "got %x, expected 0xff00ff\n", pixel);
1825  pixel = GetPixel(hdc, 2, 0);
1826  ok(pixel == 0xb12ac1 || broken(pixel == 0xb12a2a), "got %x, expected 0xb12ac1\n", pixel);
1827 
1828  SelectObject(hdc, oldhbitmap);
1829  DeleteDC(hdc);
1831  }
1832 
1833  /* create HBITMAP with bkgnd colour with alpha and show it behaves with no alpha. */
1835  expect(Ok, stat);
1836 
1837  if (stat == Ok)
1838  {
1839  ret = GetObjectA(hbitmap, sizeof(BITMAP), &bm);
1840  expect(sizeof(BITMAP), ret);
1841 
1842  expect(0, bm.bmType);
1843  expect(8, bm.bmWidth);
1844  expect(20, bm.bmHeight);
1845  expect(32, bm.bmWidthBytes);
1846  expect(1, bm.bmPlanes);
1847  expect(32, bm.bmBitsPixel);
1848  ok(bm.bmBits != NULL, "got DDB, expected DIB\n");
1849 
1850  if (bm.bmBits)
1851  {
1852  DWORD val = *(DWORD*)bm.bmBits;
1853  ok(val == 0x68c12ac1 || broken(val == 0x682a2ac1), "got %x, expected 0x68c12ac1\n", val);
1854  val = *((DWORD*)bm.bmBits + (bm.bmHeight-1) * bm.bmWidthBytes/4 + 1);
1855  ok(val == 0xff00ff || broken(val == 0xff), "got %x, expected 0xff00ff\n", val);
1856  }
1857 
1859 
1860  oldhbitmap = SelectObject(hdc, hbitmap);
1861  pixel = GetPixel(hdc, 5, 5);
1862  ok(pixel == 0xc12ac1 || broken(pixel == 0xc12a2a), "got %x, expected 0xc12ac1\n", pixel);
1863  pixel = GetPixel(hdc, 1, 0);
1864  ok(pixel == 0xff00ff || broken(pixel == 0xff0000), "got %x, expected 0xff00ff\n", pixel);
1865  pixel = GetPixel(hdc, 2, 0);
1866  ok(pixel == 0xb12ac1 || broken(pixel == 0xb12a2a), "got %x, expected 0xb12ac1\n", pixel);
1867 
1868  SelectObject(hdc, oldhbitmap);
1869  DeleteDC(hdc);
1871  }
1872 
1874  expect(Ok, stat);
1875 
1876  /* create HBITMAP from locked data */
1877  memset(bits, 0x68, 640);
1879  expect(Ok, stat);
1880 
1881  memset(&lockeddata, 0, sizeof(lockeddata));
1883  PixelFormat32bppRGB, &lockeddata);
1884  expect(Ok, stat);
1885  ((DWORD*)lockeddata.Scan0)[0] = 0xff242424;
1887  expect(Ok, stat);
1888  stat = GdipBitmapUnlockBits(bitmap, &lockeddata);
1889  expect(Ok, stat);
1891  expect(Ok, stat);
1892 
1894  oldhbitmap = SelectObject(hdc, hbitmap);
1895  pixel = GetPixel(hdc, 0, 0);
1896  expect(0x686868, pixel);
1897  SelectObject(hdc, oldhbitmap);
1898  DeleteDC(hdc);
1899 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
GLint x0
Definition: linetemp.h:95
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PixelFormat32bppRGB
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
GLuint GLfloat * val
Definition: glext.h:7180
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
DWORD COLORREF
Definition: windef.h:285
#define expect(expected, got)
Definition: image.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap *bitmap, HBITMAP *hbmReturn, ARGB background)
Definition: image.c:1479
int ret
HDC hdc
Definition: main.c:9
Definition: stat.h:55
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
BOOL WINAPI DeleteDC(_In_ HDC)
#define ok(value,...)
Definition: atltest.h:57
Definition: bl.h:1331
#define PixelFormat24bppRGB
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP hbitmap
static HBITMAP
Definition: button.c:44
#define memset(x, y, z)
Definition: compat.h:39
#define PixelFormat32bppARGB

Referenced by START_TEST().

◆ test_dispose()

static void test_dispose ( void  )
static

Definition at line 3210 of file image.c.

3211 {
3212  GpStatus stat;
3213  GpImage *image;
3214  char invalid_image[256];
3215 
3218 
3220  expect(Ok, stat);
3221 
3223  expect(Ok, stat);
3224 
3227 
3228  memset(invalid_image, 0, 256);
3229  stat = GdipDisposeImage((GpImage*)invalid_image);
3231 }
GLeglImageOES image
Definition: gl.h:2204
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
#define expect(expected, got)
Definition: image.c:56
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define memset(x, y, z)
Definition: compat.h:39
#define PixelFormat32bppARGB

Referenced by START_TEST().

◆ test_DrawImage()

static void test_DrawImage ( void  )
static

Definition at line 4142 of file image.c.

4143 {
4144  BYTE black_1x1[4] = { 0,0,0,0 };
4145  BYTE white_2x2[16] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
4146  0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };
4147  BYTE black_2x2[16] = { 0,0,0,0,0,0,0xff,0xff,
4148  0,0,0,0,0,0,0xff,0xff };
4149  GpStatus status;
4150  union
4151  {
4152  GpBitmap *bitmap;
4153  GpImage *image;
4154  } u1, u2;
4155  GpGraphics *graphics;
4156  int match;
4157 
4158  status = GdipCreateBitmapFromScan0(1, 1, 4, PixelFormat24bppRGB, black_1x1, &u1.bitmap);
4159  expect(Ok, status);
4160  status = GdipBitmapSetResolution(u1.bitmap, 100.0, 100.0);
4161  expect(Ok, status);
4162 
4163  status = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat24bppRGB, white_2x2, &u2.bitmap);
4164  expect(Ok, status);
4165  status = GdipBitmapSetResolution(u2.bitmap, 300.0, 300.0);
4166  expect(Ok, status);
4167  status = GdipGetImageGraphicsContext(u2.image, &graphics);
4168  expect(Ok, status);
4170  expect(Ok, status);
4171 
4172  status = GdipDrawImageI(graphics, u1.image, 0, 0);
4173  expect(Ok, status);
4174 
4175  match = memcmp(white_2x2, black_2x2, sizeof(black_2x2)) == 0;
4176  ok(match, "data should match\n");
4177  if (!match)
4178  {
4179  UINT i, size = sizeof(white_2x2);
4180  BYTE *bits = white_2x2;
4181  for (i = 0; i < size; i++)
4182  trace(" %02x", bits[i]);
4183  trace("\n");
4184  }
4185 
4186  status = GdipDeleteGraphics(graphics);
4187  expect(Ok, status);
4188  status = GdipDisposeImage(u1.image);
4189  expect(Ok, status);
4190  status = GdipDisposeImage(u2.image);
4191  expect(Ok, status);
4192 }
GLeglImageOES image
Definition: gl.h:2204
GLdouble GLdouble u2
Definition: glext.h:8308
GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y)
Definition: graphics.c:2985
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: match.c:28
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GLdouble u1
Definition: glext.h:8308
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
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
Definition: glfuncs.h:248
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
struct match match
Definition: match.c:33
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
#define expect(expected, got)
Definition: image.c:56
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
#define ok(value,...)
Definition: atltest.h:57
#define PixelFormat24bppRGB
unsigned int UINT
Definition: ndis.h:50
GpStatus WINGDIPAPI GdipBitmapSetResolution(GpBitmap *bitmap, REAL xdpi, REAL ydpi)
Definition: image.c:1163
static HBITMAP bitmap
Definition: clipboard.c:1344
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by START_TEST().

◆ test_DrawImage_scale()

static void test_DrawImage_scale ( void  )
static

Definition at line 4369 of file image.c.

4370 {
4371  static const BYTE back_8x1[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
4372  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4373  static const BYTE image_080[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40,
4374  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4375  static const BYTE image_100[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40,
4376  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4377  static const BYTE image_120[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x40,
4378  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4379  static const BYTE image_150[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,
4380  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4381  static const BYTE image_180[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,
4382  0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4383  static const BYTE image_200[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,
4384  0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4385  static const BYTE image_250[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,
4386  0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40 };
4387  static const BYTE image_120_half[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
4388  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4389  static const BYTE image_150_half[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
4390  0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 };
4391  static const BYTE image_200_half[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,
4392  0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40 };
4393  static const BYTE image_250_half[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,
4394  0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40 };
4395  static const struct test_data
4396  {
4397  REAL scale_x;
4398  PixelOffsetMode pixel_offset_mode;
4399  const BYTE *image;
4400  BOOL todo;
4401  } td[] =
4402  {
4403  { 0.8, PixelOffsetModeNone, image_080 }, /* 0 */
4404  { 1.0, PixelOffsetModeNone, image_100 },
4405  { 1.2, PixelOffsetModeNone, image_120 },
4406  { 1.5, PixelOffsetModeNone, image_150 },
4407  { 1.8, PixelOffsetModeNone, image_180 },
4408  { 2.0, PixelOffsetModeNone, image_200 },
4409  { 2.5, PixelOffsetModeNone, image_250 },
4410 
4411  { 0.8, PixelOffsetModeHighSpeed, image_080 }, /* 7 */
4412  { 1.0, PixelOffsetModeHighSpeed, image_100 },
4413  { 1.2, PixelOffsetModeHighSpeed, image_120 },
4414  { 1.5, PixelOffsetModeHighSpeed, image_150 },
4415  { 1.8, PixelOffsetModeHighSpeed, image_180 },
4416  { 2.0, PixelOffsetModeHighSpeed, image_200 },
4417  { 2.5, PixelOffsetModeHighSpeed, image_250 },
4418 
4419  { 0.8, PixelOffsetModeHalf, image_080 }, /* 14 */
4420  { 1.0, PixelOffsetModeHalf, image_100 },
4421  { 1.2, PixelOffsetModeHalf, image_120_half, TRUE },
4422  { 1.5, PixelOffsetModeHalf, image_150_half, TRUE },
4423  { 1.8, PixelOffsetModeHalf, image_180 },
4424  { 2.0, PixelOffsetModeHalf, image_200_half, TRUE },
4425  { 2.5, PixelOffsetModeHalf, image_250_half, TRUE },
4426 
4427  { 0.8, PixelOffsetModeHighQuality, image_080 }, /* 21 */
4428  { 1.0, PixelOffsetModeHighQuality, image_100 },
4429  { 1.2, PixelOffsetModeHighQuality, image_120_half, TRUE },
4430  { 1.5, PixelOffsetModeHighQuality, image_150_half, TRUE },
4431  { 1.8, PixelOffsetModeHighQuality, image_180 },
4432  { 2.0, PixelOffsetModeHighQuality, image_200_half, TRUE },
4433  { 2.5, PixelOffsetModeHighQuality, image_250_half, TRUE },
4434  };
4435  BYTE src_2x1[6] = { 0x80,0x80,0x80,0x80,0x80,0x80 };
4436  BYTE dst_8x1[24];
4437  GpStatus status;
4438  union
4439  {
4440  GpBitmap *bitmap;
4441  GpImage *image;
4442  } u1, u2;
4443  GpGraphics *graphics;
4444  GpMatrix *matrix;
4445  int i, match;
4446 
4447  status = GdipCreateBitmapFromScan0(2, 1, 4, PixelFormat24bppRGB, src_2x1, &u1.bitmap);
4448  expect(Ok, status);
4449  status = GdipBitmapSetResolution(u1.bitmap, 100.0, 100.0);
4450  expect(Ok, status);
4451 
4452  status = GdipCreateBitmapFromScan0(8, 1, 24, PixelFormat24bppRGB, dst_8x1, &u2.bitmap);
4453  expect(Ok, status);
4454  status = GdipBitmapSetResolution(u2.bitmap, 100.0, 100.0);
4455  expect(Ok, status);
4456  status = GdipGetImageGraphicsContext(u2.image, &graphics);
4457  expect(Ok, status);
4459  expect(Ok, status);
4460 
4461  for (i = 0; i < ARRAY_SIZE(td); i++)
4462  {
4463  status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode);
4464  expect(Ok, status);
4465 
4466  status = GdipCreateMatrix2(td[i].scale_x, 0.0, 0.0, 1.0, 0.0, 0.0, &matrix);
4467  expect(Ok, status);
4468  status = GdipSetWorldTransform(graphics, matrix);
4469  expect(Ok, status);
4471 
4472  memcpy(dst_8x1, back_8x1, sizeof(dst_8x1));
4473  status = GdipDrawImageI(graphics, u1.image, 1, 0);
4474  expect(Ok, status);
4475 
4476  match = memcmp(dst_8x1, td[i].image, sizeof(dst_8x1)) == 0;
4477  todo_wine_if (!match && td[i].todo)
4478  ok(match, "%d: data should match\n", i);
4479  if (!match)
4480  {
4481  UINT i, size = sizeof(dst_8x1);
4482  const BYTE *bits = dst_8x1;
4483  for (i = 0; i < size; i++)
4484  trace(" %02x", bits[i]);
4485  trace("\n");
4486  }
4487  }
4488 
4489  status = GdipDeleteGraphics(graphics);
4490  expect(Ok, status);
4491  status = GdipDisposeImage(u1.image);
4492  expect(Ok, status);
4493  status = GdipDisposeImage(u2.image);
4494  expect(Ok, status);
4495 }
GpStatus WINGDIPAPI GdipSetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode mode)
Definition: graphics.c:6229
GLeglImageOES image
Definition: gl.h:2204
GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix)
Definition: graphics.c:6358
GLdouble GLdouble u2
Definition: glext.h:8308
#define TRUE
Definition: types.h:120
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix)
Definition: matrix.c:61
GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y)
Definition: graphics.c:2985
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: match.c:28
GLuint GLenum matrix
Definition: glext.h:9407
BOOL todo
Definition: filedlg.c:313
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GLdouble u1
Definition: glext.h:8308
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
PixelOffsetMode
Definition: gdiplusenums.h:158
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
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
struct match match
Definition: match.c:33
#define todo_wine_if(is_todo)
Definition: test.h:155
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
#define expect(expected, got)
Definition: image.c:56
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:160
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define PixelFormat24bppRGB
unsigned int UINT
Definition: ndis.h:50
GpStatus WINGDIPAPI GdipBitmapSetResolution(GpBitmap *bitmap, REAL xdpi, REAL ydpi)
Definition: image.c:1163
static HBITMAP bitmap
Definition: clipboard.c:1344
float REAL
Definition: types.h:41
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by START_TEST().

◆ test_DrawImage_SourceCopy()

static void test_DrawImage_SourceCopy ( void  )
static

Definition at line 4194 of file image.c.

4195 {
4196  DWORD dst_pixels[4] = { 0xffffffff, 0xffffffff,
4197  0xffffffff, 0xffffffff };
4198  DWORD src_pixels[4] = { 0, 0xffff0000,
4199  0, 0xff00ff };
4200 
4201  GpStatus status;
4202  union
4203  {
4204  GpBitmap *bitmap;
4205  GpImage *image;
4206  } u1, u2;
4207  GpGraphics *graphics;
4208 
4209  status = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat32bppARGB, (BYTE*)dst_pixels, &u1.bitmap);
4210  expect(Ok, status);
4211 
4212  status = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat32bppARGB, (BYTE*)src_pixels, &u2.bitmap);
4213  expect(Ok, status);
4214  status = GdipGetImageGraphicsContext(u1.image, &graphics);
4215  expect(Ok, status);
4217  expect(Ok, status);
4218 
4220  expect(Ok, status);
4221 
4222  status = GdipDrawImageI(graphics, u2.image, 0, 0);
4223  expect(Ok, status);
4224 
4225  todo_wine expect(0, dst_pixels[0]);
4226  expect(0xffff0000, dst_pixels[1]);
4227  todo_wine expect(0, dst_pixels[2]);
4228  todo_wine expect(0, dst_pixels[3]);
4229 
4230  status = GdipDeleteGraphics(graphics);
4231  expect(Ok, status);
4232  status = GdipDisposeImage(u1.image);
4233  expect(Ok, status);
4234  status = GdipDisposeImage(u2.image);
4235  expect(Ok, status);
4236 }
GLeglImageOES image
Definition: gl.h:2204
GLdouble GLdouble u2
Definition: glext.h:8308
GpStatus WINGDIPAPI GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y)
Definition: graphics.c:2985
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GLdouble u1
Definition: glext.h:8308
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
GpStatus WINGDIPAPI GdipSetCompositingMode(GpGraphics *graphics, CompositingMode mode)
Definition: graphics.c:6085
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
GpStatus WINGDIPAPI GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode mode)
Definition: graphics.c:6143
#define expect(expected, got)
Definition: image.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define todo_wine
Definition: test.h:154
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
static HBITMAP bitmap
Definition: clipboard.c:1344
static SERVICE_STATUS status
Definition: service.c:31
#define PixelFormat32bppARGB
Definition: ps.c:97

Referenced by START_TEST().

◆ test_encoders()

static void test_encoders ( void  )
static

Definition at line 507 of file image.c.

508 {
509  GpStatus stat;
510  UINT n;
511  UINT s;
513  int i;
514  int bmp_found;
515 
516  static const CHAR bmp_format[] = "BMP";
517 
519  expect(stat, Ok);
520 
521  codecs = GdipAlloc(s);
522  if (!codecs)
523  return;
524 
527 
530 
533 
536 
538  expect(stat, Ok);
539 
540  bmp_found = FALSE;
541  for (i = 0; i < n; i++)
542  {
543  CHAR desc[32];
544 
545  WideCharToMultiByte(CP_ACP, 0, codecs[i].FormatDescription, -1,
546  desc, 32, 0, 0);
547 
549  desc, -1,
550  bmp_format, -1) == CSTR_EQUAL) {
551  bmp_found = TRUE;
552  break;
553  }
554  }
555  if (!bmp_found)
556  ok(FALSE, "No BMP codec found.\n");
557 
558  GdipFree(codecs);
559 }
GpStatus WINGDIPAPI GdipGetImageEncoders(UINT numEncoders, UINT size, ImageCodecInfo *encoders)
Definition: image.c:5021
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
static const struct image_codec codecs[NUM_CODECS]
Definition: image.c:4235
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
GLdouble n
Definition: glext.h:7729
void WINGDIPAPI GdipFree(void *ptr)
Definition: gdiplus.c:150
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
Definition: glfuncs.h:248
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: lang.c:2299
#define expect(expected, got)
Definition: image.c:56
#define LOCALE_SYSTEM_DEFAULT
Definition: stat.h:55
#define CSTR_EQUAL
Definition: winnls.h:453
GLdouble s
Definition: gl.h:2039
GpStatus WINGDIPAPI GdipGetImageEncodersSize(UINT *numEncoders, UINT *size)
Definition: image.c:4997
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
void *WINGDIPAPI GdipAlloc(SIZE_T size)
Definition: gdiplus.c:142
static const WCHAR bmp_format[]
Definition: image.c:4727

Referenced by START_TEST().

◆ test_FromGdiDib()

static void test_FromGdiDib ( void  )
static

Definition at line 185 of file image.c.

186 {
187  GpBitmap *bm;
188  GpStatus stat;
189  BYTE buff[400];
190  BYTE rbmi[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)];
191  BITMAPINFO *bmi = (BITMAPINFO*)rbmi;
193 
194  bm = NULL;
195 
196  memset(rbmi, 0, sizeof(rbmi));
197 
198  bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
199  bmi->bmiHeader.biWidth = 10;
200  bmi->bmiHeader.biHeight = 10;
201  bmi->bmiHeader.biPlanes = 1;
202  bmi->bmiHeader.biBitCount = 32;
204 
207 
208  stat = GdipCreateBitmapFromGdiDib(bmi, NULL, &bm);
210 
213 
214  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
215  expect(Ok, stat);
216  ok(NULL != bm, "Expected bitmap to be initialized\n");
217  if (stat == Ok)
218  {
220  expect(Ok, stat);
222 
224  }
225 
226  bmi->bmiHeader.biBitCount = 24;
227  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
228  expect(Ok, stat);
229  ok(NULL != bm, "Expected bitmap to be initialized\n");
230  if (stat == Ok)
231  {
233  expect(Ok, stat);
235 
237  }
238 
239  bmi->bmiHeader.biBitCount = 16;
240  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
241  expect(Ok, stat);
242  ok(NULL != bm, "Expected bitmap to be initialized\n");
243  if (stat == Ok)
244  {
246  expect(Ok, stat);
248 
250  }
251 
252  bmi->bmiHeader.biBitCount = 8;
253  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
254  expect(Ok, stat);
255  ok(NULL != bm, "Expected bitmap to be initialized\n");
256  if (stat == Ok)
257  {
259  expect(Ok, stat);
261 
263  }
264 
265  bmi->bmiHeader.biBitCount = 4;
266  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
267  expect(Ok, stat);
268  ok(NULL != bm, "Expected bitmap to be initialized\n");
269  if (stat == Ok)
270  {
272  expect(Ok, stat);
274 
276  }
277 
278  bmi->bmiHeader.biBitCount = 1;
279  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
280  expect(Ok, stat);
281  ok(NULL != bm, "Expected bitmap to be initialized\n");
282  if (stat == Ok)
283  {
285  expect(Ok, stat);
287 
289  }
290 
291  bmi->bmiHeader.biBitCount = 0;
292  stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
294 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define PixelFormat1bppIndexed
GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO *info, VOID *bits, GpBitmap **bitmap)
Definition: image.c:1385
#define PixelFormat32bppRGB
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
#define PixelFormat8bppIndexed
#define PixelFormat4bppIndexed
GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
Definition: image.c:2291
#define PixelFormat16bppRGB555
#define expect(expected, got)
Definition: image.c:56
INT PixelFormat
Definition: stat.h:55
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define ok(value,...)
Definition: atltest.h:57
#define PixelFormat24bppRGB
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by START_TEST().

◆ test_fromhicon()

static void test_fromhicon ( void  )
static

Definition at line 1249 of file image.c.

1250 {
1251  static const BYTE bmp_bits[1024];
1252  HBITMAP hbmMask, hbmColor;
1253  ICONINFO info;
1254  HICON hIcon;
1255  GpStatus stat;
1256  GpBitmap *bitmap = NULL;
1257  UINT dim;
1258  ImageType type;
1260 
1261  /* NULL */
1266 
1267  /* color icon 1 bit */
1268  hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits);
1269  ok(hbmMask != 0, "CreateBitmap failed\n");
1270  hbmColor = CreateBitmap(16, 16, 1, 1, bmp_bits);
1271  ok(hbmColor != 0, "CreateBitmap failed\n");
1272  info.fIcon = TRUE;
1273  info.xHotspot = 8;
1274  info.yHotspot = 8;
1275  info.hbmMask = hbmMask;
1276  info.hbmColor = hbmColor;
1278  ok(hIcon != 0, "CreateIconIndirect failed\n");
1279  DeleteObject(hbmMask);
1280  DeleteObject(hbmColor);
1281 
1283  ok(stat == Ok ||
1284  broken(stat == InvalidParameter), /* Win98 */
1285  "Expected Ok, got %.8x\n", stat);
1286  if(stat == Ok){
1287  /* check attributes */
1289  expect(Ok, stat);
1290  expect(16, dim);
1291  stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
1292  expect(Ok, stat);
1293  expect(16, dim);
1295  expect(Ok, stat);
1298  expect(Ok, stat);
1300  /* raw format */
1301  expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, FALSE);
1303  }
1304  DestroyIcon(hIcon);
1305 
1306  /* color icon 8 bpp */
1307  hbmMask = CreateBitmap(16, 16, 1, 8, bmp_bits);
1308  ok(hbmMask != 0, "CreateBitmap failed\n");
1309  hbmColor = CreateBitmap(16, 16, 1, 8, bmp_bits);
1310  ok(hbmColor != 0, "CreateBitmap failed\n");
1311  info.fIcon = TRUE;
1312  info.xHotspot = 8;
1313  info.yHotspot = 8;
1314  info.hbmMask = hbmMask;
1315  info.hbmColor = hbmColor;
1317  ok(hIcon != 0, "CreateIconIndirect failed\n");
1318  DeleteObject(hbmMask);
1319  DeleteObject(hbmColor);
1320 
1322  expect(Ok, stat);
1323  if(stat == Ok){
1324  /* check attributes */
1326  expect(Ok, stat);
1327  expect(16, dim);
1328  stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
1329  expect(Ok, stat);
1330  expect(16, dim);
1332  expect(Ok, stat);
1335  expect(Ok, stat);
1337  /* raw format */
1338  expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, FALSE);
1340  }
1341  DestroyIcon(hIcon);
1342 }
static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo)
Definition: image.c:85
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
GpStatus WINGDIPAPI GdipGetImageType(GpImage *image, ImageType *type)
Definition: image.c:2318
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2342
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
struct _test_info info[]
Definition: SetCursorPos.c:19
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2239
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap **bitmap)
Definition: image.c:1564
Definition: uimain.c:88
GpStatus WINGDIPAPI GdipGetImagePixelFormat(GpImage *image, PixelFormat *format)
Definition: image.c:2291
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2546
#define expect(expected, got)
Definition: image.c:56
INT PixelFormat
Definition: stat.h:55
unsigned char BYTE
Definition: mem.h:68
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
HICON hIcon
Definition: msconfig.c:44
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
ImageType
Definition: gdiplusenums.h:191
static HBITMAP
Definition: button.c:44
#define PixelFormat32bppARGB
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_gamma()

static void test_gamma ( void  )
static

Definition at line 2543 of file image.c.

2544 {
2545  GpStatus stat;
2546  GpImageAttributes *imageattr;
2547  GpBitmap *bitmap1, *bitmap2;
2548  GpGraphics *graphics;
2549  ARGB color;
2550 
2553 
2554  stat = GdipCreateImageAttributes(&imageattr);
2555  expect(Ok, stat);
2556 
2558  expect(Ok, stat);
2559 
2562 
2565 
2568 
2570  expect(Ok, stat);
2571 
2573  expect(Ok, stat);
2574 
2575  /* Drawing a bitmap transforms the colors */
2577  expect(Ok, stat);
2578 
2579  stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
2580  expect(Ok, stat);
2581 
2583  expect(Ok, stat);
2584 
2585  stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff80ffff);
2586  expect(Ok, stat);
2587 
2589  expect(Ok, stat);
2590 
2591  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
2592  UnitPixel, imageattr, NULL, NULL);
2593  expect(Ok, stat);
2594 
2595  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2596  expect(Ok, stat);
2597  ok(color_match(0xff20ffff, color, 1), "Expected ff20ffff, got %.8x\n", color);
2598 
2600  expect(Ok, stat);
2601 
2602  stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
2603  UnitPixel, imageattr, NULL, NULL);
2604  expect(Ok, stat);
2605 
2606  stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
2607  expect(Ok, stat);
2608  ok(color_match(0xff80ffff, color, 1), "Expected ff80ffff, got %.8x\n", color);
2609 
2610  GdipDeleteGraphics(graphics);
2611  GdipDisposeImage((GpImage*)bitmap1);
2613  GdipDisposeImageAttributes(imageattr);
2614 }
#define TRUE
Definition: types.h:120
GpStatus WINGDIPAPI GdipSetImageAttributesGamma(GpImageAttributes *imageAttr, ColorAdjustType type, BOOL enableFlag, REAL gamma)
static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff)
Definition: image.c:59
GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap *bitmap, INT x, INT y, ARGB color)
Definition: image.c:494
#define PixelFormat32bppRGB
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2201
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap *bitmap, INT x, INT y, ARGB *color)
Definition: image.c:288
GLuint color
Definition: glext.h:6243
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2581
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1760
#define expect(expected, got)
Definition: image.c:56
Definition: stat.h:55
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2107
Status
Definition: gdiplustypes.h:24
GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes *imageAttr, ColorAdjustType type)
Definition: