xors2d.minib2d: Constants Globals Functions Types Source  

Графический движок Xors2D

Constants Summary

ALPHABLEND , COLLIDEDIMAGE , FILTEREDIMAGE , LIGHTBLEND , MIPMAPEDIMAGE

Globals Summary

AutoImageFlags , AutoMidHandle

Functions Summary

Cls Clear graphics buffer.
DrawCapsule Draw an oval.
DrawEmitter Load a multi-frame image.
DrawImage Отрисовать изображение в задний буффер
DrawImageRect Draw an image to a rectangular area of the back buffer.
DrawLine Draw a line.
DrawOval Draw an oval.
DrawPoly Draw a polygon.
DrawRect Draw a rectangle.
DrawRectRound Draw an oval.
DrawText Отрисовать текст
GetBlend Get current blend mode.
GetClsColor Get red, green, blue and alpha component of current cls color.
GetColor Get red, green, blue and alpha component of current color.
GetLineWidth Get line width.
GetViewport Get dimensions of current Viewport.
ImageHeight Получить высоту изображения
ImageWidth Получить ширину изображения
LoadAnimEmitter Load a multi-frame image.
LoadAnimImage Загрузить многокадровое изображение
LoadEmitter Load a multi-frame image.
LoadFont Загрузить графический шрифт
LoadImage Загрузить изображение
LoadMatrix Сбросить матрицу.
MidHandleImage Set an image's handle to its center.
Plot Plot a pixel.
PopMatrix Восстановит ранее сохраненную матрицу.
PositionTexture Установить позицию текстуры изображения
PushMatrix Сохранить текщую матрицу.
Rotate Повернуть матрицу.
Scale Масштабировать матрицу.
ScaleTexture Установить масштаб текстуры изображения
SetBlend Set current blend mode.
SetClsColor Set current Cls color.
SetColor Set current color.
SetFont Set current image font.
SetImageHandle Установить точку центра
SetLineWidth Sets pixel width of lines drawn with the DrawLine command.
SetViewport Set drawing viewport.
TextHeight Получить высоту текста
TextWidth Получить ширину текста
TileImage Draw an image in a tiled pattern.
Translate Перенести матрицу.
UpdateEmitter Load a multi-frame image.

Types Summary

TEmitter Источник частиц
TFont Графический шрифт
TFontLoader Загрузчик графического шрифта
TImage Класс изображений

Constants

Const ALPHABLEND:Int
DescriptionКласс изображений

Const COLLIDEDIMAGE:Int
DescriptionФлаг чуствительности изображения

Const FILTEREDIMAGE:Int
DescriptionФлаг фильтрации изображения при увеличении масштаба

Const LIGHTBLEND:Int
DescriptionКласс изображений

Const MIPMAPEDIMAGE:Int
DescriptionФлаг фильтрации изображения при уменьшении масштаба

Globals

Global AutoImageFlags:Int
DescriptionУстановить автоматический флаг изображений
InformationАвтоматический флаг используется функциями загрузки изображений в случае отсутствия параметра flags, по умолчанию флаг установлен в режим FILTEREDIMAGE ( смтри LoadImage, LoadAnimImage, LoadFont, LoadEmitter, LoadAnimEmitter )

Global AutoMidHandle:Int
DescriptionВключить или выключить автоматическое центирирование изображений
InformationВо время включенного режима автоцентрирования, все вновь созданные изображения автоматически центрируются ( смотри MidHandleImage ). При выключеном режиме изображения центрируются по локальному верхнему левому углу.

Functions

Function Cls()
DescriptionClear graphics buffer.
InformationClears the graphics buffer to the current cls color as determined by SetClsColor.

Function DrawCapsule(width:Float, height:Float)
DescriptionDraw an oval.
InformationDrawOval draws an oval that fits in the rectangular area defined by x, y, width and height parameters.

BlitzMax commands that affect the drawing of ovals include SetColor, SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha.


Function DrawEmitter(emitter:TEmitter, frame:Int = 0)
ReturnsAn image object.
DescriptionLoad a multi-frame image.
InformationLoadAnimImage extracts multiple image frames from a single, larger image. url can be either a string or an existing pixmap.

See LoadImage for valid flags values.


