diff --git a/demo/gdi/nuklear_gdi.h b/demo/gdi/nuklear_gdi.h index ff2ff1964..776e8d01e 100644 --- a/demo/gdi/nuklear_gdi.h +++ b/demo/gdi/nuklear_gdi.h @@ -221,7 +221,7 @@ nk_gdi_set_vertexColor(PTRIVERTEX tri, struct nk_color col) tri->Red = col.r << 8; tri->Green = col.g << 8; tri->Blue = col.b << 8; - tri->Alpha = 0xff << 8; + tri->Alpha = col.a << 8; } static void @@ -235,26 +235,26 @@ nk_gdi_rect_multi_color(HDC dc, short x, short y, unsigned short w, TRIVERTEX vt[4]; alphaFunction.BlendOp = AC_SRC_OVER; alphaFunction.BlendFlags = 0; - alphaFunction.SourceConstantAlpha = 0; + alphaFunction.SourceConstantAlpha = 255; alphaFunction.AlphaFormat = AC_SRC_ALPHA; /* TODO: This Case Needs Repair.*/ /* Top Left Corner */ - vt[0].x = x; - vt[0].y = y; + vt[0].x = 0; + vt[0].y = 0; nk_gdi_set_vertexColor(&vt[0], left); /* Top Right Corner */ - vt[1].x = x+w; - vt[1].y = y; + vt[1].x = 0+w; + vt[1].y = 0; nk_gdi_set_vertexColor(&vt[1], top); /* Bottom Left Corner */ - vt[2].x = x; - vt[2].y = y+h; + vt[2].x = 0; + vt[2].y = 0+h; nk_gdi_set_vertexColor(&vt[2], right); /* Bottom Right Corner */ - vt[3].x = x+w; - vt[3].y = y+h; + vt[3].x = 0+w; + vt[3].y = 0+h; nk_gdi_set_vertexColor(&vt[3], bottom); gTri[0].Vertex1 = 0; @@ -263,9 +263,17 @@ nk_gdi_rect_multi_color(HDC dc, short x, short y, unsigned short w, gTri[1].Vertex1 = 2; gTri[1].Vertex2 = 1; gTri[1].Vertex3 = 3; - GdiGradientFill(dc, vt, 4, gTri, 2 , GRADIENT_FILL_TRIANGLE); - AlphaBlend(gdi.window_dc, x, y, x+w, y+h,gdi.memory_dc, x, y, x+w, y+h,alphaFunction); + HDC memdc = CreateCompatibleDC(dc); + HBITMAP bitmap = CreateCompatibleBitmap(dc, w, h); + HGDIOBJ old = SelectObject(memdc, bitmap); + + GdiGradientFill(memdc, vt, 4, gTri, 2 , GRADIENT_FILL_TRIANGLE); + + GdiAlphaBlend(dc, x, y, w, h, memdc, 0, 0, w, h, alphaFunction); + + DeleteDC(memdc); + DeleteObject(bitmap); } static BOOL diff --git a/demo/gdip/nuklear_gdip.h b/demo/gdip/nuklear_gdip.h index c0dd5dd41..294fab630 100644 --- a/demo/gdip/nuklear_gdip.h +++ b/demo/gdip/nuklear_gdip.h @@ -628,7 +628,7 @@ static void nk_gdip_draw_image(short x, short y, unsigned short w, unsigned short h, struct nk_image img, struct nk_color col) { - GpImage *image = img.handle.ptr; + GpImage *image = (GpImage *)img.handle.ptr; GdipDrawImageRectI(gdip.memory, image, x, y, w, h); } @@ -675,7 +675,10 @@ nk_gdip_load_image_from_memory(const void *membuf, nk_uint membufSize) return nk_image_id(0); status = GdipLoadImageFromStream(stream, &image); - stream->lpVtbl->Release(stream); + + /// TODO: 'IStream' {aka 'struct IStream'} has no member named 'lpVtbl'GCC + stream->Release(); + //stream->lpVtbl->Release(stream); if (status) return nk_image_id(0); @@ -688,7 +691,7 @@ nk_gdip_image_free(struct nk_image image) { if (!image.handle.ptr) return; - GdipDisposeImage(image.handle.ptr); + GdipDisposeImage((GpImage*)image.handle.ptr); } GdipFont* diff --git a/nuklear.h b/nuklear.h index bcb220e04..1ea76c719 100644 --- a/nuklear.h +++ b/nuklear.h @@ -374,7 +374,7 @@ extern "C" { #define NK_SIZE_TYPE unsigned __int32 #elif defined(__GNUC__) || defined(__clang__) #if defined(__x86_64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__aarch64__) - #define NK_SIZE_TYPE unsigned long + #define NK_SIZE_TYPE unsigned long long #else #define NK_SIZE_TYPE unsigned int #endif @@ -389,7 +389,7 @@ extern "C" { #define NK_POINTER_TYPE unsigned __int32 #elif defined(__GNUC__) || defined(__clang__) #if defined(__x86_64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__aarch64__) - #define NK_POINTER_TYPE unsigned long + #define NK_POINTER_TYPE unsigned long long #else #define NK_POINTER_TYPE unsigned int #endif @@ -29012,7 +29012,7 @@ nk_draw_color_picker(struct nk_command_buffer *o, const struct nk_rect *matrix, /* draw color matrix */ temp = nk_hsv_f(hsva[0], 1.0f, 1.0f); - nk_fill_rect_multi_color(o, *matrix, white, temp, temp, white); + nk_fill_rect_multi_color(o, *matrix, white, temp, white, temp); nk_fill_rect_multi_color(o, *matrix, black_trans, black_trans, black, black); /* draw cross-hair */