-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from 5ohue/master
Add more types and functions
- Loading branch information
Showing
37 changed files
with
2,371 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum AlignType { | ||
Undefined = bindings::AlignType_UndefinedAlign, | ||
Left = bindings::AlignType_LeftAlign, | ||
Center = bindings::AlignType_CenterAlign, | ||
Right = bindings::AlignType_RightAlign, | ||
} | ||
|
||
impl Default for AlignType { | ||
fn default() -> Self { | ||
return AlignType::Undefined; | ||
} | ||
} | ||
|
||
impl From<AlignType> for bindings::AlignType { | ||
fn from(value: AlignType) -> Self { | ||
return value as bindings::AlignType; | ||
} | ||
} | ||
|
||
impl From<bindings::AlignType> for AlignType { | ||
fn from(value: bindings::AlignType) -> Self { | ||
/* | ||
* SAFETY: | ||
* | ||
* `AlignType` has the same repr as `bindings::AlignType` - u32 | ||
* | ||
* If `value` is less than Right than it is in the vaild range and can be safely | ||
* reinterpreted as `AlignType` | ||
*/ | ||
if value <= bindings::AlignType_RightAlign { | ||
return unsafe { std::mem::transmute(value) }; | ||
} | ||
return AlignType::default(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum AlphaChannelOption { | ||
Undefined = bindings::AlphaChannelOption_UndefinedAlphaChannel, | ||
Activate = bindings::AlphaChannelOption_ActivateAlphaChannel, | ||
Associate = bindings::AlphaChannelOption_AssociateAlphaChannel, | ||
Background = bindings::AlphaChannelOption_BackgroundAlphaChannel, | ||
Copy = bindings::AlphaChannelOption_CopyAlphaChannel, | ||
Deactivate = bindings::AlphaChannelOption_DeactivateAlphaChannel, | ||
Discrete = bindings::AlphaChannelOption_DiscreteAlphaChannel, | ||
Disassociate = bindings::AlphaChannelOption_DisassociateAlphaChannel, | ||
Extract = bindings::AlphaChannelOption_ExtractAlphaChannel, | ||
Off = bindings::AlphaChannelOption_OffAlphaChannel, | ||
On = bindings::AlphaChannelOption_OnAlphaChannel, | ||
Opaque = bindings::AlphaChannelOption_OpaqueAlphaChannel, | ||
Remove = bindings::AlphaChannelOption_RemoveAlphaChannel, | ||
Set = bindings::AlphaChannelOption_SetAlphaChannel, | ||
Shape = bindings::AlphaChannelOption_ShapeAlphaChannel, | ||
Transparent = bindings::AlphaChannelOption_TransparentAlphaChannel, | ||
OffIfOpaque = bindings::AlphaChannelOption_OffIfOpaqueAlphaChannel, | ||
} | ||
|
||
impl Default for AlphaChannelOption { | ||
fn default() -> Self { | ||
return AlphaChannelOption::Undefined; | ||
} | ||
} | ||
|
||
impl From<AlphaChannelOption> for bindings::AlphaChannelOption { | ||
fn from(value: AlphaChannelOption) -> Self { | ||
return value as bindings::AlphaChannelOption; | ||
} | ||
} | ||
|
||
impl From<bindings::AlphaChannelOption> for AlphaChannelOption { | ||
fn from(value: bindings::AlphaChannelOption) -> Self { | ||
/* | ||
* SAFETY: | ||
* | ||
* `AlphaChannelOption` has the same repr as `bindings::AlphaChannelOption` - u32 | ||
* | ||
* If `value` is less than OffIfOpaque than it is in the vaild range and can be safely | ||
* reinterpreted as `AlphaChannelOption` | ||
*/ | ||
if value <= bindings::AlphaChannelOption_OffIfOpaqueAlphaChannel { | ||
return unsafe { std::mem::transmute(value) }; | ||
} | ||
return AlphaChannelOption::default(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum AutoThresholdMethod { | ||
Undefined = bindings::AutoThresholdMethod_UndefinedThresholdMethod, | ||
Kapur = bindings::AutoThresholdMethod_KapurThresholdMethod, | ||
OTSU = bindings::AutoThresholdMethod_OTSUThresholdMethod, | ||
Triangle = bindings::AutoThresholdMethod_TriangleThresholdMethod, | ||
} | ||
|
||
impl Default for AutoThresholdMethod { | ||
fn default() -> Self { | ||
return AutoThresholdMethod::Undefined; | ||
} | ||
} | ||
|
||
impl From<AutoThresholdMethod> for bindings::AutoThresholdMethod { | ||
fn from(value: AutoThresholdMethod) -> Self { | ||
return value as bindings::AutoThresholdMethod; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy)] | ||
pub enum ChannelType { | ||
Undefined, | ||
RedChannel, | ||
GrayChannel, | ||
CyanChannel, | ||
LChannel, | ||
GreenChannel, | ||
MagentaChannel, | ||
aChannel, | ||
BlueChannel, | ||
bChannel, | ||
YellowChannel, | ||
BlackChannel, | ||
AlphaChannel, | ||
OpacityChannel, | ||
IndexChannel, | ||
ReadMaskChannel, | ||
WriteMaskChannel, | ||
MetaChannel, | ||
CompositeMaskChannel, | ||
CompositeChannels, | ||
AllChannels, | ||
TrueAlphaChannel, | ||
RGBChannels, | ||
GrayChannels, | ||
SyncChannels, | ||
DefaultChannels, | ||
} | ||
|
||
impl Default for ChannelType { | ||
fn default() -> Self { | ||
return ChannelType::DefaultChannels; | ||
} | ||
} | ||
|
||
impl From<ChannelType> for bindings::ChannelType { | ||
fn from(value: ChannelType) -> Self { | ||
match value { | ||
ChannelType::Undefined => { bindings::ChannelType_UndefinedChannel }, | ||
ChannelType::RedChannel => { bindings::ChannelType_RedChannel }, | ||
ChannelType::GrayChannel => { bindings::ChannelType_GrayChannel }, | ||
ChannelType::CyanChannel => { bindings::ChannelType_CyanChannel }, | ||
ChannelType::LChannel => { bindings::ChannelType_LChannel }, | ||
ChannelType::GreenChannel => { bindings::ChannelType_GreenChannel }, | ||
ChannelType::MagentaChannel => { bindings::ChannelType_MagentaChannel }, | ||
ChannelType::aChannel => { bindings::ChannelType_aChannel }, | ||
ChannelType::BlueChannel => { bindings::ChannelType_BlueChannel }, | ||
ChannelType::bChannel => { bindings::ChannelType_bChannel }, | ||
ChannelType::YellowChannel => { bindings::ChannelType_YellowChannel }, | ||
ChannelType::BlackChannel => { bindings::ChannelType_BlackChannel }, | ||
ChannelType::AlphaChannel => { bindings::ChannelType_AlphaChannel }, | ||
ChannelType::OpacityChannel => { bindings::ChannelType_OpacityChannel }, | ||
ChannelType::IndexChannel => { bindings::ChannelType_IndexChannel }, | ||
ChannelType::ReadMaskChannel => { bindings::ChannelType_ReadMaskChannel }, | ||
ChannelType::WriteMaskChannel => { bindings::ChannelType_WriteMaskChannel }, | ||
ChannelType::MetaChannel => { bindings::ChannelType_MetaChannel }, | ||
ChannelType::CompositeMaskChannel => { bindings::ChannelType_CompositeMaskChannel }, | ||
ChannelType::CompositeChannels => { bindings::ChannelType_CompositeChannels }, | ||
ChannelType::AllChannels => { bindings::ChannelType_AllChannels }, | ||
ChannelType::TrueAlphaChannel => { bindings::ChannelType_TrueAlphaChannel }, | ||
ChannelType::RGBChannels => { bindings::ChannelType_RGBChannels }, | ||
ChannelType::GrayChannels => { bindings::ChannelType_GrayChannels }, | ||
ChannelType::SyncChannels => { bindings::ChannelType_SyncChannels }, | ||
ChannelType::DefaultChannels => { bindings::ChannelType_DefaultChannels }, | ||
} | ||
} | ||
} | ||
|
||
impl From<bindings::ChannelType> for ChannelType { | ||
fn from(value: bindings::ChannelType) -> Self { | ||
// Unreachable match arms commented out | ||
match value { | ||
bindings::ChannelType_UndefinedChannel => { ChannelType::Undefined }, | ||
bindings::ChannelType_RedChannel => { ChannelType::RedChannel }, | ||
// bindings::ChannelType_GrayChannel => { ChannelType::GrayChannel }, | ||
// bindings::ChannelType_CyanChannel => { ChannelType::CyanChannel }, | ||
// bindings::ChannelType_LChannel => { ChannelType::LChannel }, | ||
bindings::ChannelType_GreenChannel => { ChannelType::GreenChannel }, | ||
// bindings::ChannelType_MagentaChannel => { ChannelType::MagentaChannel }, | ||
// bindings::ChannelType_aChannel => { ChannelType::aChannel }, | ||
bindings::ChannelType_BlueChannel => { ChannelType::BlueChannel }, | ||
// bindings::ChannelType_bChannel => { ChannelType::bChannel }, | ||
// bindings::ChannelType_YellowChannel => { ChannelType::YellowChannel }, | ||
bindings::ChannelType_BlackChannel => { ChannelType::BlackChannel }, | ||
bindings::ChannelType_AlphaChannel => { ChannelType::AlphaChannel }, | ||
// bindings::ChannelType_OpacityChannel => { ChannelType::OpacityChannel }, | ||
bindings::ChannelType_IndexChannel => { ChannelType::IndexChannel }, | ||
bindings::ChannelType_ReadMaskChannel => { ChannelType::ReadMaskChannel }, | ||
bindings::ChannelType_WriteMaskChannel => { ChannelType::WriteMaskChannel }, | ||
bindings::ChannelType_MetaChannel => { ChannelType::MetaChannel }, | ||
bindings::ChannelType_CompositeMaskChannel => { ChannelType::CompositeMaskChannel }, | ||
bindings::ChannelType_CompositeChannels => { ChannelType::CompositeChannels }, | ||
bindings::ChannelType_AllChannels => { ChannelType::AllChannels }, | ||
// bindings::ChannelType_TrueAlphaChannel => { ChannelType::TrueAlphaChannel }, | ||
// bindings::ChannelType_RGBChannels => { ChannelType::RGBChannels }, | ||
bindings::ChannelType_GrayChannels => { ChannelType::GrayChannels }, | ||
bindings::ChannelType_SyncChannels => { ChannelType::SyncChannels }, | ||
// bindings::ChannelType_DefaultChannels => { ChannelType::DefaultChannels }, | ||
_ => { ChannelType::Undefined }, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum ClipPathUnits { | ||
Undefined = bindings::ClipPathUnits_UndefinedPathUnits, | ||
UserSpace = bindings::ClipPathUnits_UserSpace, | ||
UserSpaceOnUse = bindings::ClipPathUnits_UserSpaceOnUse, | ||
ObjectBoundingBox = bindings::ClipPathUnits_ObjectBoundingBox, | ||
} | ||
|
||
impl Default for ClipPathUnits { | ||
fn default() -> Self { | ||
return ClipPathUnits::Undefined; | ||
} | ||
} | ||
|
||
impl From<ClipPathUnits> for bindings::ClipPathUnits { | ||
fn from(value: ClipPathUnits) -> Self { | ||
return value as bindings::ClipPathUnits; | ||
} | ||
} | ||
|
||
impl From<bindings::ClipPathUnits> for ClipPathUnits { | ||
fn from(value: bindings::ClipPathUnits) -> Self { | ||
/* | ||
* SAFETY: | ||
* | ||
* `ClipPathUnits` has the same repr as `bindings::ClipPathUnits` - u32 | ||
* | ||
* If `value` is less than ObjectBoundingBox than it is in the vaild range and can be safely | ||
* reinterpreted as `ClipPathUnits` | ||
*/ | ||
if value <= bindings::ClipPathUnits_ObjectBoundingBox { | ||
return unsafe { std::mem::transmute(value) }; | ||
} | ||
return ClipPathUnits::default(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum CompressionType { | ||
Undefined = bindings::CompressionType_UndefinedCompression, | ||
B44A = bindings::CompressionType_B44ACompression, | ||
B44 = bindings::CompressionType_B44Compression, | ||
BZip = bindings::CompressionType_BZipCompression, | ||
DXT1 = bindings::CompressionType_DXT1Compression, | ||
DXT3 = bindings::CompressionType_DXT3Compression, | ||
DXT5 = bindings::CompressionType_DXT5Compression, | ||
Fax = bindings::CompressionType_FaxCompression, | ||
Group4 = bindings::CompressionType_Group4Compression, | ||
JBIG1 = bindings::CompressionType_JBIG1Compression, | ||
JBIG2 = bindings::CompressionType_JBIG2Compression, | ||
JPEG2000 = bindings::CompressionType_JPEG2000Compression, | ||
JPEG = bindings::CompressionType_JPEGCompression, | ||
LosslessJPEG = bindings::CompressionType_LosslessJPEGCompression, | ||
LZMA = bindings::CompressionType_LZMACompression, | ||
LZW = bindings::CompressionType_LZWCompression, | ||
No = bindings::CompressionType_NoCompression, | ||
Piz = bindings::CompressionType_PizCompression, | ||
Pxr24 = bindings::CompressionType_Pxr24Compression, | ||
RLE = bindings::CompressionType_RLECompression, | ||
Zip = bindings::CompressionType_ZipCompression, | ||
ZipS = bindings::CompressionType_ZipSCompression, | ||
Zstd = bindings::CompressionType_ZstdCompression, | ||
WebP = bindings::CompressionType_WebPCompression, | ||
DWAA = bindings::CompressionType_DWAACompression, | ||
DWAB = bindings::CompressionType_DWABCompression, | ||
BC7 = bindings::CompressionType_BC7Compression, | ||
BC5 = bindings::CompressionType_BC5Compression, | ||
LERC = bindings::CompressionType_LERCCompression, | ||
} | ||
|
||
impl Default for CompressionType { | ||
fn default() -> Self { | ||
return CompressionType::Undefined; | ||
} | ||
} | ||
|
||
impl From<CompressionType> for bindings::CompressionType { | ||
fn from(value: CompressionType) -> Self { | ||
return value as bindings::CompressionType; | ||
} | ||
} | ||
|
||
impl From<bindings::CompressionType> for CompressionType { | ||
fn from(value: bindings::CompressionType) -> Self { | ||
/* | ||
* SAFETY: | ||
* | ||
* `CompressionType` has the same repr as `bindings::CompressionType` - u32 | ||
* | ||
* If `value` is less than LERC than it is in the vaild range and can be safely | ||
* reinterpreted as `CompressionType` | ||
*/ | ||
if value <= bindings::CompressionType_LERCCompression { | ||
return unsafe { std::mem::transmute(value) }; | ||
} | ||
return CompressionType::default(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use crate::bindings; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
#[repr(u32)] | ||
pub enum DecorationType { | ||
Undefined = bindings::DecorationType_UndefinedDecoration, | ||
No = bindings::DecorationType_NoDecoration, | ||
Underline = bindings::DecorationType_UnderlineDecoration, | ||
Overline = bindings::DecorationType_OverlineDecoration, | ||
LineThrough = bindings::DecorationType_LineThroughDecoration, | ||
} | ||
|
||
impl Default for DecorationType { | ||
fn default() -> Self { | ||
return DecorationType::Undefined; | ||
} | ||
} | ||
|
||
impl From<DecorationType> for bindings::DecorationType { | ||
fn from(value: DecorationType) -> Self { | ||
return value as bindings::DecorationType; | ||
} | ||
} | ||
|
||
impl From<bindings::DecorationType> for DecorationType { | ||
fn from(value: bindings::DecorationType) -> Self { | ||
/* | ||
* SAFETY: | ||
* | ||
* `DecorationType` has the same repr as `bindings::DecorationType` - u32 | ||
* | ||
* If `value` is less than LineThrough than it is in the vaild range and can be safely | ||
* reinterpreted as `DecorationType` | ||
*/ | ||
if value <= bindings::DecorationType_LineThroughDecoration { | ||
return unsafe { std::mem::transmute(value) }; | ||
} | ||
return DecorationType::default(); | ||
} | ||
} |
Oops, something went wrong.