PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Glow effect in evaluation version

Hello,

Could you tell me how you manage to create a glow effect of strings, when GapiDraw evaluation version is starting?

Thanks in advance.
If you mean GapiDraw 3.01, it's all prerendered in Photoshop.. :)
InexorableTash · 28 Aug 2004, 04:45 UTC
Here's a cheesy way to do it, which I have in my widget code:

Code:

if( HasFocus() )
{
GDBLTFASTFX gdbffx;
::ZeroMemory( &gdbffx, sizeof(gdbffx) );
gdbffx.dwOpacity = m_dwOpacityFocus >> 3;
gdbffx.dwFXcolor1 = m_crColor;

for( int x = -5; x < 6; x += 2 )
{
for( int y = -5; y < 6; y += 2 )
{
hr = pSurface->DrawText( pt.x+x, pt.y+y, m_szText, GetFont(), dwAlign, NULL, GDBLTFAST_OPACITY | GDBLTFASTFX_MULTIPLY, &gdbffx );
Assert( SUCCEEDED(hr) );
}
}
}

GDBLTFASTFX gdbffx;
::ZeroMemory( &gdbffx, sizeof(gdbffx) );
gdbffx.dwOpacity = HasFocus() ? m_dwOpacityFocus : m_dwOpacity;
gdbffx.dwFXcolor1 = HasFocus() ? m_crColorFocus : m_crColor;
hr = pSurface->DrawText( pt.x, pt.y, m_szText, GetFont(), dwAlign, NULL, GDBLTFAST_OPACITY | GDBLTFASTFX_MULTIPLY, &gdbffx );
Assert( SUCCEEDED(hr) );


The focus color is white, focus opacity is 255, normal color is blue, normal opacity is 128. The "if" block produces a light blue glow around the text.

....

Johan, while I'm here - none of your functions like CreateSurface() which load resources from DLLs can accept strings for paramters. The usual Windows trick is to use LPCTSTR arguments and pass these on to FindResource() directly. Callers who want to use numeric IDs use the MAKEINTRESOURCE() macro. Any chance of either swapping to LPCTSTRs or adding additional overloads?

(I prefer string resource names because it's one less set of unique numerical IDs to manage)
InexorableTash wrote:(I prefer string resource names because it's one less set of unique numerical IDs to manage)


Enum is your friend.
InexorableTash · 28 Aug 2004, 06:17 UTC
Alas, not in RC files - to the best of my knowledge, they use the C preprocessor which doesn't have a clue about enumerated types and other language features, and then the resource compiler kicks in and it's not too bright either.

Besides, I have unique identifiers for things already (the filenames). Using raw files or GapiVFS lets you reuse that naming; I'm a fan of bundling resources into DLLs where you can use strings in most places but not in GapiDraw.

It's not a big deal, it's just kinda weird since if a function takes in LPCTSTRs you can use both strings and numeric IDs, but not vice versa. If the system has code like this:

Code:

void LoadSomeResource( HMODULE hModule, DWORD dwID, LPCTSTR lpType )
{
HRSRC hResInfo = ::FindResource( hModule, MAKEINTRESOURCE(dwID), lpType );
if( hResInfo )
{
...
}
}


Then all I want is for it to also have:

Code:

void LoadSomeResource( HMODULE hModule, LPCTSTR lpName, LPCTSTR lpType )
{
HRSRC hResInfo = ::FindResource( hModule, lpName, lpType );
if( hResInfo )
{
...
}
}


The former can then become a wrapper:

Code:

void LoadSomeResource( HMODULE hModule, DWORD dwID, LPCTSTR lpType )
{
::LoadSomeResource( hModule, MAKEINTRESOURCE(dwID), lpType );
}


I'm not blocked on this; obviously I could create my own wrapper that does FindResource/SizeofResource/LoadResource/LockResource itself and then calls CreateSurface( DWORD, BYTE* DWORD ).
Johan, but it doesnt seem to be any bitmap resources in gd301.dll.
There aren't any resources in the DLL. The images are included as PNG memory blocks.
InexorableTash · 31 Aug 2004, 04:28 UTC
I should apologize if any of my requests or suggestions come off sounding at all demanding. In "real life" I'm a software designer for company on a team that ships software to a somewhat sizable user base, so I see requests for features pretty much nonstop from users, all of which must be weighed against countless other demands and requirements. Kudos to Johan for listening to any of us!

I'm also not a paying customer (since I'm playing with GapiDraw for fun) so I am at the bottom of the totem pole, and I know it. :)