• Home
  • Install
  • Cosmos Website
  • Articles
  • Cosmos
  • X#
  • IL2CPU
Show / Hide Table of Contents
  • Cosmos.Core
    • ACPI
    • ACPI.RSDPtr
    • Bootstrap
    • CPU
    • GCImplementation
    • GCTable
    • Global
    • INTs
    • INTs.EFlagsEnum
    • INTs.ExceptionInterruptDelegate
    • INTs.IRQContext
    • INTs.IRQDelegate
    • INTs.MMXContext
    • INTs.TSS
    • IOPort
    • KernelPanics
    • ManagedMemoryBlock
    • MemoryBlock
    • MemoryBlock08
    • MemoryBlock16
    • MemoryBlock32
    • MemoryMapBlock
    • MemoryOperations
    • PIC
    • PIC.Cmd
    • RawMemoryMapBlock
    • VTable
    • VTablesImpl
  • Cosmos.Core.IOGroup
    • ATA
    • PIC
    • PS2Controller
  • Cosmos.Core.Memory
    • Heap
    • HeapLarge
    • HeapMedium
    • HeapSmall
    • ObjectGCStatus
    • RAT
    • RAT.PageType
    • RootSMTBlock
    • SMTBlock
    • SMTPage
  • Cosmos.Core.MemoryGroup
    • AHCI
  • Cosmos.Core.Multiboot
    • Multiboot2
  • Cosmos.Core.Multiboot.Tags
    • AcpiNew
    • AcpiOld
    • BasicMemoryInformation
    • EFI64
    • Framebuffer
    • MB2Tag
    • MemoryMap
  • Cosmos.Core_Asm
    • ArrayClearAsm
    • ArrayGetLengthAsm
    • ArrayImpl
    • ArrayInternalCopyAsm
    • BufferBlockCopyAsm
    • BufferImpl
    • CPUCanReadCPUIDAsm
    • CPUDisableINTsAsm
    • CPUEnableINTsAsm
    • CPUGetEBPValue
    • CPUGetEndOfKernelAsm
    • CPUGetESPValue
    • CPUGetStackStart
    • CPUHaltAsm
    • CPUImpl
    • CPUInitFloatAsm
    • CPUInitSSEAsm
    • CPUReadCPUIDAsm
    • CPUReadModelSpecificRegisterAsm
    • CPUReadTimestampCounterAsm
    • CPUSetESPValue
    • CPUUpdateIDTAsm
    • CPUZeroFillAsm
    • DelegateCtorAsm
    • DelegateGetMulticastInvokeAsm
    • DelegateImpl
    • DelegateInvokeAsm
    • GCImplementationImpl
    • IOPortImpl
    • Multiboot2Impl
    • Multiboot2ImplAsm
    • RuntimeHelpersImpl
  • Cosmos.Core_Asm.MemoryOperations
    • MemoryOperationsCopy128BlocksAsm
    • MemoryOperationsCopy128BytesAsm
    • MemoryOperationsCopy16BytesAsm
    • MemoryOperationsCopy32BytesAsm
    • MemoryOperationsCopy64BytesAsm
    • MemoryOperationsFill16BlocksAsm
  • Cosmos.Debug.Kernel
    • Debugger
    • DebuggerFactory
  • Cosmos.HAL
    • BaudRate
    • Bootstrap
    • CardType
    • ClassID
    • COMPort
    • DataReceivedHandler
    • Device
    • DeviceID
    • Global
    • KeyboardBase
    • KeyboardBase.KeyPressedEventHandler
    • MouseBase
    • MouseBase.MouseChangedEventHandler
    • NetworkDevice
    • PCI
    • PCIBaseAddressBar
    • PCIDevice
    • PCIDevice.Config
    • PCIDevice.DeviceClass
    • PCIDevice.PCIBist
    • PCIDevice.PCICommand
    • PCIDevice.PCIHeaderType
    • PCIDevice.PCIInterruptPIN
    • PCIDeviceBridge
    • PCIDeviceCardbus
    • PCIDeviceNormal
    • PCSpeaker
    • PIT
    • PIT.PITTimer
    • PIT.PITTimer.OnTrigger
    • Power
    • ProgramIF
    • PS2Controller
    • PS2Keyboard
    • PS2Mouse
    • RTC
    • SerialPort
    • SpeakerExtensions
    • SubclassID
    • TextScreen
    • TextScreenBase
    • TextScreenHelpers
    • VendorID
  • Cosmos.HAL.Audio
    • AudioBitDepth
    • AudioBuffer
    • IAudioBufferProvider
    • SampleFormat
  • Cosmos.HAL.BlockDevice
    • AHCI
    • Ata
    • Ata.BusPositionEnum
    • Ata.ControllerIdEnum
    • ATA_PIO
    • ATA_PIO.Cmd
    • ATA_PIO.DvcSelVal
    • ATA_PIO.Ident
    • ATA_PIO.SpecLevel
    • ATA_PIO.Status
    • ATAPI
    • ATAPI.PacketCommands
    • BlockDevice
    • BlockDeviceType
    • EBR
    • EBR.PartInfo
    • GPT
    • GPT.GPartInfo
    • IDE
    • MBR
    • MBR.PartInfo
    • Partition
  • Cosmos.HAL.BlockDevice.Ports
    • SATA
    • SATAPI
    • StoragePort
  • Cosmos.HAL.BlockDevice.Registers
    • AHCISignature
    • ATACommands
    • ATADeviceStatus
    • Base
    • Bases
    • CommandAndStatus
    • CurrentInterfaceSpeedStatus
    • DeviceDetectionStatus
    • FISRegisterD2H
    • FISRegisterH2D
    • FISSize
    • FISType
    • GenericRegisters
    • HBACommandHeader
    • HBACommandTable
    • HBAPRDTEntry
    • InterfacePowerManagementStatus
    • InterruptEnable
    • InterruptStatus
    • PortRegisters
    • PortType
  • Cosmos.HAL.Drivers.Audio
    • AC97
    • AudioDriver
  • Cosmos.HAL.Drivers.Network
    • AMDPCNetII
    • E1000
    • E1000.RXDesc
    • E1000.TXDesc
    • E1000DeviceID
    • RTL8139
  • Cosmos.HAL.Drivers.USB
    • USBHost
  • Cosmos.HAL.Drivers.Video
    • VBEDriver
    • VGADriver
    • VGADriver.ColorDepth
    • VGADriver.ScreenSize
    • VGADriver.TextSize
  • Cosmos.HAL.Drivers.Video.SVGAII
    • Capability
    • FIFO
    • FIFOCommand
    • ID
    • IOPortOffset
    • Register
    • VMWareSVGAII
  • Cosmos.HAL.Network
    • MACAddress
    • NetworkInit
  • Cosmos.System
    • Console
    • ConsoleKeyEx
    • ConsoleKeyExExtensions
    • Durations
    • Global
    • Kernel
    • KeyboardManager
    • KeyEvent
    • KeyEvent.KeyEventType
    • KeyMapping
    • MouseManager
    • MouseState
    • Notes
    • PCSExtensions
    • PCSpeaker
    • Power
    • ScanMapBase
    • VMTools
  • Cosmos.System.Audio
    • AudioManager
    • AudioMixer
    • AudioStream
  • Cosmos.System.Audio.DSP.Processing
    • AudioPostProcessor
    • GainPostProcessor
  • Cosmos.System.Audio.IO
    • AudioBufferReader
    • AudioBufferReadWriteBase
    • AudioBufferWriter
    • MemoryAudioStream
    • SeekableAudioStream
  • Cosmos.System.ExtendedASCII
    • CosmosEncodingProvider
  • Cosmos.System.FileSystem
    • CosmosVFS
    • Disk
    • FileSystem
    • FileSystemFactory
    • ManagedPartition
  • Cosmos.System.FileSystem.FAT
    • FatFileSystemFactory
  • Cosmos.System.FileSystem.FAT.Listing
    • FatDirectoryEntryAttributeConsts
    • FatDirectoryEntryMetadata
    • FatDirectoryEntryMetadata.LongFilenameEntryMetadata
  • Cosmos.System.FileSystem.ISO9660
    • ISO9660FileSystem
    • ISO9660FileSystemFactory
  • Cosmos.System.FileSystem.Listing
    • DirectoryEntry
    • DirectoryEntryTypeEnum
  • Cosmos.System.FileSystem.VFS
    • FileSystemManager
    • VFSBase
    • VFSManager
  • Cosmos.System.Graphics
    • Bitmap
    • Canvas
    • ColorDepth
    • ColorOrder
    • FullScreenCanvas
    • Image
    • ImageFormat
    • Mode
    • SVGAIICanvas
    • VBECanvas
    • VGACanvas
    • VGAScreen
  • Cosmos.System.Graphics.Fonts
    • Font
    • PCScreenFont
    • UnicodeMapping
  • Cosmos.System.Helpers
    • ArrayHelper
  • Cosmos.System.IO
    • ConsoleStream
    • SyncTextReader
  • Cosmos.System.Keyboard
    • KeyEventHelper
  • Cosmos.System.Network
    • EthernetPacket
    • NetworkDebugger
    • NetworkStack
  • Cosmos.System.Network.ARP
    • ARPPacket
  • Cosmos.System.Network.Config
    • DNSConfig
    • IPConfig
    • NetworkConfig
    • NetworkConfiguration
  • Cosmos.System.Network.IPv4
    • Address
    • EndPoint
    • ICMPClient
    • ICMPPacket
    • IPPacket
    • OutgoingBuffer
  • Cosmos.System.Network.IPv4.TCP
    • Flags
    • Status
    • Tcp
    • TCPOption
    • TCPPacket
    • TransmissionControlBlock
  • Cosmos.System.Network.IPv4.UDP
    • UdpClient
    • UDPPacket
  • Cosmos.System.Network.IPv4.UDP.DHCP
    • DHCPClient
    • DHCPOption
    • DHCPPacket
  • Cosmos.System.Network.IPv4.UDP.DNS
    • DNSAnswer
    • DnsClient
    • DNSPacket
    • DNSPacketAnswer
    • DNSPacketAsk
    • DNSQuery
    • ReplyCode
  • Cosmos.System.ScanMaps
    • DEStandardLayout
    • ESStandardLayout
    • FRStandardLayout
    • GBStandardLayout
    • TRStandardLayout
    • US_Dvorak
    • USStandardLayout