Function DrawImage:Byte(image:TImage, frame:Int = 0)
DescriptionОтрисовать изображение в задний буффер
InformationDrawing is affected by the current blend mode, color, scale and rotation.

If the blend mode is ALPHABLEND the image is affected by the current alpha value and images with alpha channels are blended correctly with the background.


Function DrawImageRect(image:TImage, x:Float, y:Float, w:Float, h:Float, frame:Int = 0)
DescriptionDraw an image to a rectangular area of the back buffer.
Informationx, y, w and h specify the destination rectangle to draw to.

frame is the image frame to draw.

Drawing is affected by the current blend mode, color, scale and rotation.

If the blend mode is ALPHABLEND, then the image is also affected by the current alpha value.


Function DrawLine(x:Float, y:Float)
DescriptionDraw a line.
InformationDrawLine draws a line from x, y to x2, y2 with the current drawing color.

BlitzMax commands that affect the drawing of lines include SetLineWidth, SetColor, SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha. The optional draw_last_pixel parameter can be used to control whether the last pixel of the line is drawn or not. Not drawing the last pixel can be useful if you are using certain blending modes.


Function DrawOval(width:Float, height:Float)
DescriptionDraw an oval.
InformationDrawOval draws an oval that fits in the rectangular area defined by x, y, width and height parameters.

BlitzMax commands that affect the drawing of ovals include SetColor, SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha.


Function DrawPoly(xy:Float[])
DescriptionDraw a polygon.
InformationDrawPoly draws a polygon with corners defined by an array of x#,y# coordinate pairs.

BlitzMax commands that affect the drawing of polygons include #SetColor, #SetHandle, #SetScale, #SetRotation, #SetOrigin, #SetViewPort, #SetBlend and #SetAlpha.


Function DrawRect(width:Float, height:Float)
DescriptionDraw a rectangle.
InformationSets the color of a rectangular area of pixels using the current drawing color defined with the SetColor command.

Other commands that affect the operation of DrawRect include SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha.


Function DrawRectRound(width:Float, height:Float, radius:Float)
DescriptionDraw an oval.
InformationDrawOval draws an oval that fits in the rectangular area defined by x, y, width and height parameters.

BlitzMax commands that affect the drawing of ovals include SetColor, SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha.


Function DrawText(txt:String)
DescriptionОтрисовать текст
InformationDrawText prints strings at position x,@y of the graphics display using the current image font specified by the SetImageFont command.

Other commands that affect DrawText include SetColor, SetHandle, SetScale, SetRotation, SetOrigin, SetViewPort, SetBlend and SetAlpha.

It is recomended that the blend mode be set to ALPHABLEND using the SetBlend command for non jagged antialiased text. Text that will be drawn at a smaller size using the SetScale command should use fonts loaded with the SMOOTHFONT style to benefit from mip-mapped filtering, see LoadImageFont for more information.


Function GetBlend:Int()
ReturnsThe current blend mode.
DescriptionGet current blend mode.

Function GetClsColor(r:Float Var, g:Float Var, b:Float Var, a:Float Var)
ReturnsRed, green and blue values in the range 0..1 in the variables supplied.
DescriptionGet red, green, blue and alpha component of current cls color.

Function GetColor(r:Float Var, g:Float Var, b:Float Var, a:Float Var)
ReturnsRed, green and blue values in the range 0..1 in the variables supplied.
DescriptionGet red, green, blue and alpha component of current color.

Function GetLineWidth:Float()
ReturnsCurrent line width, in pixels.
DescriptionGet line width.

Function GetViewport(x:Int Var, y:Int Var, width:Int Var, height:Int Var)
ReturnsThe horizontal, vertical, width and height values of the current Viewport in the variables supplied.
DescriptionGet dimensions of current Viewport.

Function ImageHeight:Int(image:TImage)
ReturnsШирина в пикселях
DescriptionПолучить высоту изображения

Function ImageWidth:Int(image:TImage)
ReturnsШирина в пикселях
DescriptionПолучить ширину изображения

Function LoadAnimEmitter:TEmitter(url:Object, cell_width:Int, cell_height:Int, first_cell:Int, cell_count:Int, flags:Int = -1)
ReturnsAn image object.
DescriptionLoad a multi-frame image.
InformationLoadAnimImage extracts multiple image frames from a single, larger image. url can be either a string or an existing pixmap.

