Commit 8de0275e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

resend patch 1/2: Gdiplus: Implement GdipBitmapGetHistogramSize.

parent 86ec1697
...@@ -619,7 +619,7 @@ ...@@ -619,7 +619,7 @@
619 stdcall GdipBitmapCreateApplyEffect(ptr long ptr ptr ptr ptr long ptr ptr) 619 stdcall GdipBitmapCreateApplyEffect(ptr long ptr ptr ptr ptr long ptr ptr)
620 stdcall GdipBitmapApplyEffect(ptr ptr ptr long ptr ptr) 620 stdcall GdipBitmapApplyEffect(ptr ptr ptr long ptr ptr)
621 stub GdipBitmapGetHistogram 621 stub GdipBitmapGetHistogram
622 stub GdipBitmapGetHistogramSize 622 stdcall GdipBitmapGetHistogramSize(long ptr)
623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float) 623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float)
624 stdcall GdipImageSetAbort(ptr ptr) 624 stdcall GdipImageSetAbort(ptr ptr)
625 stub GdipGraphicsSetAbort 625 stub GdipGraphicsSetAbort
......
...@@ -5386,3 +5386,17 @@ GpStatus WINGDIPAPI GdipBitmapConvertFormat(GpBitmap *bitmap, PixelFormat format ...@@ -5386,3 +5386,17 @@ GpStatus WINGDIPAPI GdipBitmapConvertFormat(GpBitmap *bitmap, PixelFormat format
FIXME("(%p, 0x%08x, %d, %d, %p, %f): stub\n", bitmap, format, dithertype, palettetype, palette, alphathreshold); FIXME("(%p, 0x%08x, %d, %d, %p, %f): stub\n", bitmap, format, dithertype, palettetype, palette, alphathreshold);
return NotImplemented; return NotImplemented;
} }
/*****************************************************************************
* GdipBitmapGetHistogramSize [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipBitmapGetHistogramSize(HistogramFormat format, UINT *num_of_entries)
{
TRACE("(%d, %p)\n", format, num_of_entries);
if (!num_of_entries)
return InvalidParameter;
*num_of_entries = 256;
return Ok;
}
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "gdiplus.h" #include "gdiplus.h"
#include "wine/test.h" #include "wine/test.h"
static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*);
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got)) #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 expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
...@@ -4785,8 +4787,51 @@ static void test_getadjustedpalette(void) ...@@ -4785,8 +4787,51 @@ static void test_getadjustedpalette(void)
GdipDisposeImageAttributes(imageattributes); GdipDisposeImageAttributes(imageattributes);
} }
static void test_histogramsize(void)
{
HistogramFormat test_formats[] =
{
HistogramFormatARGB,
HistogramFormatPARGB,
HistogramFormatRGB,
HistogramFormatGray,
HistogramFormatB,
HistogramFormatG,
HistogramFormatR,
HistogramFormatA,
};
GpStatus stat;
UINT num, i;
if (!pGdipBitmapGetHistogramSize)
{
win_skip("GdipBitmapGetHistogramSize is not supported\n");
return;
}
stat = pGdipBitmapGetHistogramSize(HistogramFormatARGB, NULL);
expect(InvalidParameter, stat);
stat = pGdipBitmapGetHistogramSize(0xff, NULL);
expect(InvalidParameter, stat);
num = 123;
stat = pGdipBitmapGetHistogramSize(10, &num);
expect(Ok, stat);
expect(256, num);
for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++)
{
num = 0;
stat = pGdipBitmapGetHistogramSize(test_formats[i], &num);
expect(Ok, stat);
expect(256, num);
}
}
START_TEST(image) START_TEST(image)
{ {
HMODULE mod = GetModuleHandleA("gdiplus.dll");
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken; ULONG_PTR gdiplusToken;
...@@ -4797,6 +4842,8 @@ START_TEST(image) ...@@ -4797,6 +4842,8 @@ START_TEST(image)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
pGdipBitmapGetHistogramSize = (void*)GetProcAddress(mod, "GdipBitmapGetHistogramSize");
test_supported_encoders(); test_supported_encoders();
test_CloneBitmapArea(); test_CloneBitmapArea();
test_ARGB_conversion(); test_ARGB_conversion();
...@@ -4843,6 +4890,7 @@ START_TEST(image) ...@@ -4843,6 +4890,7 @@ START_TEST(image)
test_dispose(); test_dispose();
test_createeffect(); test_createeffect();
test_getadjustedpalette(); test_getadjustedpalette();
test_histogramsize();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }
...@@ -48,10 +48,23 @@ struct ColorMap ...@@ -48,10 +48,23 @@ struct ColorMap
Color newColor; Color newColor;
}; };
enum HistogramFormat
{
HistogramFormatARGB,
HistogramFormatPARGB,
HistogramFormatRGB,
HistogramFormatGray,
HistogramFormatB,
HistogramFormatG,
HistogramFormatR,
HistogramFormatA,
};
#ifndef __cplusplus #ifndef __cplusplus
typedef enum ColorAdjustType ColorAdjustType; typedef enum ColorAdjustType ColorAdjustType;
typedef enum ColorMatrixFlags ColorMatrixFlags; typedef enum ColorMatrixFlags ColorMatrixFlags;
typedef enum HistogramFormat HistogramFormat;
typedef struct ColorMatrix ColorMatrix; typedef struct ColorMatrix ColorMatrix;
typedef struct ColorMap ColorMap; typedef struct ColorMap ColorMap;
......
...@@ -41,6 +41,7 @@ GpStatus WINGDIPAPI GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap*,REAL); ...@@ -41,6 +41,7 @@ GpStatus WINGDIPAPI GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap*,REAL);
/* Bitmap */ /* Bitmap */
GpStatus WINGDIPAPI GdipBitmapApplyEffect(GpBitmap*,CGpEffect*,RECT*,BOOL,VOID**,INT*); GpStatus WINGDIPAPI GdipBitmapApplyEffect(GpBitmap*,CGpEffect*,RECT*,BOOL,VOID**,INT*);
GpStatus WINGDIPAPI GdipBitmapCreateApplyEffect(GpBitmap**,INT,CGpEffect*,RECT*,RECT*,GpBitmap**,BOOL,VOID**,INT*); GpStatus WINGDIPAPI GdipBitmapCreateApplyEffect(GpBitmap**,INT,CGpEffect*,RECT*,RECT*,GpBitmap**,BOOL,VOID**,INT*);
GpStatus WINGDIPAPI GdipBitmapGetHistogramSize(HistogramFormat,UINT*);
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*); GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*);
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap*,GDIPCONST GpRect*,UINT, GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap*,GDIPCONST GpRect*,UINT,
PixelFormat,BitmapData*); PixelFormat,BitmapData*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment