Logo3.145.176.88 
  News  Recent  Stats  Forums  Discord  Contact
  Menu
 Username

 Password


   Register here

 Main menu
   BBCode test
 
 Content
   About OpenAmiga
   Guidelines
   Definitions
   SVN Access
   Licenses
   IRC channel
   Links
   ToDo List
   List Content
 
 Projects
   Suggested (1)
   Open (11)
   Assigned (27)
   Pending (0)
   Finished (7)
   Closed (5)
 
 Categories
   Cli (2)
   Datatype (9)
   Drivers (3)
   System (15)
   Workbench (16)
  Global images
[Print][View Files]
Guideline - Gadget images
<- Back to guidelines

Content
    
- Intro
- How to load images


Intro

More and more applications and utilities has started to use/require the AISS* image set for gadget imagery. To avoid creating our own standard, OpenAmiga projects shall use AISS as well.

Since the full AISS image set is not shipped with OS4 OpenAmiga projects must make sure that all images they need are accounted for.

Always make sure that your images use the same file names as used by AISS to avoid compatibility issues. Contact Mason if there's any images that are missing in the AISS package to find out how to deal with them.

Openamiga projects shall scan for images in this order:
    
- progdir:
- progdir:images/
- TBImages:


This way you can ship all necessary images with your application without requiring that AISS is installed. But it also allows the user to copy the images into the AISS framwork and your application will still find its images.

* AISS is a 3rd party package made by Martin "Mason" Merz that provides a large range of gadget imagery. Allowing different applications to use the same images for the same functions.

How to load images

Loading a single image:
struct Screen *AppScreen = IIntuition->LockPubScreen(NULL);

// To allocate your bitmap:
struct Image myImage* = BitMapObject, BITMAP_SourceFile,
                        (STRPTR)"copy",
                        BITMAP_Screen, AppScreen,
                        BITMAP_Precision, PRECISION_EXACT,
                        BITMAP_Masking,TRUE, End;

// You must also dispose the bitmap once done with it.

IIntuition->DisposeObject(myImage);
IIntuition->UnlockPubScreen(NULL,AppScreen);


Checking several source folders:
char buffer[512];

IUtility->Strlcpy(buffer,"progdir:",512);
IDOS->AddPart(buffer,myimagename,512);
myImage = LoadImage((STRPTR)buffer, AppScreen);
if (!myImage) // could not find images in progdir:
{
 IUtility->Strlcpy(buffer,"progdir:images/",512);
 IDOS->AddPart(buffer,myimagename,512);
 myImage = LoadImage((STRPTR)buffer, AppScreen);
}

if (!myImage) // could not find images in progdir:images
{
 IUtility->Strlcpy(buffer,"TBImages:",512);
 IDOS->AddPart(buffer,myimagename,512);
 myImage = LoadImage((STRPTR)buffer, AppScreen);
}

if (!myImage)
{
 // Could not find image file!
 // .. handle the error ..
}

// Where LoadImage() is:

struct Image *LoadImage(STRPTR buffer, struct Screen *AppScreen)
{
 return BitMapObject,
        BITMAP_SourceFile, buffer,
        BITMAP_Screen, AppScreen,
        BITMAP_Precision, PRECISION_EXACT,
        BITMAP_Masking,TRUE,
        End;
}

Open Amiga project website, Created in 2008 by Björn Hagström