gimp/app/paint/gimpbrushcore-kernels.h

117 lines
3.4 KiB
C
Raw Normal View History

/* gimpbrushcore-kernels.h
*
* This file was generated using kernelgen as found in the tools dir.
* (threshold = 0.25)
*/
#ifndef __GIMP_BRUSH_CORE_KERNELS_H__
#define __GIMP_BRUSH_CORE_KERNELS_H__
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
#define KERNEL_WIDTH 3
#define KERNEL_HEIGHT 3
#define KERNEL_SUBSAMPLE 4
#ifdef __cplusplus
template <class T>
struct Kernel;
template <>
struct Kernel<guchar>
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
{
using value_type = guchar;
using kernel_type = guint;
using accum_type = gulong;
static constexpr kernel_type
coeff (kernel_type x)
{
return x;
}
static constexpr value_type
round (accum_type x)
{
return (x + 128) / 256;
}
};
template <>
struct Kernel<gfloat>
{
using value_type = gfloat;
using kernel_type = gfloat;
using accum_type = gfloat;
static constexpr kernel_type
coeff (kernel_type x)
{
return x / 256.0f;
}
static constexpr value_type
round (accum_type x)
{
return x;
}
};
Core/UI separation for the paint tools: 2002-02-14 Michael Natterer <mitch@gimp.org> Core/UI separation for the paint tools: * configure.in * app/Makefile.am * app/paint/.cvsignore * app/paint/Makefile.am: added new directory for the paint methods without GUI and tools around them. * app/paint/paint-types.h: typedefs for this module. * app/paint/gimppaintcore-kernels.h * app/paint/gimppaintcore.[ch]: the general paint logic taken from GimpPaintTool. * app/paint/gimpairbrush.[ch] * app/paint/gimpclone.[ch] * app/paint/gimpconvolve.[ch] * app/paint/gimpdodgeburn.[ch] * app/paint/gimperaser.[ch] * app/paint/gimppaintbrush.[ch] * app/paint/gimppencil.[ch] * app/paint/gimpsmudge.[ch]: subclasses of GimpPaintCore, implementing their own paint() methods. Needs more hacking to get the GtkWidget pointers out of the options structs. * app/tools/gimppainttool_kernels.h: removed. * app/tools/tools-types.h: removed the paint tool enums. * app/tools/gimpairbrushtool.[ch] * app/tools/gimpclonetool.[ch] * app/tools/gimpconvolvetool.[ch] * app/tools/gimpdodgeburntool.[ch] * app/tools/gimperasertool.[ch] * app/tools/gimppaintbrushtool.[ch] * app/tools/gimppainttool.[ch] * app/tools/gimppenciltool.[ch] * app/tools/gimpsmudgetool.[ch]: all paint tools are pure GUI things now. PaintOptions and friends still need to be chopped up though... * app/undo.c: changed PaintUndo to GimpPaintCoreUndo, some minor cleanup. * tools/kernelgen.c: changed accordingly. * tools/pdbgen/Makefile.am: scan paint/paint-types.h for enums. * tools/pdbgen/pdb/paint_tools.pdb: hardcode "success = FALSE" for all paint PDB wrappers. The non-gui stuff is completely broken. More commits to come... * app/pdb/paint_tools_cmds.c * tools/pdbgen/enums.pl: regenerated.
2002-02-15 03:31:16 +08:00
/* Brush pixel subsampling kernels */
template <class T>
struct Subsample : Kernel<T>
{
#define C(x) (Subsample::coeff (x))
static constexpr typename Subsample::kernel_type kernel[5][5][9] =
{
{
{ C( 64), C( 64), C( 0), C( 64), C( 64), C( 0), C( 0), C( 0), C( 0), },
{ C( 25), C(103), C( 0), C( 25), C(103), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C(128), C( 0), C( 0), C(128), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C(103), C( 25), C( 0), C(103), C( 25), C( 0), C( 0), C( 0), },
{ C( 0), C( 64), C( 64), C( 0), C( 64), C( 64), C( 0), C( 0), C( 0), }
},
{
{ C( 25), C( 25), C( 0), C(103), C(103), C( 0), C( 0), C( 0), C( 0), },
{ C( 6), C( 44), C( 0), C( 44), C(162), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C( 50), C( 0), C( 0), C(206), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C( 44), C( 6), C( 0), C(162), C( 44), C( 0), C( 0), C( 0), },
{ C( 0), C( 25), C( 25), C( 0), C(103), C(103), C( 0), C( 0), C( 0), }
},
{
{ C( 0), C( 0), C( 0), C(128), C(128), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C( 0), C( 0), C( 50), C(206), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(256), C( 0), C( 0), C( 0), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(206), C( 50), C( 0), C( 0), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(128), C(128), C( 0), C( 0), C( 0), }
},
{
{ C( 0), C( 0), C( 0), C(103), C(103), C( 0), C( 25), C( 25), C( 0), },
{ C( 0), C( 0), C( 0), C( 44), C(162), C( 0), C( 6), C( 44), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(206), C( 0), C( 0), C( 50), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(162), C( 44), C( 0), C( 44), C( 6), },
{ C( 0), C( 0), C( 0), C( 0), C(103), C(103), C( 0), C( 25), C( 25), }
},
{
{ C( 0), C( 0), C( 0), C( 64), C( 64), C( 0), C( 64), C( 64), C( 0), },
{ C( 0), C( 0), C( 0), C( 25), C(103), C( 0), C( 25), C(103), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(128), C( 0), C( 0), C(128), C( 0), },
{ C( 0), C( 0), C( 0), C( 0), C(103), C( 25), C( 0), C(103), C( 25), },
{ C( 0), C( 0), C( 0), C( 0), C( 64), C( 64), C( 0), C( 64), C( 64), }
}
};
#undef C
};
template <class T>
constexpr typename Subsample<T>::kernel_type Subsample<T>::kernel[5][5][9];
#endif /* __cplusplus */
#endif /* __GIMP_BRUSH_CORE_KERNELS_H__ */