Параметр url может принимать строку или карту пикселей.

Параметр flags : смотри LoadImage.


Function LoadAnimImage:TImage(url:Object, cell_width:Int, cell_height:Int, first_cell:Int, cell_count:Int, flags:Int = -1)
ReturnsОбьект изображения
DescriptionЗагрузить многокадровое изображение
InformationLoadAnimImage extracts multiple image frames from a single, larger image. url can be either a string or an existing pixmap.

Параметр url может принимать строку или карту пикселей.

Параметр flags : смотри LoadImage.


Function LoadEmitter:TEmitter(url:Object, flags:Int = -1)
ReturnsAn image object.
DescriptionLoad a multi-frame image.
InformationПараметр url может принимать строку или карту пикселей.

Параметр flags : смотри LoadImage.


Function LoadFont:TFont(pix_url:Object, txt_url:Object, flags:Int = -1)
ReturnsОбьект графического шрифта
DescriptionЗагрузить графический шрифт
InformationПараметр url может принимать строку или карту пикселей.

Параметр flags : смотри LoadImage.


Function LoadImage:TImage(url:Object, flags:Int = -1)
ReturnsОбьект изображения
DescriptionЗагрузить изображение
InformationПараметр url может принимать строку или карту пикселей.

Параметр flags может быть равен 0, -1 или любой следующей комбинации:

Значение флагаЭффект
FILTEREDIMAGEИзображения сглаживается при увеличении масштаба.

MIPMAPEDIMAGEИзображение сглаживается при уменьшении масштаба.

COLLIDEDIMAGEИзображение чуствительно к указателю мыши.

Флаги MIPMAPEDIMAGE и COLLIDEDIMAGE требует дополнительную выдеопамять, поэтому рекомендуется использовать только в случае реальной необходимости.

Если параметр флага не установлен или установлен в значение -1, то к изображению будет приминет автоматический флаг : смотри AutoImageFlags.

Для комбинирования флагов использется | ( логический оператор ИЛИ ).


Function LoadMatrix()
DescriptionСбросить матрицу.

Function MidHandleImage(image:TImage)
DescriptionSet an image's handle to its center.

Function Plot(image:TImage, size:Float = 1.0)
DescriptionPlot a pixel.
InformationSets the color of a single pixel on the back buffer to the current drawing color defined with the SetColor command. Other commands that affect the operation of Plot include SetOrigin, SetViewPort, SetBlend and SetAlpha.

Function PopMatrix()
DescriptionВосстановит ранее сохраненную матрицу.

Function PositionTexture(image:TImage, u:Float = 0.0, v:Float = 0.0)
DescriptionУстановить позицию текстуры изображения

Function PushMatrix()
DescriptionСохранить текщую матрицу.

Function Rotate(angle:Float)
DescriptionПовернуть матрицу.

Function Scale(x:Float, y:Float)
DescriptionМасштабировать матрицу.

Function ScaleTexture(image:TImage, u:Float = 1.0, v:Float = 1.0)
DescriptionУстановить масштаб текстуры изображения

Function SetBlend(blend:Int)
DescriptionSet current blend mode.
InformationSetBlend controls how pixels are combined with existing pixels in the back buffer when drawing commands are used in BlitzMax.

blend should be one of:

Blend modeEffect
ALPHABLENDPixels are alpha blended with existing backbuffer pixels
LIGHTBLENDPixel colors are added to backbuffer pixel colors, giving a 'lighting' effect


Function SetClsColor(r:Float, g:Float, b:Float, a:Float = 1.0)
DescriptionSet current Cls color.
InformationThe red, green, blue and alpha parameters should be in the range of 0 to 1.

The default cls color is black.


Function SetColor(r:Float, g:Float, b:Float, a:Float)
DescriptionSet current color.
InformationThe SetColor command affects the color of Plot, DrawRect, DrawLine, DrawText, DrawImage and DrawPoly.

The red, green, blue and alpha parameters should be in the range of 0 to 1.