Class Bitmap

Represents a bitmap image.

Inheritance
System.Object
Image
Bitmap
Inherited Members
Image.RawData
Image.Width
Image.Height
Image.Depth
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Cosmos.System.Graphics
Assembly: Cosmos.System2.dll
Syntax
public class Bitmap : Image

Constructors

| Improve this Doc View Source

Bitmap(Byte[])

Initializes a new instance of the Bitmap class, with the specified image data byte array.

Declaration
public Bitmap(byte[] imageData)
Parameters
Type Name Description
System.Byte[] imageData

byte array.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if imageData is null / memory error.

System.ArgumentException

Thrown on memory error.

System.ArgumentOutOfRangeException

Thrown on fatal error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException

Thrown on fatal error.

System.ObjectDisposedException

Thrown on fatal error.

System.Exception
  • Thrown if header is not from a BMP.
  • Info header size has the wrong value.
  • Number of planes is not 1.
  • Total Image Size is smaller than pure image size.
System.NotImplementedException

Thrown if pixelsize is other then 32 / 24 or the file compressed.

| Improve this Doc View Source

Bitmap(Byte[], ColorOrder)

Initializes a new instance of the Bitmap class, with the specified image data byte array.

Declaration
public Bitmap(byte[] imageData, ColorOrder colorOrder = ColorOrder.BGR)
Parameters
Type Name Description
System.Byte[] imageData

