base:LoadBrush()

You can post your code snippets here for others to use and learn from
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

base:LoadBrush()

Post 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
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
Post Reply