Page 1 of 1

base:LoadBrush()

Posted: Wed Apr 15, 2015 10:45 pm
by djrikki
Load any in-built supported image format, load alpha channel (if present) and return whether the brush was loaded or not.
Additionally if the supplied path is referencing an AISS icon and the icon is missing, the absolute path will also be returned.

Code: Select all

Global base
base = {}

Const #AISSFOLDER = "tbimages:" ; stick this in your main routine somewhere.

;; base:LoadBrush(constant, path$)
Function base:LoadBrush(constant, path$)
    Local res, image = IsPicture(path$)
    ExitOnError(False)

    LoadBrush(constant, path$, {LoadAlpha = image.Alpha, Loader = InBuilt})

    If GetLastError() > 0 and FindStr(path$, #AISSFOLDER) > -1
        Return(False,path$)
    Else
        Return(True)
    EndIf
    ExitOnError(True)
EndFunction