Skip to content

Commit

Permalink
add stackblur etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ttsping committed Sep 21, 2016
1 parent 2c61595 commit fa30a87
Show file tree
Hide file tree
Showing 10 changed files with 523 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/Helpers.txt
Expand Up @@ -77,7 +77,7 @@ function pos2vol(pos) {

// Inverse function of pos2vol()
function vol2pos(v){
return (Math.round(((Math.pow(10, v / 50) - 0.01) / 0.99)));
return ((Math.pow(10, v / 50) - 0.01) / 0.99);
}

// pre-calculated colors
Expand Down
4 changes: 2 additions & 2 deletions foo_uie_wsh_panel_mod_plus/PropertyList.h
Expand Up @@ -361,7 +361,7 @@ class ATL_NO_VTABLE CPropertyListImpl :
// Create a new editor window
RECT rcValue = { 0 };
_GetInPlaceRect(idx, rcValue);
::InflateRect(&rcValue, 0, -1);
::InflateRect(&rcValue, 0, -4);
m_hwndInplace = prop->CreateInplaceControl(m_hWnd, rcValue);
if (m_hwndInplace != NULL)
{
Expand Down Expand Up @@ -815,7 +815,7 @@ class ATL_NO_VTABLE CPropertyListImpl :
}
void MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
{
lpMIS->itemHeight = m_di.tmText.tmHeight + 5;
lpMIS->itemHeight = m_di.tmText.tmHeight + 8;
}
void DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
Expand Down
2 changes: 2 additions & 0 deletions foo_uie_wsh_panel_mod_plus/foo_uie_wsh_panel_mod.cpp
Expand Up @@ -28,6 +28,8 @@ namespace
"Copyright (c) 2009 Wong Shao Voon\n\n\n"
"box blur filter\n"
"Copyright 2006 Jerry Huxtable\n\n\n"
"Stack Blur Algorithm was invented by Mario Klingemann, mario@quasimondo.com\n"
"multi-threaded version by Victor Laskin (victor.laskin@gmail.com)\n\n\n"
"CPropertyList - A Property List control\n"
"Copyright (c) 2001-2003 Bjarke Viksoe\n\n\n"
);
Expand Down
10 changes: 6 additions & 4 deletions foo_uie_wsh_panel_mod_plus/foo_uie_wsh_panel_mod_plus.vcxproj
Expand Up @@ -82,8 +82,8 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "C:\Users\ohyeah\Desktop\foobar2000\components"
copy "$(SolutionDir)extras\*.api" "C:\Users\ohyeah\Desktop\foobar2000\components"</Command>
<Command>copy "$(TargetPath)" "D:\Temp\foobar2000\components"
copy "$(SolutionDir)extras\*.api" "D:\Temp\foobar2000\components"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -121,8 +121,8 @@ copy "$(SolutionDir)extras\*.api" "C:\Users\ohyeah\Desktop\foobar2000\components
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<PostBuildEvent>
<Command>copy "$(TargetPath)" "C:\Users\ohyeah\Desktop\foobar2000\components"
copy "$(SolutionDir)extras\*.api" "C:\Users\ohyeah\Desktop\foobar2000\components"</Command>
<Command>copy "$(TargetPath)" "D:\Temp\foobar2000\components"
copy "$(SolutionDir)extras\*.api" "D:\Temp\foobar2000\components"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand All @@ -146,6 +146,7 @@ copy "$(SolutionDir)extras\*.api" "C:\Users\ohyeah\Desktop\foobar2000\components
<ClCompile Include="script_interface_playlist_impl.cpp" />
<ClCompile Include="script_interface_tooltip_impl.cpp" />
<ClCompile Include="script_preprocessor.cpp" />
<ClCompile Include="stackblur.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
Expand Down Expand Up @@ -190,6 +191,7 @@ copy "$(SolutionDir)extras\*.api" "C:\Users\ohyeah\Desktop\foobar2000\components
<ClInclude Include="IDropTargetImpl.h" />
<ClInclude Include="host_droptarget.h" />
<ClInclude Include="splitter_window.h" />
<ClInclude Include="stackblur.h" />
<ClInclude Include="wsh_mainmenu.h" />
<ClInclude Include="wsh_panel_window.h" />
<ClInclude Include="wsh_panel_window_dui.h" />
Expand Down
Expand Up @@ -150,6 +150,9 @@
<ClCompile Include="lang.cpp">
<Filter>Source Files\Misc</Filter>
</ClCompile>
<ClCompile Include="stackblur.cpp">
<Filter>Source Files\Misc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="config.h">
Expand Down Expand Up @@ -332,6 +335,9 @@
<ClInclude Include="lang.h">
<Filter>Header Files\Misc</Filter>
</ClInclude>
<ClInclude Include="stackblur.h">
<Filter>Header Files\Misc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\default.js">
Expand Down
3 changes: 3 additions & 0 deletions foo_uie_wsh_panel_mod_plus/script_interface.h
Expand Up @@ -82,6 +82,7 @@ __interface IGdiBitmap: IGdiObj
STDMETHOD(GetGraphics)([out,retval] __interface IGdiGraphics ** pp);
STDMETHOD(ReleaseGraphics)(__interface IGdiGraphics * p);
STDMETHOD(BoxBlur)([range(1,20)] int radius, [range(1,20),defaultvalue(1)] int iteration);
STDMETHOD(StackBlur)([range(0,255)] int radius, [range(1,20),defaultvalue(1)] int core);
STDMETHOD(Resize)(UINT w, UINT h, [range(Gdiplus::InterpolationModeInvalid, Gdiplus::InterpolationModeHighQualityBicubic), defaultvalue(0)] INT interpolationMode, [out,retval] IGdiBitmap ** pp);
STDMETHOD(GetColorScheme)(UINT count, [out,retval] VARIANT * outArray);
STDMETHOD(GetPixel)(INT x , INT y , [out,retval] INT * p);
Expand Down Expand Up @@ -738,6 +739,7 @@ __interface IHttpRequestExCallbackInfo: IDispatch
[propget] STDMETHOD(ID)([out,retval]UINT* p);
[propget] STDMETHOD(URL)([out,retval]BSTR* pp);
[propget] STDMETHOD(Path)([out,retval]BSTR* pp);
[propget] STDMETHOD(Headers)([out,retval]BSTR* pp);
[propget] STDMETHOD(Length)([out,retval]UINT* p);
[propget] STDMETHOD(ContentLength)([out,retval]UINT* p);
[propget] STDMETHOD(ElapsedTime)([out,retval]float* p);
Expand All @@ -757,4 +759,5 @@ __interface IHttpRequestEx: IDisposable