byte array.

ColorOrder colorOrder

Order of colors in each pixel.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if imageData is null / memory error.

System.ArgumentException

Thrown on memory error.

System.ArgumentOutOfRangeException

Thrown on fatal error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException

Thrown on fatal error.

System.ObjectDisposedException

Thrown on fatal error.

System.Exception
  • Thrown if header is not from a BMP.
  • Info header size has the wrong value.
  • Number of planes is not 1.
  • Total Image Size is smaller than pure image size.
System.NotImplementedException

Thrown if pixelsize is other then 32 / 24 or the file compressed.

| Improve this Doc View Source

Bitmap(String)

Initializes a new instance of the Bitmap class, using the specified path to a BMP file.

Declaration
public Bitmap(string path)
Parameters
Type Name Description
System.String path

Path to file.

Exceptions
Type Condition
System.ArgumentException
  • Thrown if path is invalid.
  • Memory error.
System.ArgumentNullException
  • Thrown if path is null.
  • Memory error.
System.ArgumentOutOfRangeException

Thrown on fatal error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException
  • Thrown on fatal error.
  • The path refers to non-file.
System.ObjectDisposedException

Thrown if the stream is closed.

System.Exception
  • Thrown if header is not from a BMP.
  • Info header size has the wrong value.
  • Number of planes is not 1. Can not read file.
  • Total Image Size is smaller than pure image size.
System.NotImplementedException

Thrown if pixelsize is other then 32 / 24 or the file compressed.

System.Security.SecurityException

Thrown if the caller does not have permissions to read / write the file.

