Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Anchor
AnimationController
Audio
Batcher
Body
Camera
Capsule
CastHit
CharacterBody
Circle
Collision
Color
DistanceJoint
Effect
Event
FilterJoint
Flip (Texture)
Font
ImageLayer
InputAction
Joint
Layer
Line
Map
MapObject
Mask
MotorJoint
MouseJoint
ObjectGroup
Orchestrator
PixelArray
PolarCoordinate
Polygon
PrismaticJoint
Rect
RevoluteJoint
RigidBody
Sample
Sampler
Shader
SheetStrip
StaticBody
Stream
Style
Terrain (TileSet)
Text
TextProperties
Texture
Tile (TileLayer)
Tile (TileSet)
TileLayer
TileResult (TileLayer)
TileSet
Timer
Transform
Tween
Vec2
Vertex
WeldJoint
WheelJoint
World

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Classes
  3. Texture

Texture

Represents a hardware-accelerated image that can be efficiently rendered.

Constructor

  • Texture(file_path: str | PathLike[str], filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(file_path: str | PathLike[str], filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture
  • Texture(pixel_array: PixelArray, filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(pixel_array: PixelArray, filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture
  • Texture(width: int, height: int, filter: FilterMode = FilterMode.DEFAULT, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(width: int, height: int, filter: FilterMode = FilterMode.DEFAULT, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture

Represents a hardware-accelerated image that can be efficiently rendered.

Properties


NameDescriptionType
alphaGet or set the alpha modulation of the texture as a float between 0.0 and 1.0.float
clip_areaGet or set the clip area (atlas region) of the texture.Rect
flipThe flip settings for horizontal and vertical mirroring.Texture.Flip
heightThe height of the texture in pixels.int
sizeThe dimensions of the texture as a Vec2.Vec2
tintGet or set the color tint applied to the texture.Color
usageThe usage flags describing how the texture can be used.TextureUsage
widthThe width of the texture in pixels.int

Methods


Get Rect

get_rect() → Rectget_rect() → Rect

Return a Rect with position (0, 0) and the texture's dimensions.

Returns

Rect : A rectangle representing the texture's bounds.

Has Usage

has_usage(usage: TextureUsage) → boolhas_usage(usage: TextureUsage) → bool

Check whether the texture was created with a specific usage flag.

Args

  • usage : Usage flag to test.

Returns

bool : True if the usage flag is present.

Make Additive

make_additive() → Nonemake_additive() → None

Set the texture to use additive blending mode.

In additive mode, the texture's colors are added to the destination, creating bright, glowing effects.

Make Multiply

make_multiply() → Nonemake_multiply() → None

Set the texture to use multiply blending mode.

In multiply mode, the texture's colors are multiplied with the destination, creating darkening and shadow effects.

Make Normal

make_normal() → Nonemake_normal() → None

Set the texture to use normal (alpha) blending mode.

This is the default blending mode for standard transparency effects.

PreviousTextProperties
NextTile (TileLayer)

On this page

ConstructorPropertiesMethodsGet RectHas UsageMake AdditiveMake MultiplyMake Normal