Completed (?) translation.
This commit is contained in:
@@ -1,20 +1,314 @@
|
||||
unit graphicdefs;
|
||||
unit GraphicDefs;
|
||||
{
|
||||
(Manual) Translation of Be's GraphicDefs.h
|
||||
|
||||
Ok, if TBitmap doesn't work, the error its most likely to be in this unit.
|
||||
|
||||
What this unit needs? that someone take a look at the points marked with:
|
||||
|
||||
// Check/Confirm This one, please.
|
||||
|
||||
I'm not too sure about how to translate the enums, and also not sure about
|
||||
the values of the index on a set. Excuse (and fix!) my ignorace :)
|
||||
|
||||
Maybe I also screwed up a little the integer types too, be warned :^P
|
||||
|
||||
-- BiPolar.
|
||||
}
|
||||
interface
|
||||
|
||||
uses
|
||||
SupportDefs;
|
||||
|
||||
{$PACKRECORDS C}
|
||||
|
||||
|
||||
type
|
||||
TRGB_color = record
|
||||
red : byte;
|
||||
green : byte;
|
||||
blue : byte;
|
||||
alpha : byte;
|
||||
end;
|
||||
TColor_space = Cardinal;
|
||||
|
||||
// This one must be find a better place.
|
||||
PCardinal = ^Cardinal;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
type
|
||||
{ TPattern = pattern }
|
||||
TPattern = record
|
||||
Data : array [0..7] of Byte; // uint8
|
||||
end;
|
||||
|
||||
// How we do 'export' these global const?
|
||||
// Check/Confirm This one, please.
|
||||
|
||||
var {const}
|
||||
B_SOLID_HIGH : TPattern; cvar; external;
|
||||
B_MIXED_COLORS : TPattern; cvar; external;
|
||||
B_SOLID_LOW : TPattern; cvar; external;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
type
|
||||
{ I do prefer TRGBColor but... oh well... }
|
||||
TRGB_Color = record
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
Alpha : Byte;
|
||||
end;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
var
|
||||
{const}
|
||||
//extern const rgb_color B_TRANSPARENT_COLOR;
|
||||
B_TRANSPARENT_COLOR : TRGB_Color; cvar; external;
|
||||
//extern const uint8 B_TRANSPARENT_MAGIC_CMAP8;
|
||||
B_TRANSPARENT_MAGIC_CMAP8 : Byte; cvar; external;
|
||||
//extern const uint16 B_TRANSPARENT_MAGIC_RGBA15;
|
||||
B_TRANSPARENT_MAGIC_RGBA15 : Word; cvar; external;
|
||||
//extern const uint16 B_TRANSPARENT_MAGIC_RGBA15_BIG;
|
||||
B_TRANSPARENT_MAGIC_RGBA15_BIG : Word; cvar; external;
|
||||
//extern const uint32 B_TRANSPARENT_MAGIC_RGBA32;
|
||||
B_TRANSPARENT_MAGIC_RGBA32 : Cardinal; cvar; external;
|
||||
//extern const uint32 B_TRANSPARENT_MAGIC_RGBA32_BIG;
|
||||
B_TRANSPARENT_MAGIC_RGBA32_BIG : Cardinal; cvar; external;
|
||||
//extern const uint8 B_TRANSPARENT_8_BIT;
|
||||
B_TRANSPARENT_8_BIT : Byte; cvar; external;
|
||||
//extern const rgb_color B_TRANSPARENT_32_BIT;
|
||||
B_TRANSPARENT_32_BIT : TRGB_Color; cvar; external;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
type
|
||||
|
||||
TColorMap = record
|
||||
ID : Integer; // int32
|
||||
ColorList: array [0..255] of TRGB_Color;
|
||||
InversionMap : array [0..255] of Byte; // uint8
|
||||
IndexMap : array [0..32767] of Byte; // uint8
|
||||
end;
|
||||
|
||||
{ TOverlayRectLimits = overlay_rect_limits }
|
||||
TOverlayRectLimits = record
|
||||
HorizontalAlignment,
|
||||
VerticalAlignment,
|
||||
WidthAlignment,
|
||||
HeightAlignment,
|
||||
MinWidth,
|
||||
MaxWidth,
|
||||
MinHeight,
|
||||
MaxHeight : Word; // uint16
|
||||
Reserved : array [0..7] of Cardinal; // uint32
|
||||
end;
|
||||
|
||||
{ TOverlayRestrictions = overlay_restrictions }
|
||||
TOverlayRestrictions = record
|
||||
Source,
|
||||
Destination : TOverlayRectLimits;
|
||||
MinWidthScale,
|
||||
MaxWidthScale,
|
||||
MinHeightScale,
|
||||
MaxHeightScale : Double; // float
|
||||
Reserved : array [0..7] of Cardinal; // uint32
|
||||
end;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
|
||||
//struct screen_id { int32 id; };
|
||||
TScreenID = record
|
||||
ID : Integer
|
||||
end;
|
||||
|
||||
//extern const struct screen_id B_MAIN_SCREEN_ID;
|
||||
var
|
||||
{const}
|
||||
B_MAIN_SCREEN_ID : TScreenID; cvar; external;
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
type
|
||||
|
||||
TColor_Space = Cardinal; // or is just word?
|
||||
|
||||
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;
|
||||
|
||||
|
||||
// Find out whether a specific color space is supported by BBitmaps.
|
||||
// Support_flags will be set to what kinds of support are available.
|
||||
// If support_flags is set to 0, false will be returned.
|
||||
const
|
||||
|
||||
B_VIEWS_SUPPORT_DRAW_BITMAP = $1;
|
||||
B_BITMAPS_SUPPORT_ATTACHED_VIEWS = $2;
|
||||
|
||||
// Check/Confirm This one, please.
|
||||
function BitmapsSupportSpace(space : TColor_Space; support_flags : PCardinal)
|
||||
: boolean; cdecl; external 'be' name 'bitmaps_support_space';
|
||||
function GetPixelSizeFor(space : TColor_Space; pixel_chunk : TStatus_t;
|
||||
row_alignment : TStatus_t; pixels_per_chunk : TStatus_t)
|
||||
: TStatus_t; cdecl; external 'be' name 'get_pixel_size_for';
|
||||
|
||||
{
|
||||
_IMPEXP_BE bool bitmaps_support_space(color_space space, uint32 * support_flags);
|
||||
|
||||
// "pixel_chunk" is the native increment from one pixel starting on an integral
|
||||
// byte to the next.
|
||||
// "row_alignment" is the native alignment for pixel scanline starts.
|
||||
// "pixels_per_chunk" is the number of pixels in a pixel_chunk. For instance,
|
||||
// B_GRAY1 sets pixel_chunk to 1, row_alignment to 4 and pixels_per_chunk to 8,
|
||||
// whereas B_RGB24 sets pixel_chunk to 3, row_alignment to 4 and
|
||||
// pixels_per_chunk to 1.
|
||||
|
||||
_IMPEXP_BE status_t get_pixel_size_for(color_space space, size_t * pixel_chunk,
|
||||
size_t * row_alignment, size_t * pixels_per_chunk);
|
||||
}
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
type
|
||||
|
||||
BufferOrientation = (B_BUFFER_TOP_TO_BOTTOM, B_BUFFER_BOTTOM_TO_TOP);
|
||||
|
||||
// Check/Confirm This one, please.
|
||||
BufferLayout = (B_BUFFER_NONINTERLEAVED); // B_BUFFER_NONINTERLEAVED = 1
|
||||
|
||||
(*----------------------------------------------------------------*)
|
||||
|
||||
DrawingMode = (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);
|
||||
|
||||
|
||||
// Check/Confirm This one, please.
|
||||
|
||||
// this was:
|
||||
// enum source_alpha {
|
||||
// B_PIXEL_ALPHA=0,
|
||||
// B_CONSTANT_ALPHA
|
||||
// };
|
||||
//
|
||||
// enum alpha_function {
|
||||
// B_ALPHA_OVERLAY=0,
|
||||
// B_ALPHA_COMPOSITE
|
||||
// };
|
||||
|
||||
SourceAlpha = (B_PIXEL_ALPHA, B_CONSTANT_ALPHA);
|
||||
AlphaFunction = (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; // (int)
|
||||
|
||||
implementation
|
||||
|
||||
initialization
|
||||
|
||||
end.
|
||||
end.
|
||||
Reference in New Issue
Block a user