Images

Function LoadImage(img$)

Returns an image id for an image loaded into memory.


Function LoadImageEx(img$, colkey)

Returns an image id for an image loaded into memory.


Function CreateImage(w, h, byref buffer)

Returns an image created from the buffer provided.

See also

CreateImageEx(), LoadImage()


Function CreateImageEx(w, h, byref buffer, color)

Returns an image created from the buffer provided The color parameter is a color key value to apply.


Sub BufferFromImage(slot, byref buffer)

Sub ImageExists(img)

Returns true if img is associated with an allocated image in memory.


Sub ColorKey(img_id, c)

Sets the color key for an image.


Sub SetBilinearFilter(flag)

Enables or disables the bilinear filter for drawing 2D images.


Function GetBilinearFilter()

Returns true if bilinear filtering is enabled.

See also

SetBilinearFilter()


Function CopyImage(img_id)

Returns a copy of an image.


Sub DeleteImage(img)

Removes an image from memory.


Sub SetImageAlpha(slot, a)

Sets the alpha blending value for an image. This value only applies in 2D drawing commands.

See also

GetImageAlpha()


Sub GetImageAlpha(img_id)

Returns the alpha blend value of an image.


Sub GetImageSize(slot, byref w, byref h)

Gets the Size of an image.


Sub SetBlendMode(blend_mode)

Sets the current blend mode.

Note: Only applies to 2D image drawing commands.

Possible Blend Modes:

  • BLEND_MODE_NONE
  • BLEND_MODE_ADD
  • BLEND_MODE_SUBTRACT
  • BLEND_MODE_REVSUBTRACT
  • BLEND_MODE_MIN
  • BLEND_MODE_MAX
  • BLEND_MODE_MIN_FACTOR
  • BLEND_MODE_MAX_FACTOR
  • BLEND_MODE_MIN_ALPHA
  • BLEND_MODE_MAX_ALPHA

See also

SetBlendMode()


Function GetBlendMode()

Returns the current blend mode.

Note: Only applies to 2D image drawing commands.

Possible Blend Modes:

  • BLEND_MODE_NONE
  • BLEND_MODE_ADD
  • BLEND_MODE_SUBTRACT
  • BLEND_MODE_REVSUBTRACT
  • BLEND_MODE_MIN
  • BLEND_MODE_MAX
  • BLEND_MODE_MIN_FACTOR
  • BLEND_MODE_MAX_FACTOR
  • BLEND_MODE_MIN_ALPHA
  • BLEND_MODE_MAX_ALPHA

See also

SetBlendMode()


Sub SetImageColorMod(img_id, c)

Sets the color modulation vlaue for an image.


Function GetImageColorMod(img)

Returns the color modulation of an image.


Sub DrawImage(img, x, y)

Draws an image on the active canvas.


Sub DrawImage_Blit(img, x, y, src_x, src_y, src_w, src_h)

Draws a portion of an image to the current canvas.


Sub DrawImage_BlitEx(slot, x, y, w, h, src_x, src_y, src_w, src_h)

Draws a portion of an image to the current canvas scaled to a given width and height.

See also

DrawImage_Blit()


Sub DrawImage_Rotate(slot, x, y, angle)

Draws an image to the current canvas rotated by a given angle.


Sub DrawImage_RotateEx(slot, x, y, src_x, src_y, src_w, src_h, angle)

Draws a portion of an image to the current canvas rotated by a given angle.


Sub DrawImage_Zoom(slot, x, y, zx, zy)

Draws an image to the current canvas scaled by a given factor.


Sub DrawImage_ZoomEx(slot, x, y, src_x, src_y, src_w, src_h, zx, zy)

Draws a portion of an Image to the current canvas scaled by a given factor.

See also

DrawImage_Zoom()


Sub DrawImage_Rotozoom(slot, x, y, angle, zx, zy)

Draws an image to the current canvas rotated and scaled.


Sub DrawImage_RotozoomEx(slot, x, y, src_x, src_y, src_w, src_h, angle, zx, zy)

Draws a portion of an image to the current canvas rotated and scaled.


Sub DrawImage_Flip(slot, x, y, h, v)

Draws an image flipped horizontally or vertically.

Note: h and v are boolean values


Sub DrawImage_FlipEx(slot, x, y, src_x, src_y, src_w, src_h, h, v)

Draws a portion of an image flipped horizontally or vertically.

Note: h and v are boolean values

See also

DrawImage_Flip()


Sub SaveBMP(img, file$)

Save an image to a *.bmp file.

title$ = "Sprite Test"
w = 640
h = 480
fullscreen = FALSE
vsync = FALSE

OpenWindow( title$, w, h, fullscreen, vsync )

my_canvas = OpenCanvas(w, h, 0, 0, w, h, 1)

Canvas(my_canvas)

SetColor(RGB(255,0, 0))
CircleFill(50, 50, 25)

SetColor(RGB(0, 255, 0))
CircleFill(590, 50, 25)

SetColor(RGB(0, 0, 255))
CircleFill(590, 430, 25)

img = CanvasClip(0, 0, 640, 480)
SaveBMP(img, "test.bmp")

Update()
WaitKey()

Sub SetAntiAliasMode(aa_mode)

Sets the anti-alias mode for draw image commands.

Possible modes:

  • AA_MODE_OFF
  • AA_MODE_SIMPLE
  • AA_MODE_QUALITY
  • AA_MODE_LINE_SMOOTH
  • AA_MODE_POINT_SMOOTH
  • AA_MODE_FULL_BASIC
  • AA_MODE_ALPHA_TO_COVERAGE

Function GetAntiAliasMode()

Returns the anti-alias mode for draw image commands.

Possible modes

  • AA_MODE_OFF
  • AA_MODE_SIMPLE
  • AA_MODE_QUALITY
  • AA_MODE_LINE_SMOOTH
  • AA_MODE_POINT_SMOOTH
  • AA_MODE_FULL_BASIC
  • AA_MODE_ALPHA_TO_COVERAGE

Sub ConvertToNormalMap(img_id, amp)

Converts an image to a format for normal maps.