|
LoadNewAFxImage | |
ImageNumber = LoadNewAFxImage(Filename$) | |
Parameters: Filename$ = The Filename and path of the image you wish to load |
|
Returns: ImageNumber = The Image Number where this image is stored |
|
LoadNewAFxImage reads an picture file from disc into PlayBasics image memory. The AFX image format retains the pictures Alpha Channel. When rendered, AFX formatted images don't use the mask colour (ImageMaskColour) to determine transparency within the image, rather they use the ALPHA channel intensities stored within each pixel. The Alpha intensities ranges from zero to 255. Zero being completely transparent and 255 being opaque (solid). Setting the alpha level of a pixel to say 127, will give an approximate 50/50 blend of the pixel to the background pixel. Since the each pixel within the image has an alpha component, we can use different alpha levels through the image. The common usage would be when images are drawn with anti aliased edges. In such images the paint rendering software softens the alpha channel on the edges around an image. So when it's drawn the image edges blend with the background giving us a smoother finish. FACTS: * LoadNewAFxImage supports various popular image formats that can include an Alpha Channel, such as PBI, BMP, TGA, PNG (See Images tutorial for image formats). LoadNewAFxImage prefers images be stored in 32bit for the best results. * Images loaded with LoadNewAFxImage are stored in your computers System memory. * AFX formatted images are most suitable for real time rotation and pixel related effects. They also withstand breaks in service from your operating system, such as, when the user presses ALT-TAB, or when the OS decides to hibernate while your program is running. Which would destroy images stored in Video Memory. * LoadNewAFxImage does not change PlayBASIC current graphics output. So if you want to redirect drawing operations onto a freshly loaded image, you'll have to do this manually with RenderToImage command. LoadNewAFxImage is an named alternate to using the LoadNewImage function and setting the Format parameter to 2 (FX format). Eg Index=LoadNewImage(Filename$,2) is functionality the same as Index=LoadNewAFxImage(Filename$), some programmers just prefer to use the named version for code readability. * Note: We highly recommended you read the Images tutorials also! Mini Tutorial: This examples loads n image from disc into image slot (index) #1 in memory, displays it to the screen at position 100x,100y, then waits for the user to press a key before ending.
|
|
Example Source: Download This Example
|
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |