Skip to content

User defined Fl_Image scaling method #58

@rageworx

Description

@rageworx

According to this issue, fltk/fltk#742
Windows don't provided any scaling method when high DPI case.

Looks a custom version may have this type of callback,

 The scaling algorithm to use for RGB images.
*/
enum Fl_RGB_Scaling {
  FL_RGB_SCALING_NEAREST = 0, ///< default RGB image scaling algorithm
#ifndef FLTK_EXT_VERSION
  FL_RGB_SCALING_BILINEAR     ///< more accurate, but slower RGB image scaling algorithm
#else
  FL_RGB_SCALING_BILINEAR = 1,
  FL_RGB_SCALING_USER
#endif /// of FLTK_EXT_VERSION    
};

#ifdef FLTK_EXT_VERSION
/** User scaling callback type definition for FL_RGB_SCALING_USER */
typedef void (Fl_Image_UserScale)(Fl_RGB_Image*, int w, int h, Fl_RGB_Image*);
typedef Fl_Image_UserScale* Fl_Image_UserScale_p; // needed for BORLAND
#endif /// of FLTK_EXT_VERSION    

...

#ifndef FLTK_EXT_VERSION
  static void scaling_algorithm(Fl_RGB_Scaling algorithm) {scaling_algorithm_ = algorithm; }
#else 
  static void scaling_algorithm(Fl_RGB_Scaling algorithm, Fl_Image_UserScale* userscale = NULL) 
  {
      scaling_algorithm_ = algorithm;
      user_scaling_ = userscale;
  }
#endif /// of FLTK_EXT_VERSION    

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions