2022-10-15 11:58:56 +02:00
|
|
|
// Copyright 2022 The Ebitengine Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package graphicsdriver
|
|
|
|
|
|
|
|
type Blend struct {
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorSourceRGB BlendFactor
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorSourceAlpha BlendFactor
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorDestinationRGB BlendFactor
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorDestinationAlpha BlendFactor
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendOperationRGB BlendOperation
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendOperationAlpha BlendOperation
|
|
|
|
}
|
|
|
|
|
2022-10-16 13:49:12 +02:00
|
|
|
type BlendFactor byte
|
2022-10-15 11:58:56 +02:00
|
|
|
|
|
|
|
const (
|
|
|
|
BlendFactorZero BlendFactor = iota
|
|
|
|
BlendFactorOne
|
2022-10-17 04:25:58 +02:00
|
|
|
BlendFactorSourceColor
|
|
|
|
BlendFactorOneMinusSourceColor
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorSourceAlpha
|
|
|
|
BlendFactorOneMinusSourceAlpha
|
2022-10-16 18:00:02 +02:00
|
|
|
BlendFactorDestinationColor
|
2022-10-17 04:25:58 +02:00
|
|
|
BlendFactorOneMinusDestinationColor
|
|
|
|
BlendFactorDestinationAlpha
|
|
|
|
BlendFactorOneMinusDestinationAlpha
|
|
|
|
BlendFactorSourceAlphaSaturated
|
2022-10-15 11:58:56 +02:00
|
|
|
)
|
|
|
|
|
2022-10-16 13:49:12 +02:00
|
|
|
type BlendOperation byte
|
2022-10-15 11:58:56 +02:00
|
|
|
|
|
|
|
const (
|
|
|
|
BlendOperationAdd BlendOperation = iota
|
2022-10-16 16:33:16 +02:00
|
|
|
BlendOperationSubtract
|
|
|
|
BlendOperationReverseSubtract
|
2023-10-12 16:55:31 +02:00
|
|
|
BlendOperationMin
|
|
|
|
BlendOperationMax
|
2022-10-15 11:58:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var BlendSourceOver = Blend{
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorSourceRGB: BlendFactorOne,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorSourceAlpha: BlendFactorOne,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorDestinationRGB: BlendFactorOneMinusSourceAlpha,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorDestinationAlpha: BlendFactorOneMinusSourceAlpha,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendOperationRGB: BlendOperationAdd,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendOperationAlpha: BlendOperationAdd,
|
|
|
|
}
|
|
|
|
|
|
|
|
var BlendClear = Blend{
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorSourceRGB: BlendFactorZero,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorSourceAlpha: BlendFactorZero,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorDestinationRGB: BlendFactorZero,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorDestinationAlpha: BlendFactorZero,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendOperationRGB: BlendOperationAdd,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendOperationAlpha: BlendOperationAdd,
|
|
|
|
}
|
|
|
|
|
|
|
|
var BlendCopy = Blend{
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorSourceRGB: BlendFactorOne,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorSourceAlpha: BlendFactorOne,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendFactorDestinationRGB: BlendFactorZero,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendFactorDestinationAlpha: BlendFactorZero,
|
2022-10-16 17:49:56 +02:00
|
|
|
BlendOperationRGB: BlendOperationAdd,
|
2022-10-15 11:58:56 +02:00
|
|
|
BlendOperationAlpha: BlendOperationAdd,
|
|
|
|
}
|