STDMETHOD(Run)(BSTR url, [defaultvalue("GET")]BSTR verb,[out,retval] BSTR* pp);
STDMETHOD(RunAsync)(UINT id, BSTR url, [defaultvalue("")]BSTR fn, [defaultvalue("GET")]BSTR verb, [out,retval] UINT* p);
STDMETHOD(AbortAsync)(UINT id, [defaultvalue("")]BSTR url, [out,retval] VARIANT_BOOL* p);
};
60 changes: 60 additions & 0 deletions foo_uie_wsh_panel_mod_plus/script_interface_impl.cpp
Expand Up @@ -5,6 +5,7 @@
#include "com_array.h"
#include "gdiplus_helpers.h"
#include "boxblurfilter.h"
#include "stackblur.h"
#include "user_message.h"
#include "popup_msg.h"
#include "dbgtrace.h"
Expand Down Expand Up @@ -320,6 +321,17 @@ STDMETHODIMP GdiBitmap::BoxBlur(int radius, int iteration)
return S_OK;
}

STDMETHODIMP GdiBitmap::StackBlur(int radius, int core)
{
TRACK_FUNCTION();

if(!m_ptr) return E_POINTER;

stack_blur_filter(*m_ptr, radius, core);

return S_OK;
}

STDMETHODIMP GdiBitmap::Resize(UINT w, UINT h, INT interpolationMode, IGdiBitmap ** pp)
{
TRACK_FUNCTION();
Expand Down Expand Up @@ -5397,6 +5409,13 @@ STDMETHODIMP HttpRequestExCallbackInfo::get_Path(BSTR* pp)
return S_OK;
}

