Compile Time Changes

Icons

Changes that have been done:

  1. We now return a DibImage instead of MemoryImage. For more details, check the run-time/behavior changes section.
  2. The argument bool newSvgRenderer now defaults to true for icon loading functions.
Old: public Image icon(str name, symbol key=#default, bool debug=false)
Old: public Image icon(str name, symbol key=#default, bool newSvgRenderer=false, bool debug=false)
New: public Image icon(str name, symbol key=#default, bool newSvgRenderer=true, bool debug=false)

Old: public Image icon(str name, bool enabled, symbol key=#default)
New: public Image icon(str name, bool enabled, symbol key=#default, bool newSvgRenderer=true)

Old: public Image disabledIcon(str name, symbol key=#default)
New: public Image disabledIcon(str name, symbol key=#default, bool newSvgRenderer=true)

Old: public Image dibIcon(str name, symbol key=#default, bool debug=false)
Old: public Image dibIcon(str name, symbol key=#default, bool newSvgRenderer=false, bool debug=false)
New: public Image dibIcon(str name, symbol key=#default, bool newSvgRenderer=true, bool debug=false)

Old: public Image disabledDibIcon(str name, symbol key=#default)
New: public Image disabledDibIcon(str name, symbol key=#default, bool newSvgRenderer=true)

IconFinder

The following fields and methods have been removed:

public str->DibImage dibIconLookup();
final public Image getDib(str name, bool debug=false)
final public Image getDib(str name, bool newSvgRenderer=false, bool debug=false)
final public Image getDisabledDib(str name, bool debug=false)

The following methods have been updated:

Old: final public Image get(str name, bool debug=false)
Old: final public Image get(str name, bool newSvgRenderer=false, bool debug=false)
New: final public Image get(str name, bool newSvgRenderer=true, bool debug=false)

IconDB

The following methods have been updated to remove bool dib=false:

Old: final public Image get(str name, symbol key, bool dib=false, bool debug=false)
Old: final public Image get(str name, symbol key, bool dib=false, bool newSvgRenderer=false, bool debug=false)
New: final public Image get(str name, symbol key, bool newSvgRenderer=true, bool debug=false)

Old: final public Image getDisabled(str name, symbol key, bool dib=false)
New: final public Image getDisabled(str name, symbol key)

SvgImage

Old: public constructor(Url imageFile, sizeI size=(-1, -1), SrcRef src=#:src)
Old: public constructor(Url imageFile, bool newSvgRenderer, sizeI size=(-1, -1)
New: public constructor(Url imageFile, bool newSvgRenderer=true, sizeI size=(-1, -1)

Old: public SvgImage vectorImage(Url url, bool use=false, SrcRef src=#:src)
Old: public SvgImage vectorImage(Url url, bool newSvgRenderer, bool use=false, SrcRef src=#:src)
New: public SvgImage vectorImage(Url url, bool newSvgRenderer=true, bool use=false, SrcRef src=#:src)

Foreign windows

The function showForeignWindow no longer restores the window when setting its visibility. Use restoreForeignWindow if you want the old behavior of restoring the window.

Old: public void showForeignWindow2(mwnd hwnd) = win_showForeignWindow;
New: public void showForeignWindow(mwnd hwnd) = win_showForeignWindow;

Old: public void showForeignWindow(mwnd hwnd) = win_restoreForeignWindow;
New: public void restoreForeignWindow(mwnd hwnd) = win_restoreForeignWindow;

Removed deprecated functionality

The following functions have been removed.

public bool faceliftDeveloper() : deprecated { return staffan or prismDeveloper; }
public bool isAlphaLegacy(char c) { return spellChecker.isAlpha(c); }

Drop down functionality

AppWindow

Old: final public pointI dropDownShow(pointI p, bool autoSize=true)
New: final public pointI dropDownShow(pointI p, bool autoSize=true, bool enforceMinWidth=true)

Window

Old: extend public pointI showDropDownMenu(pointI p, bool pInScreenCoords=false, bool autoSize=true)
New: extend public pointI showDropDownMenu(pointI p, bool pInScreenCoords=false,
                                           bool autoSize=true, bool enforceMinWidth=true)

WebViewConfig

We have added a new argument bool establishSocketConnection=false into the constructor.

Old: public constructor(str key,
		       str url,
		       int port=-1,
		       bool launch=false,
		       str label="CET",
		       bool showPageTitle=false,
		       bool showNavigation=true,
		       bool alwaysOnTop=false,
		       bool hideUrl=false,
		       pointI initPos=(-1, -1),
		       sizeI initSize=(-1, -1),
		       bool resizable=false,
		       sizeI minSize=(-1, -1),
		       sizeI maxSize=(-1, -1),
		       bool devMode=false,
		       webViewCB msgCallback=null) 
New: public constructor(str key,
		       str url,
		       int port=-1,
		       bool launch=false,
		       str label="CET",
		       bool showPageTitle=false,
		       bool showNavigation=true,
		       bool alwaysOnTop=false,
		       bool hideUrl=false,
		       pointI initPos=(-1, -1),
		       sizeI initSize=(-1, -1),
		       bool resizable=false,
		       sizeI minSize=(-1, -1),
		       sizeI maxSize=(-1, -1),
		       bool devMode=false,
		       webViewCB msgCallback=null,
		       bool establishSocketConnection=false)

MessageWindow

The sizeI size argument has been changed to int width.

Old: public constructor(Window parent,
                        str message,
                        Image image,
                        str key=null,
                        sizeI size=(0, 0),
                        int internalMargin=7,
                        Brush brush=ultraLightGrayBrush,
                        FrameStyle frameStyle=lightGrayPenFrame,
                        color textColor=black,
                        color linkColor=primary600,
                        color linkHoverColor=primary600,
                        int textSize=12,
                        str fontFace=null,
                        function(Control button, str key):bool linkCallback=null,
                        SrcRef src=#:src) {
New: public constructor(Window parent,
                        str message,
                        Image image,
                        str key=null,
                        int width=0,
                        int internalMargin=7,
                        Brush brush=ultraLightGrayBrush,
                        FrameStyle frameStyle=lightGrayPenFrame,
                        color textColor=black,
                        color linkColor=primary600,
                        color linkHoverColor=primary600,
                        int textSize=12,
                        str fontFace=null,
                        function(Control button, str key):bool linkCallback=null,
                        SrcRef src=#:src) {

This MessageWindow constructor now takes in argument int width.

Old: public constructor(Window parent,
                        str message,
                        messageType msgType=messageType.undefined,
                        str key=null,
                        int internalMargin=7,
                        function(Control button, str key):bool linkCallback=null,
                        SrcRef src=#:src) {
New: public constructor(Window parent,
                        str message,
                        messageType msgType=messageType.undefined,
                        str key=null,
                        int width=0,
                        int internalMargin=7,
                        function(Control button, str key):bool linkCallback=null,
                        SrcRef src=#:src) {

Runtime/Behavior Changes

Icon now returns DibImage

In 16.5, we introduced dibIcon(..) which loads icon as DibImage instead of MemoryImage. For 17.0, we are replacing the existing icon(..) to behave exactly as dibIcon(..).

Benefits of DibImage:

  • Can be resized with less artifacts as DibImage do not premultiply alpha values
  • Does not consume a windows GDI object, making it ideal for loading icons

For existing code that calls icon(..) and expects a MemoryImage, migration will be required. Common symptoms are:

  • Images not loading
  • Toolbox icons get rendered instead of loading an icon
  • Disabled images are not grayed out (blend is not applied)

How to resolve this:

  • Perform a Find in Files, search for "as MemoryImage" and "in MemoryImage"
  • Review the code if it can be generalized or change its logic accordingly
  • Perform the necessary changes to make it work with DibImage

In core, we had 2 common scenarios.

  1. Blend not being applied:
// Previous logic only handles MemoryImage.
byte beforeBlend = 255;
if (image as MemoryImage) {
    beforeBlend = image.blend;
    image.blend = 100;
}
image.transparentDraw(c.hdc, imgPos);
if (image as MemoryImage) image.blend = beforeBlend;

// New logic now handles MemoryImage, DibImage and SvgImage.
byte beforeBlend = image.blend;
image.blend = 100;
image.transparentDraw(c.hdc, imgPos);
image.blend = beforeBlend;
  1. UIBuilder not handling DibImage:
// Previous logic only handles MemoryImage and Icon
if (limb as SnapperLimb) {
	if (limb.image in MemoryImage or limb.image in Icon) {
		button = snapperImage(window, label, limb, limb.src);
	}
} else if (limb as AnimationLimb or limb.image in Icon) {
	if (limb.image in MemoryImage) {
		button = animationImage(window, label, limb, limb.src);
	}
}

// New logic now handles MemoryImage, Icon, DibImage and SvgImage
if (limb as SnapperLimb) {
	if (limb.image in MemoryImage or limb.image in Icon or limb.image in DibImage or limb.image in SvgImage) {
		button = snapperImage(window, label, limb, limb.src);
	}
} else if (limb as AnimationLimb) {
	if (limb.image in MemoryImage or limb.image in Icon or limb.image in DibImage or limb.image in SvgImage) {
		button = animationImage(window, label, limb, limb.src);
	}
}

New SVG renderer

In 16.5 Minor:

  • We have introduced a new SVG renderer that better supports the SVG spec.
  • It is only used for CET Icon Library, not affecting SVG loaded anywhere else.
  • The default SVG renderer a number of limitations, more information can be found here

For 17.0 Major:

  • We are defaulting to use the new SVG Renderer everywhere in CET.
  • You can choose to opt-out for cases the new renderer is incorrectly displaying the icons.
  • The new default SVG renderer aims to support the whole SVG spec, more information can be found here

If you spot issues loading your svg icons, you can pass newSvgRenderer=false when you call icon(..)

// New svg renderer causing issues
icon("myIcon", #:pkg)
icon("myIcon", false, #:pkg)
vectorImage(url);

// Fallback to svg renderer used in CET 16.5
icon("myIcon", #:pkg, newSvgRenderer=false)
icon("myIcon", false, #:pkg, newSvgRenderer=false)
vectorImage(url, newSvgRenderer=false);

IconFinder

As we now have better SVG rendering capabilities in CET, IconFinder will search for SVG first before other suffixes.

Old: public str[] suffixSearchPriority = [".png", ".bmp", ".cmpng", ".cmbmp", ".svg"];
New: public str[] suffixSearchPriority = [".svg", ".png", ".bmp", ".cmpng", ".cmbmp"];