From 058df974368783981b2ec1474302a6d4ad2f2292 Mon Sep 17 00:00:00 2001 From: oscarl-2 Date: Thu, 30 Oct 2003 00:21:09 +0000 Subject: [PATCH] completed translation --- .../bepascal/pas/src/be/interface/bitmap.pp | 165 ++++++----- .../pas/src/be/interface/graphicdefs.pp | 270 +++++++++++++++++- 2 files changed, 344 insertions(+), 91 deletions(-) diff --git a/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp b/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp index 66797a8..c870fd3 100644 --- a/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp +++ b/bepascal/source/bepascal/pas/src/be/interface/bitmap.pp @@ -18,59 +18,69 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA } -unit bitmap; +unit Bitmap; interface uses BeObj, Archivable, GraphicDefs, Message, OS, Rect, SupportDefs, View; -type -// PCardinal = ^Cardinal; +const + B_BITMAP_CLEAR_TO_WHITE = $00000001; + B_BITMAP_ACCEPTS_VIEWS = $00000002; + B_BITMAP_IS_AREA = $00000004; + B_BITMAP_IS_LOCKED = $00000008 or B_BITMAP_IS_AREA; + B_BITMAP_IS_CONTIGUOUS = $00000010 or B_BITMAP_IS_LOCKED; + B_BITMAP_IS_OFFSCREEN = $00000020; + B_BITMAP_WILL_OVERLAY = $00000040 or B_BITMAP_IS_OFFSCREEN; + B_BITMAP_RESERVE_OVERLAY_CHANNEL = $00000080; + B_ANY_BYTES_PER_ROW = -1; + +type BBitmap = class(BArchivable) private public // I will change "bounds" to "frame" in these constructors... // they clash with the Bounds function. // Also "bytesPerWow" --> "bytes_per_row" - constructor Create(frame : BRect; flags : Cardinal; depth : Color_Space; - bytes_per_row : Integer; screenID : Screen_ID); - constructor Create(frame : BRect; depth : Color_Space; - accepts_views : boolean; need_contiguous : boolean); - constructor Create(source : BBitmap; accepts_views : boolean; - need_contiguous : boolean); + constructor Create(frame : BRect; flags : Cardinal; depth : color_space; + bytes_per_row : Integer; screenID : screen_id); + constructor Create(frame : BRect; depth : color_space; + accepts_views : Boolean; need_contiguous : Boolean); + constructor Create(source : BBitmap; accepts_views : Boolean; + need_contiguous : Boolean); constructor Create(data : BMessage); destructor Destroy; override; function Instantiate(data : BMessage) : BArchivable; - function Archive(data : BMessage; deep : boolean) : Status_t; - function InitCheck : Status_t; - function IsValid : boolean; - function LockBits(state : PCardinal) : Status_t; + function Archive(data : BMessage; deep : Boolean) : status_t; + function InitCheck : status_t; + function IsValid : Boolean; + function LockBits(state : PCardinal) : status_t; procedure UnlockBits; - function Area : Area_ID; + function Area : area_id; function Bits : Pointer; function BitsLength : Integer; function BytesPerRow : Integer; - function ColorSpace : Color_Space; + function ColorSpace : color_space; function Bounds : BRect; - procedure SetBits(data : Pointer; length : integer; offset : integer; - cs : Color_Space); - function GetOverlayRestrictions(restrict : OverlayRestrictions) - : Status_t; + procedure SetBits(data : Pointer; length : Integer; offset : Integer; + cs : color_space); + function GetOverlayRestrictions(restrict : overlay_restrictions) + : status_t; procedure AddChild(view : BView); - function RemoveChild(view : BView) : boolean; - function CountChildren : integer; - function ChildAt(index : integer) : BView; + function RemoveChild(view : BView) : Boolean; + function CountChildren : Integer; + function ChildAt(index : Integer) : BView; function FindView(view_name : PChar) : BView; function FindView(point : BPoint) : BView; - function Lock : boolean; + function Lock : Boolean; procedure Unlock; - function IsLocked : boolean; + function IsLocked : Boolean; - function Perform(d : Perform_code; arg : Pointer) : Status_t; + function Perform(d : perform_code; arg : Pointer) : status_t; { procedure _ReservedBitmap1; procedure _ReservedBitmap2; @@ -82,9 +92,9 @@ type procedure set_bits_24(offset : integer; data : PChar; length : integer); procedure set_bits_24_local_gray(offset : integer; data : PChar; len : integer); procedure set_bits_24_local_256(offset : integer; data : PByte; len : integer); - procedure set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); - procedure set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); - procedure set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); + procedure set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); + procedure set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); + procedure set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); function get_server_token : integer; procedure InitObject(frame : TRect; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); procedure AssertPtr; @@ -104,17 +114,17 @@ type } end; -function BBitmap_Create(AObject : TBeObject; bounds : TCPlusObject; - flags : Cardinal; depth : Color_Space; bytesPerRow : Integer; - screenID : Screen_ID) : TCPlusObject; cdecl; +function BBitmap_Create(AObject : TBeObject; frame : TCPlusObject; + flags : Cardinal; depth : color_space; bytes_per_row : Integer; + screenID : screen_id) : TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create'; -function BBitmap_Create_1(AObject : TBeObject; bounds : TCPlusObject; - depth : Color_Space; accepts_views : boolean; need_contiguous : boolean) +function BBitmap_Create_1(AObject : TBeObject; frame : TCPlusObject; + depth : color_space; accepts_views : Boolean; need_contiguous : Boolean) : TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_1'; function BBitmap_Create_2(AObject : TBeObject; source : BBitmap; - accepts_views : boolean; need_contiguous : boolean) : TCPlusObject; cdecl; + accepts_views : Boolean; need_contiguous : Boolean) : TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_2'; function BBitmap_Create_3(AObject : TBeObject; data : TCPlusObject) @@ -125,21 +135,21 @@ procedure BBitmap_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_Free'; -function BBitmap_Instantiate(AObject : TCPlusObject; data : {TMessage}TCPlusObject) +function BBitmap_Instantiate(AObject : TCPlusObject; data : TCPlusObject) : BArchivable; cdecl; external BePascalLibName name 'BBitmap_Instantiate'; -function BBitmap_Archive(AObject : TCPlusObject; data : {TMessage}TCPlusObject; - deep : boolean) : Status_t; cdecl; +function BBitmap_Archive(AObject : TCPlusObject; data : TCPlusObject; + deep : Boolean) : status_t; cdecl; external BePascalLibName name 'BBitmap_Archive'; -function BBitmap_InitCheck(AObject : TCPlusObject) : Status_t; cdecl; +function BBitmap_InitCheck(AObject : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BBitmap_InitCheck'; -function BBitmap_IsValid(AObject : TCPlusObject) : boolean; cdecl; +function BBitmap_IsValid(AObject : TCPlusObject) : Boolean; cdecl; external BePascalLibName name 'BBitmap_IsValid'; function BBitmap_LockBits(AObject : TCPlusObject; state : PCardinal) - : Status_t; cdecl; external BePascalLibName name 'BBitmap_LockBits'; + : status_t; cdecl; external BePascalLibName name 'BBitmap_LockBits'; procedure BBitmap_UnlockBits(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_UnlockBits'; @@ -167,37 +177,37 @@ procedure BBitmap_SetBits(AObject : TCPlusObject; data : Pointer; external BePascalLibName name 'BBitmap_SetBits'; function BBitmap_GetOverlayRestrictions(AObject : TCPlusObject; - restrict : OverlayRestrictions) : Status_t; cdecl; + restrict : overlay_restrictions) : status_t; cdecl; external BePascalLibName name 'BBitmap_GetOverlayRestrictions'; -procedure BBitmap_AddChild(AObject : TCPlusObject; view : {TView}TCPlusObject); cdecl; +procedure BBitmap_AddChild(AObject : TCPlusObject; view : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_AddChild'; -function BBitmap_RemoveChild(AObject : TCPlusObject; view : {TView}TCPlusObject) - : boolean; cdecl; external BePascalLibName name 'BBitmap_RemoveChild'; +function BBitmap_RemoveChild(AObject : TCPlusObject; view : TCPlusObject) + : Boolean; cdecl; external BePascalLibName name 'BBitmap_RemoveChild'; -function BBitmap_CountChildren(AObject : TCPlusObject) : integer; cdecl; +function BBitmap_CountChildren(AObject : TCPlusObject) : Integer; cdecl; external BePascalLibName name 'BBitmap_CountChildren'; -function BBitmap_ChildAt(AObject : TCPlusObject; index : integer) : BView; +function BBitmap_ChildAt(AObject : TCPlusObject; index : Integer) : BView; cdecl; external BePascalLibName name 'BBitmap_ChildAt'; function BBitmap_FindView(AObject : TCPlusObject; view_name : PChar) : BView; cdecl; external BePascalLibName name 'BBitmap_FindView'; -function BBitmap_FindView(AObject : TCPlusObject; point : BPoint{TCPlusObject}) +function BBitmap_FindView(AObject : TCPlusObject; point : {BPoint}TCPlusObject) : BView; cdecl; external BePascalLibName name 'BBitmap_FindView'; -function BBitmap_Lock(AObject : TCPlusObject) : boolean; cdecl; +function BBitmap_Lock(AObject : TCPlusObject) : Boolean; cdecl; external BePascalLibName name 'BBitmap_Lock'; procedure BBitmap_Unlock(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_Unlock'; -function BBitmap_IsLocked(AObject : TCPlusObject) : boolean; cdecl; +function BBitmap_IsLocked(AObject : TCPlusObject) : Boolean; cdecl; external BePascalLibName name 'BBitmap_IsLocked'; -function BBitmap_Perform(AObject : TCPlusObject; d : Perform_code; arg : Pointer) : Status_t; cdecl; external BePascalLibName name 'BBitmap_Perform'; +function BBitmap_Perform(AObject : TCPlusObject; d : perform_code; arg : Pointer) : status_t; cdecl; external BePascalLibName name 'BBitmap_Perform'; { procedure BBitmap__ReservedBitmap1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap1'; @@ -210,9 +220,9 @@ procedure BBitmap_set_bits(AObject : TCPlusObject; offset : integer; data : PCha procedure BBitmap_set_bits_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24'; procedure BBitmap_set_bits_24_local_gray(AObject : TCPlusObject; offset : integer; data : PChar; len : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_local_gray'; procedure BBitmap_set_bits_24_local_256(AObject : TCPlusObject; offset : integer; data : PByte; len : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_local_256'; -procedure BBitmap_set_bits_24_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_24'; -procedure BBitmap_set_bits_8_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_8_24'; -procedure BBitmap_set_bits_gray_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_gray_24'; +procedure BBitmap_set_bits_24_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_24_24'; +procedure BBitmap_set_bits_8_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_8_24'; +procedure BBitmap_set_bits_gray_24(AObject : TCPlusObject; offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); cdecl; external BePascalLibName name 'BBitmap_set_bits_gray_24'; function BBitmap_get_server_token(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BBitmap_get_server_token'; procedure BBitmap_InitObject(AObject : TCPlusObject; frame : TCPlusObject; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); cdecl; external BePascalLibName name 'BBitmap_InitObject'; procedure BBitmap_AssertPtr(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_AssertPtr'; @@ -252,7 +262,7 @@ end; // BBitmap(BRect bounds, color_space depth, bool accepts_views = false, // bool need_contiguous = false); constructor BBitmap.Create(frame{bounds} : BRect; depth : Color_Space; - accepts_views : boolean; need_contiguous : Boolean); + accepts_views : Boolean; need_contiguous : Boolean); begin CPlusObject := BBitmap_Create_1(Self, frame.CPlusObject, depth, accepts_views, need_contiguous); @@ -266,8 +276,7 @@ begin CPlusObject := BBitmap_Create_2(Self, source, accepts_views, need_contiguous); end; -// BBitmap(BMessage *data); -constructor BBitmap.Create(data :BMessage); +constructor BBitmap.Create(data : BMessage); begin CPlusObject := BBitmap_Create_3(Self, data.CPlusObject); end; @@ -278,27 +287,27 @@ begin inherited; end; -function BBitmap.Instantiate(data :BMessage) : BArchivable; +function BBitmap.Instantiate(data : BMessage) : BArchivable; begin Result := BBitmap_Instantiate(CPlusObject, data.CPlusObject); end; -function BBitmap.Archive(data : BMessage; deep : boolean) : Status_t; +function BBitmap.Archive(data : BMessage; deep : Boolean) : status_t; begin Result := BBitmap_Archive(CPlusObject, data.CPlusObject, deep); end; -function BBitmap.InitCheck : Status_t; +function BBitmap.InitCheck : status_t; begin Result := BBitmap_InitCheck(CPlusObject); end; -function BBitmap.IsValid : boolean; +function BBitmap.IsValid : Boolean; begin Result := BBitmap_IsValid(CPlusObject); end; -function BBitmap.LockBits(state : PCardinal) : Status_t; +function BBitmap.LockBits(state : PCardinal) : status_t; begin Result := BBitmap_LockBits(CPlusObject, state); end; @@ -308,7 +317,7 @@ begin BBitmap_UnlockBits(CPlusObject); end; -function BBitmap.Area : Area_ID; +function BBitmap.Area : area_id; begin Result := BBitmap_Area(CPlusObject); end; @@ -318,17 +327,17 @@ begin Result := BBitmap_Bits(CPlusObject); end; -function BBitmap.BitsLength : integer; +function BBitmap.BitsLength : Integer; begin Result := BBitmap_BitsLength(CPlusObject); end; -function BBitmap.BytesPerRow : integer; +function BBitmap.BytesPerRow : Integer; begin Result := BBitmap_BytesPerRow(CPlusObject); end; -function BBitmap.ColorSpace : Color_Space; +function BBitmap.ColorSpace : color_space; begin Result := BBitmap_ColorSpace(CPlusObject); end; @@ -338,12 +347,12 @@ begin Result := BBitmap_Bounds(CPlusObject); end; -procedure BBitmap.SetBits(data : Pointer; length : integer; offset : integer; cs : Color_Space); +procedure BBitmap.SetBits(data : Pointer; length : Integer; offset : Integer; cs : color_space); begin BBitmap_SetBits(CPlusObject, data, length, offset, cs); end; -function BBitmap.GetOverlayRestrictions(restrict : OverlayRestrictions) : Status_t; +function BBitmap.GetOverlayRestrictions(restrict : overlay_restrictions) : status_t; begin Result := BBitmap_GetOverlayRestrictions(CPlusObject, restrict); end; @@ -353,17 +362,17 @@ begin BBitmap_AddChild(CPlusObject, view.CPlusObject); end; -function BBitmap.RemoveChild(view : BView) : boolean; +function BBitmap.RemoveChild(view : BView) : Boolean; begin Result := BBitmap_RemoveChild(CPlusObject, view.CPlusObject); end; -function BBitmap.CountChildren : integer; +function BBitmap.CountChildren : Integer; begin Result := BBitmap_CountChildren(CPlusObject); end; -function BBitmap.ChildAt(index : integer) : BView; +function BBitmap.ChildAt(index : Integer) : BView; begin Result := BBitmap_ChildAt(CPlusObject, index); end; @@ -378,7 +387,7 @@ begin Result := BBitmap_FindView(CPlusObject, point.CPlusObject); end; -function BBitmap.Lock : boolean; +function BBitmap.Lock : Boolean; begin Result := BBitmap_Lock(CPlusObject); end; @@ -388,18 +397,16 @@ begin BBitmap_Unlock(CPlusObject); end; -function BBitmap.IsLocked : boolean; +function BBitmap.IsLocked : Boolean; begin Result := BBitmap_IsLocked(CPlusObject); end; - -function BBitmap.Perform(d : Perform_code; arg : Pointer) : Status_t; +function BBitmap.Perform(d : perform_code; arg : Pointer) : status_t; begin Result := BBitmap_Perform(CPlusObject, d, arg); end; - { procedure TBitmap._ReservedBitmap1; begin @@ -451,17 +458,17 @@ begin BBitmap_set_bits_24_local_256(CPlusObject, offset, data, len); end; -procedure TBitmap.set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); +procedure TBitmap.set_bits_24_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); begin BBitmap_set_bits_24_24(CPlusObject, offset, data, length, big_endian_dst); end; -procedure TBitmap.set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); +procedure TBitmap.set_bits_8_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); begin BBitmap_set_bits_8_24(CPlusObject, offset, data, length, big_endian_dst); end; -procedure TBitmap.set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : boolean); +procedure TBitmap.set_bits_gray_24(offset : integer; data : PChar; length : integer; big_endian_dst : Boolean); begin BBitmap_set_bits_gray_24(CPlusObject, offset, data, length, big_endian_dst); end; @@ -547,4 +554,4 @@ begin end; } -end. +end. \ No newline at end of file diff --git a/bepascal/source/bepascal/pas/src/be/interface/graphicdefs.pp b/bepascal/source/bepascal/pas/src/be/interface/graphicdefs.pp index 3eef06a..408d735 100644 --- a/bepascal/source/bepascal/pas/src/be/interface/graphicdefs.pp +++ b/bepascal/source/bepascal/pas/src/be/interface/graphicdefs.pp @@ -1,20 +1,266 @@ -unit graphicdefs; +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002-2003 by the BePascal Team members: + Olivier Coursiere + Eric Jourde + Oscar Lesta + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit GraphicDefs; interface +uses + SupportDefs; + {$PACKRECORDS C} type - RGB_color = record - red : byte; - green : byte; - blue : byte; - alpha : byte; - end; - Color_space = Cardinal; - + // This one must be find a better place. + PCardinal = ^Cardinal; + +(*---------------------------------------------------------------------------*) + +type + pattern = record + data : array [0..7] of Byte; + end; + +var + B_SOLID_HIGH : pattern; cvar; external; + B_MIXED_COLORS : pattern; cvar; external; + B_SOLID_LOW : pattern; cvar; external; + +(*---------------------------------------------------------------------------*) + +type + rgb_color = record + red, + green, + blue, + alpha : Byte; + end; + +(*---------------------------------------------------------------------------*) + +var + B_TRANSPARENT_COLOR : rgb_color; cvar; external; + B_TRANSPARENT_MAGIC_CMAP8 : Byte; cvar; external; + B_TRANSPARENT_MAGIC_RGBA15 : Word; cvar; external; + B_TRANSPARENT_MAGIC_RGBA15_BIG : Word; cvar; external; + B_TRANSPARENT_MAGIC_RGBA32 : Cardinal; cvar; external; + B_TRANSPARENT_MAGIC_RGBA32_BIG : Cardinal; cvar; external; + + B_TRANSPARENT_8_BIT : Byte; cvar; external; + B_TRANSPARENT_32_BIT : rgb_color; cvar; external; + +(*---------------------------------------------------------------------------*) + +type + color_map = record + id : Integer; + color_list: array [0..255] of rgb_color; + inversion_map : array [0..255] of Byte; + index_map : array [0..32767] of Byte; + end; + + overlay_rect_limits = record + horizontal_alignment, + vertical_alignment, + width_alignment, + height_alignment, + min_width, + max_width, + min_height, + max_height : Word; + reserved : array [0..7] of Cardinal; + end; + + overlay_restrictions = record + source, + destination : overlay_rect_limits; + min_width_scale, + max_width_scale, + min_height_scale, + max_height_scale : Double; // float + reserved : array [0..7] of Cardinal; + end; + +(*---------------------------------------------------------------------------*) + + screen_id = record + id : Integer + end; + +var + B_MAIN_SCREEN_ID : screen_id; cvar; external; + +(*---------------------------------------------------------------------------*) + +type + color_space = Cardinal; + +const + B_NO_COLOR_SPACE = $0000; // byte in memory order, high bit first + + // linear color space (little endian is the default) + B_RGB32 = $0008; // B[7:0] G[7:0] R[7:0] -[7:0] + B_RGBA32 = $2008; // B[7:0] G[7:0] R[7:0] A[7:0] + B_RGB24 = $0003; // B[7:0] G[7:0] R[7:0] + B_RGB16 = $0005; // G[2:0],B[4:0] R[4:0],G[5:3] + B_RGB15 = $0010; // G[2:0],B[4:0] -[0],R[4:0],G[4:3] + B_RGBA15 = $2010; // G[2:0],B[4:0] A[0],R[4:0],G[4:3] + B_CMAP8 = $0004; // D[7:0] + B_GRAY8 = $0002; // Y[7:0] + B_GRAY1 = $0001; // Y0[0],Y1[0],Y2[0],Y3[0],Y4[0],Y5[0],Y6[0],Y7[0] + + // big endian version, when the encoding is not endianess independant + B_RGB32_BIG = $1008; // -[7:0] R[7:0] G[7:0] B[7:0] + B_RGBA32_BIG = $3008; // A[7:0] R[7:0] G[7:0] B[7:0] + B_RGB24_BIG = $1003; // R[7:0] G[7:0] B[7:0] + B_RGB16_BIG = $1005; // R[4:0],G[5:3] G[2:0],B[4:0] + B_RGB15_BIG = $1010; // -[0],R[4:0],G[4:3] G[2:0],B[4:0] + B_RGBA15_BIG = $3010; // A[0],R[4:0],G[4:3] G[2:0],B[4:0] + + // little-endian declarations, for completness + B_RGB32_LITTLE = B_RGB32; + B_RGBA32_LITTLE = B_RGBA32; + B_RGB24_LITTLE = B_RGB24; + B_RGB16_LITTLE = B_RGB16; + B_RGB15_LITTLE = B_RGB15; + B_RGBA15_LITTLE = B_RGBA15; + + // non linear color space -- note that these are here for exchange purposes; + // a BBitmap or BView may not necessarily support all these color spaces. + + // Loss/Saturation points are Y 16-235 (absoulte); Cb/Cr 16-240 (center 128) + + B_YCbCr422 = $4000; // Y0[7:0] Cb0[7:0] Y1[7:0] Cr0[7:0] Y2[7:0]... + // Cb2[7:0] Y3[7:0] Cr2[7:0] + B_YCbCr411 = $4001; // Cb0[7:0] Y0[7:0] Cr0[7:0] Y1[7:0] Cb4[7:0]... + // Y2[7:0] Cr4[7:0] Y3[7:0] Y4[7:0] Y5[7:0]... + // Y6[7:0] Y7[7:0] + B_YCbCr444 = $4003; // Y0[7:0] Cb0[7:0] Cr0[7:0] + B_YCbCr420 = $4004; // Non-interlaced only, Cb0 Y0 Y1 Cb2 Y2 Y3 on even scan lines ... + // Cr0 Y0 Y1 Cr2 Y2 Y3 on odd scan lines + + // Extrema points are Y 0 - 207 (absolute) U -91 - 91 (offset 128) V -127 - 127 (offset 128) + // note that YUV byte order is different from YCbCr + // USE YCbCr, not YUV, when that's what you mean! + B_YUV422 = $4020; // U0[7:0] Y0[7:0] V0[7:0] Y1[7:0] ... + // U2[7:0] Y2[7:0] V2[7:0] Y3[7:0] + B_YUV411 = $4021; // U0[7:0] Y0[7:0] Y1[7:0] V0[7:0] Y2[7:0] Y3[7:0] + // U4[7:0] Y4[7:0] Y5[7:0] V4[7:0] Y6[7:0] Y7[7:0] + B_YUV444 = $4023; // U0[7:0] Y0[7:0] V0[7:0] U1[7:0] Y1[7:0] V1[7:0] + B_YUV420 = $4024; // Non-interlaced only, U0 Y0 Y1 U2 Y2 Y3 on even scan lines ... + // V0 Y0 Y1 V2 Y2 Y3 on odd scan lines + B_YUV9 = $402C; // planar? 410? + B_YUV12 = $402D; // planar? 420? + + B_UVL24 = $4030; // U0[7:0] V0[7:0] L0[7:0] ... + B_UVL32 = $4031; // U0[7:0] V0[7:0] L0[7:0] X0[7:0]... + B_UVLA32 = $6031; // U0[7:0] V0[7:0] L0[7:0] A0[7:0]... + + B_LAB24 = $4032; // L0[7:0] a0[7:0] b0[7:0] ... (a is not alpha!) + B_LAB32 = $4033; // L0[7:0] a0[7:0] b0[7:0] X0[7:0] ... (b is not alpha!) + B_LABA32 = $6033; // L0[7:0] a0[7:0] b0[7:0] A0[7:0] ... (A is alpha) + + // red is at hue = 0 + B_HSI24 = $4040; // H[7:0] S[7:0] I[7:0] + B_HSI32 = $4041; // H[7:0] S[7:0] I[7:0] X[7:0] + B_HSIA32 = $6041; // H[7:0] S[7:0] I[7:0] A[7:0] + + B_HSV24 = $4042; // H[7:0] S[7:0] V[7:0] + B_HSV32 = $4043; // H[7:0] S[7:0] V[7:0] X[7:0] + B_HSVA32 = $6043; // H[7:0] S[7:0] V[7:0] A[7:0] + + B_HLS24 = $4044; // H[7:0] L[7:0] S[7:0] + B_HLS32 = $4045; // H[7:0] L[7:0] S[7:0] X[7:0] + B_HLSA32 = $6045; // H[7:0] L[7:0] S[7:0] A[7:0] + + B_CMY24 = $C001; // C[7:0] M[7:0] Y[7:0] No gray removal done + B_CMY32 = $C002; // C[7:0] M[7:0] Y[7:0] X[7:0] No gray removal done + B_CMYA32 = $E002; // C[7:0] M[7:0] Y[7:0] A[7:0] No gray removal done + B_CMYK32 = $C003; // C[7:0] M[7:0] Y[7:0] K[7:0] + + // compatibility declarations + B_MONOCHROME_1_BIT = B_GRAY1; + B_GRAYSCALE_8_BIT = B_GRAY8; + B_COLOR_8_BIT = B_CMAP8; + B_RGB_32_BIT = B_RGB32; + B_RGB_16_BIT = B_RGB15; + B_BIG_RGB_32_BIT = B_RGB32_BIG; + B_BIG_RGB_16_BIT = B_RGB15_BIG; + +const + B_VIEWS_SUPPORT_DRAW_BITMAP = $1; + B_BITMAPS_SUPPORT_ATTACHED_VIEWS = $2; + +function bitmaps_support_space(space : color_space; support_flags : PCardinal) + : boolean; cdecl; external 'be' name 'bitmaps_support_space'; + +function get_pixel_size_for(space : color_space; pixel_chunk : status_t; + row_alignment : status_t; pixels_per_chunk : status_t) + : status_t; cdecl; external 'be' name 'get_pixel_size_for'; + +type + buffer_orientation = (B_BUFFER_TOP_TO_BOTTOM, B_BUFFER_BOTTOM_TO_TOP); + + buffer_layout = (B_BUFFER_NONINTERLEAVED); + +(*---------------------------------------------------------------------------*) + + drawing_mode = (B_OP_COPY, B_OP_OVER, B_OP_ERASE, B_OP_INVERT, B_OP_ADD, + B_OP_SUBTRACT, B_OP_BLEND, B_OP_MIN, B_OP_MAX, B_OP_SELECT, + B_OP_ALPHA); + + source_alpha = (B_PIXEL_ALPHA, B_CONSTANT_ALPHA); + alpha_function = (B_ALPHA_OVERLAY, B_ALPHA_COMPOSITE); + +const + B_8_BIT_640x480 = $00000001; + B_8_BIT_800x600 = $00000002; + B_8_BIT_1024x768 = $00000004; + B_8_BIT_1280x1024 = $00000008; + B_8_BIT_1600x1200 = $00000010; + B_16_BIT_640x480 = $00000020; + B_16_BIT_800x600 = $00000040; + B_16_BIT_1024x768 = $00000080; + B_16_BIT_1280x1024 = $00000100; + B_16_BIT_1600x1200 = $00000200; + B_32_BIT_640x480 = $00000400; + B_32_BIT_800x600 = $00000800; + B_32_BIT_1024x768 = $00001000; + B_32_BIT_1280x1024 = $00002000; + B_32_BIT_1600x1200 = $00004000; + B_8_BIT_1152x900 = $00008000; + B_16_BIT_1152x900 = $00010000; + B_32_BIT_1152x900 = $00020000; + B_15_BIT_640x480 = $00040000; + B_15_BIT_800x600 = $00080000; + B_15_BIT_1024x768 = $00100000; + B_15_BIT_1280x1024 = $00200000; + B_15_BIT_1600x1200 = $00400000; + B_15_BIT_1152x900 = $00800000; + + // do not use B_FAKE_DEVICE--it will go away! + B_FAKE_DEVICE = $40000000; + B_8_BIT_640x400 = $80000000; + +(*---------------------------------------------------------------------------*) + implementation -initialization - -end. +end. \ No newline at end of file