STDMETHODIMP HttpRequestExCallbackInfo::get_Headers(BSTR* pp)
{
if(!pp)return E_POINTER;
(*pp) = SysAllocString(m_headers.c_str());
return S_OK;
}

STDMETHODIMP HttpRequestExCallbackInfo::get_Length(UINT * p)
{
if(!p)return E_POINTER;
Expand Down Expand Up @@ -5926,3 +5945,44 @@ STDMETHODIMP HttpRequestEx::RunAsync(UINT id, BSTR url,BSTR fn, BSTR verb, UINT*
return hr;
}

STDMETHODIMP HttpRequestEx::AbortAsync(UINT id, BSTR url, VARIANT_BOOL* p)
{
TRACK_FUNCTION();

if (!url)return E_INVALIDARG;
if(!p)return E_POINTER;

insync(m_request_lock);

(*p) = TO_VARIANT_BOOL(FALSE);

t_size n, m = m_requests.get_count();

for (n = 0; n < m; ++n)
{
if ((StrCmpW(m_requests[n]->m_url.c_str(), url) == 0) && (m_requests[n]->m_request != NULL))
break;
}

if (n == m)
{
for (n = 0; n < m; ++n)
{
if ((m_requests[n]->m_id == id) && (m_requests[n]->m_request != NULL))
break;
}
}

if (n < m)
{
(VOID)WinHttpSetStatusCallback(m_requests[n]->m_request, NULL, 0, 0);
BOOL ret = WinHttpCloseHandle(m_requests[n]->m_request);
m_requests[n]->m_request = NULL;
m_requests[n]->m_error = ERROR_CANCELLED;
RemoveAndReleaseCallbackInfo(m_requests[n]);
(*p) = TO_VARIANT_BOOL(ret);
}

return S_OK;
}

3 changes: 3 additions & 0 deletions foo_uie_wsh_panel_mod_plus/script_interface_impl.h
Expand Up @@ -84,6 +84,7 @@ class GdiBitmap : public GdiObj<IGdiBitmap, Gdiplus::Bitmap>
STDMETHODIMP GetGraphics(IGdiGraphics ** pp);
STDMETHODIMP ReleaseGraphics(IGdiGraphics * p);
STDMETHODIMP BoxBlur(int radius, int iteration);
STDMETHODIMP StackBlur(int radius, int core);
STDMETHODIMP Resize(UINT w, UINT h, INT interpolationMode, IGdiBitmap ** pp);
STDMETHODIMP GetColorScheme(UINT count, VARIANT * outArray);
STDMETHODIMP GetPixel(INT x , INT y , INT * p);
Expand Down Expand Up @@ -872,6 +873,7 @@ class HttpRequestExCallbackInfo : public IDispatchImpl3<IHttpRequestExCallbackIn
STDMETHODIMP get_ID(UINT * p);
STDMETHODIMP get_URL(BSTR * pp);
STDMETHODIMP get_Path(BSTR* pp);
STDMETHODIMP get_Headers(BSTR* pp);
STDMETHODIMP get_Length(UINT * p);
STDMETHODIMP get_ContentLength(UINT * p);
STDMETHODIMP get_ElapsedTime(float * p);
Expand Down Expand Up @@ -934,6 +936,7 @@ class HttpRequestEx : public IDisposableImpl4<IHttpRequestEx>

STDMETHODIMP Run(BSTR url, BSTR verb, BSTR* pp);
STDMETHODIMP RunAsync(UINT id, BSTR url,BSTR fn, BSTR verb, UINT* p);
STDMETHODIMP AbortAsync(UINT id, BSTR url, VARIANT_BOOL* p);

public:
static VOID CALLBACK AsyncStatusCallback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength);
Expand Down

0 comments on commit fa30a87

Please sign in to comment.