using NTwain.Data; using NTwain.Internals; namespace NTwain.Triplets { /// /// Represents . /// public sealed class Palette8 : OpBase { internal Palette8(ITwainStateInternal session) : base(session) { } /// /// This operation causes the Source to report its current palette information. /// /// The palette. /// public ReturnCode Get(out TWPalette8 palette) { Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Palette8, Message.Get); palette = new TWPalette8(); return Dsm.DsmEntry(Session.AppId, Session.SourceId, Message.Get, palette); } /// /// This operation causes the Source to report its power-on default palette. /// /// The palette. /// public ReturnCode GetDefault(out TWPalette8 palette) { Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Palette8, Message.GetDefault); palette = new TWPalette8(); return Dsm.DsmEntry(Session.AppId, Session.SourceId, Message.GetDefault, palette); } /// /// This operation causes the Source to dispose of any current palette it has and to use its default /// palette for the next palette transfer. /// /// The palette. /// public ReturnCode Reset(out TWPalette8 palette) { Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Palette8, Message.Reset); palette = new TWPalette8(); return Dsm.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, palette); } /// /// This operation requests that the Source adopt the specified palette for use with all subsequent /// palette transfers. The application should be careful to supply a palette that matches the bit /// depth of the Source. The Source is not required to adopt this palette. The application should be /// careful to check the return value from this operation. /// /// The palette. /// public ReturnCode Set(TWPalette8 palette) { Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Palette8, Message.Set); return Dsm.DsmEntry(Session.AppId, Session.SourceId, Message.Set, palette); } } }