Default gradients (or cycles) are now loaded from skins. Initialized all current skins so that range 0 is a white->black range, this way the grad shapes are immediately efficient. Still has a problem when loading an image in command-line.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1714 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
@@ -1013,8 +1013,10 @@ void Load_SDL_Image(T_IO_Context *context)
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
||||
///
|
||||
/// Load an arbitrary SDL_Surface.
|
||||
SDL_Surface * Load_surface(char *full_name)
|
||||
/// @param gradients Pass the address of a target T_Gradient_array if you want the gradients, NULL otherwise
|
||||
SDL_Surface * Load_surface(char *full_name, T_Gradient_array *gradients)
|
||||
{
|
||||
SDL_Surface * bmp=NULL;
|
||||
T_IO_Context context;
|
||||
@@ -1023,8 +1025,23 @@ SDL_Surface * Load_surface(char *full_name)
|
||||
Load_image(&context);
|
||||
|
||||
if (context.Surface)
|
||||
{
|
||||
bmp=context.Surface;
|
||||
|
||||
// Caller wants the gradients:
|
||||
if (gradients != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(gradients, 0, sizeof(T_Gradient_array));
|
||||
for (i=0; i<context.Color_cycles; i++)
|
||||
{
|
||||
gradients->Range[i].Start=context.Cycle_range[i].Start;
|
||||
gradients->Range[i].End=context.Cycle_range[i].End;
|
||||
gradients->Range[i].Inverse=context.Cycle_range[i].Inverse;
|
||||
gradients->Range[i].Speed=context.Cycle_range[i].Speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Destroy_context(&context);
|
||||
|
||||
return bmp;
|
||||
|
||||
Reference in New Issue
Block a user