Function SetFont(font:TFont = Null)
DescriptionSet current image font.
InformationIn order to DrawText in fonts other than the default system font use the SetImageFont command with a font handle returned by the LoadImageFont command.

Use

SetImageFont Null
to select the default, built-in font.

Function SetImageHandle(image:TImage, x:Float, y:Float)
DescriptionУстановить точку центра
InformationТочка цента отнимается от координат отрисавки изображения DrawImage перед вращением и мастабированием.

Function SetLineWidth(width:Float)
DescriptionSets pixel width of lines drawn with the DrawLine command.

Function SetViewport(x:Int, y:Int, width:Int, height:Int)
DescriptionSet drawing viewport.
InformationThe current ViewPort defines an area within the back buffer that all drawing is clipped to. Any regions of a DrawCommand that fall outside the current ViewPort are not drawn.

Function TextHeight:Int(txt:String)
Returnsthe height, in pixels, of text based on the current image font.
DescriptionПолучить высоту текста
InformationThis command is useful for calculating vertical alignment of text when using the DrawText command.

Function TextWidth:Int(txt:String)
Returnsthe width, in pixels, of text based on the current image font.
DescriptionПолучить ширину текста
InformationThis command is useful for calculating horizontal alignment of text when using the DrawText command.

Function TileImage(image:TImage, width:Float, height:Float, frame:Int = 0)
DescriptionDraw an image in a tiled pattern.
InformationTileImage draws an image in a repeating, tiled pattern, filling the current viewport.

Function Translate(x:Float, y:Float)
DescriptionПеренести матрицу.

Function UpdateEmitter(emitter:TEmitter, dt:Float = 1.0)
ReturnsAn image object.
DescriptionLoad a multi-frame image.
InformationLoadAnimImage extracts multiple image frames from a single, larger image. url can be either a string or an existing pixmap.

See LoadImage for valid flags values.


Types

Type TEmitter Extends TImage Abstract
DescriptionИсточник частиц
Methods Summary
SetEmission Источник частиц
SetIndepend Источник частиц
SetLifeTime Источник частиц
Method SetEmission(emission:Int) Abstract ' parts/sec
DescriptionИсточник частиц
Method SetIndepend(enable:Int = True) Abstract
DescriptionИсточник частиц
Method SetLifeTime(time:Float, spread:Float = 0.0) Abstract ' particle lifetime +\- spread
DescriptionИсточник частиц

Type TFont Extends TImage Abstract
DescriptionГрафический шрифт
Methods Summary
SetCharKerning Установить растояние между символами
SetCharRect Установить координаты на текстуре для символа
SetLineKerning Установить растояние между строками
Method SetCharKerning(kerning:Float) Abstract
DescriptionУстановить растояние между символами
Method SetCharRect(char:Byte, x:Int, y:Int, w:Int, h:Int) Abstract
DescriptionУстановить координаты на текстуре для символа
Method SetLineKerning(kerning:Float) Abstract
DescriptionУстановить растояние между строками

Type TFontLoader Abstract
DescriptionЗагрузчик графического шрифта
Methods Summary
Load Функция загрузки графического шрифта
Method Load:Byte(font:TFont, stream:TStream) Abstract
DescriptionФункция загрузки графического шрифта
InformationЕсли загрузка шрифта прошла успешно, функция должна вернуть True.

Type TImage Abstract
DescriptionКласс изображений
Methods Summary
Height Получить высоту изображения
PositionTexture Установить позицию текстуры изображения
ScaleTexture Установить масштаб текстуры изображения
SetHandle Установить точку центра
Width Получить ширину изображения
Method Height:Int() Abstract
ReturnsШирина в пикселях
DescriptionПолучить высоту изображения
Method PositionTexture(u:Float = 0.0, v:Float = 0.0) Abstract
DescriptionУстановить позицию текстуры изображения
Method ScaleTexture(u:Float = 1.0, v:Float = 1.0) Abstract
DescriptionУстановить масштаб текстуры изображения
Method SetHandle(x:Float, y:Float) Abstract
DescriptionУстановить точку центра
InformationТочка цента отнимается от координат отрисавки изображения DrawImage перед вращением и мастабированием.
Method Width:Int() Abstract
ReturnsШирина в пикселях
DescriptionПолучить ширину изображения