System.IO.FileNotFoundException

Thrown if the file cannot be found.

System.IO.DirectoryNotFoundException

Thrown if the specified path is invalid.

System.IO.PathTooLongException

Thrown if the specified path is exceed the system-defined max length.

| Improve this Doc View Source

Bitmap(String, ColorOrder)

Initializes a new instance of the Bitmap class, with a specified path to a BMP file.

Declaration
public Bitmap(string path, ColorOrder colorOrder = ColorOrder.BGR)
Parameters
Type Name Description
System.String path

Path to file.

ColorOrder colorOrder

Order of colors in each pixel.

Exceptions
Type Condition
System.ArgumentException
  • Thrown if path is invalid.
  • Memory error.
System.ArgumentNullException
  • Thrown if path is null.
  • Memory error.
System.ArgumentOutOfRangeException

Thrown on fatal error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException
  • Thrown on fatal error.
  • The path refers to non-file.
System.ObjectDisposedException

Thrown if the stream is closed.

System.Exception
  • Thrown if header is not from a BMP.
  • Info header size has the wrong value.
  • Number of planes is not 1. Can not read file.
  • Total Image Size is smaller than pure image size.
System.NotImplementedException

Thrown if pixelsize is other then 32 / 24 or the file compressed.

System.Security.SecurityException

Thrown if the caller does not have permissions to read / write the file.

System.IO.FileNotFoundException

Thrown if the file cannot be found.

System.IO.DirectoryNotFoundException

Thrown if the specified path is invalid.

System.IO.PathTooLongException

Thrown if the specified path is exceed the system-defined max length.

| Improve this Doc View Source

Bitmap(UInt32, UInt32, ColorDepth)

Initializes a new instance of Bitmap class.

Declaration
public Bitmap(uint width, uint height, ColorDepth colorDepth)
Parameters
Type Name Description
System.UInt32 width

The width of the image.

System.UInt32 height

The height of the image.

ColorDepth colorDepth

The color depth.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown when either the width or height is lower than 0.

| Improve this Doc View Source

Bitmap(UInt32, UInt32, Byte[], ColorDepth)

Initializes a new instance of Bitmap class from a byte array representing the pixels.

Declaration
public Bitmap(uint width, uint height, byte[] pixelData, ColorDepth colorDepth)
Parameters
Type Name Description
System.UInt32 width

The width of the bitmap.

System.UInt32 height

The height of the bitmap.

System.Byte[] pixelData

A byte array which includes the values for each pixel.

ColorDepth colorDepth

The format of the pixel data.

Exceptions
Type Condition
System.NotImplementedException

Thrown if color depth is not 32.

System.OverflowException

Thrown if bitmap size is bigger than Int32.MaxValue.

System.ArgumentException

Thrown on fatal error.

System.ArgumentNullException

Thrown on memory error.

System.ArgumentOutOfRangeException

Thrown on fatal error.

Methods

| Improve this Doc View Source

Save(Stream, ImageFormat)

Saves the image to the given stream.

Declaration
public void Save(Stream stream, ImageFormat imageFormat = ImageFormat.BMP)
Parameters
Type Name Description
System.IO.Stream stream

The target stream.

ImageFormat imageFormat

The format to save the image with.

Exceptions
Type Condition
System.ArgumentNullException

Thrown on memory error.

System.RankException

Thrown on fatal error.

System.ArrayTypeMismatchException

Thrown on fatal error.

System.InvalidCastException

Thrown on fatal error.

System.ArgumentOutOfRangeException

Thrown on memory error.

System.ArgumentException

Thrown on memory error.

System.OverflowException

Thrown on memory error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException

Thrown if the stream does not support writing.

System.ObjectDisposedException

Thrown if the stream is closed.

| Improve this Doc View Source

Save(String)

Saves the given image as a BMP file.

Declaration
public void Save(string path)
Parameters
Type Name Description
System.String path

The path to the file.

Exceptions
Type Condition
System.ArgumentNullException

Thrown on memory error.

System.RankException

Thrown on fatal error.

System.ArrayTypeMismatchException

Thrown on fatal error.

System.InvalidCastException

Thrown on fatal error.

System.ArgumentOutOfRangeException

Thrown on memory error.

System.ArgumentException

Thrown on memory error.

System.OverflowException

Thrown on memory error.

System.IO.IOException

Thrown on IO error.

System.NotSupportedException

Thrown on fatal error.

System.ObjectDisposedException

Thrown on fatal error.

  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
☀
☾