From 4fd2caca28c6e781ce1c1bb5390af18632cef6f5 Mon Sep 17 00:00:00 2001 From: oscarl-2 Date: Wed, 4 Jun 2003 09:05:48 +0000 Subject: [PATCH] Initial checkin. Needs to be tested. --- bepascal/bepascal/be/interface/Bitmap.cpp | 809 ++++++++++++++++++++++ bepascal/bepascal/be/interface/bitmap.pp | 550 +++++++++++++++ 2 files changed, 1359 insertions(+) create mode 100644 bepascal/bepascal/be/interface/Bitmap.cpp create mode 100644 bepascal/bepascal/be/interface/bitmap.pp diff --git a/bepascal/bepascal/be/interface/Bitmap.cpp b/bepascal/bepascal/be/interface/Bitmap.cpp new file mode 100644 index 0000000..087826d --- /dev/null +++ b/bepascal/bepascal/be/interface/Bitmap.cpp @@ -0,0 +1,809 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2003 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 +*/ + +#ifndef _BITMAP_CPP +#define _BITMAP_CPP + +#include "Bitmap.h" + +#include "view.h" +#include +#include + +/*----------------------------------------------------------------*/ +/*----- BBitmap class --------------------------------------------*/ +class BPBitmap : public BBitmap, public BPArchivable +{ +public: + BPBitmap(TPasObject PasObject, + BRect bounds, + uint32 flags, + color_space depth, + int32 bytesPerRow=B_ANY_BYTES_PER_ROW, + screen_id screenID=B_MAIN_SCREEN_ID); + BPBitmap(TPasObject PasObject, + BRect bounds, + color_space depth, + bool accepts_views = false, + bool need_contiguous = false); + BPBitmap(TPasObject PasObject, + const BBitmap* source, + bool accepts_views = false, + bool need_contiguous = false); + BPBitmap(TPasObject PasObject, BMessage *data); + +//virtual ~BBitmap(); + +/* Archiving */ +static BArchivable *Instantiate(BMessage *data); +//virtual status_t Archive(BMessage *data, bool deep = true) const; + + status_t InitCheck() const; + bool IsValid() const; + + status_t LockBits(uint32 *state=NULL); + void UnlockBits(); + + area_id Area() const; + void * Bits() const; + int32 BitsLength() const; + int32 BytesPerRow() const; + color_space ColorSpace() const; + BRect Bounds() const; + + void SetBits(const void *data, + int32 length, + int32 offset, + color_space cs); + + status_t GetOverlayRestrictions(overlay_restrictions *restrict) const; + +/* to mimic a BWindow */ +virtual void AddChild(BView *view); +virtual bool RemoveChild(BView *view); + int32 CountChildren() const; + BView *ChildAt(int32 index) const; + BView *FindView(const char *view_name) const; + BView *FindView(BPoint point) const; + bool Lock(); + void Unlock(); + bool IsLocked() const; + +virtual status_t Perform(perform_code d, void *arg); + +/*----- Private or reserved -----------------------------------------*/ +private: +/* +friend class BView; +friend class BApplication; +friend void _IMPEXP_BE _get_screen_bitmap_(BBitmap *,BRect,bool); + +virtual void _ReservedBitmap1(); +virtual void _ReservedBitmap2(); +virtual void _ReservedBitmap3(); + + BBitmap(const BBitmap &); + BBitmap &operator=(const BBitmap &); + + char *get_shared_pointer() const; + void set_bits(long offset, char *data, long length); + void set_bits_24(long offset, char *data, long length); + void set_bits_24_local_gray(long offset, char *data, long len); + void set_bits_24_local_256(long offset, uchar *data, long len); + void set_bits_24_24(long offset, char *data, long length, + bool big_endian_dst); + void set_bits_8_24(long offset, char *data, long length, + bool big_endian_dst); + void set_bits_gray_24(long offset, char *data, long length, + bool big_endian_dst); + int32 get_server_token() const; + void InitObject( BRect frame, color_space depth, + uint32 flags, int32 bytesPerRow, screen_id screenID); + void AssertPtr(); + + void *fBasePtr; + int32 fSize; + color_space fType; + BRect fBound; + int32 fRowBytes; + BWindow *fWindow; + int32 fServerToken; + int32 fToken; + uint8 unused; + area_id fArea; + area_id fOrigArea; + uint32 fFlags; + status_t fInitError; +*/ +}; +/*-------------------------------------------------------------*/ +/*-------------------------------------------------------------*/ + +BPBitmap::BPBitmap(TPasObject PasObject, + BRect bounds, + uint32 flags, + color_space depth, + int32 bytesPerRow = B_ANY_BYTES_PER_ROW, + screen_id screenID = B_MAIN_SCREEN_ID) + : BBitmap(bounds, flags, depth, bytesPerRow, screenID), + BPArchivable(PasObject)//, +// BPasObject(PasObject) +{ + +} + +BPBitmap::BPBitmap(TPasObject PasObject, + BRect bounds, + color_space depth, + bool accepts_views = false, + bool need_contiguous = false) + : BBitmap(bounds, depth, accepts_views, need_contiguous), + BPArchivable(PasObject)//, +// BPasObject(PasObject) +{ + +} + +BPBitmap::BPBitmap(TPasObject PasObject, + const BBitmap* source, + bool accepts_views = false, + bool need_contiguous = false) + : BBitmap(source, accepts_views, need_contiguous), + BPArchivable(PasObject)//, +// BPasObject(PasObject) +{ + +} + +BPBitmap::BPBitmap(TPasObject PasObject, BMessage *data) + : BBitmap(data), + BPArchivable(PasObject)//, +// BPasObject(PasObject) +{ + +} + +status_t +BPBitmap::InitCheck(void) const +{ + return BBitmap::InitCheck(); +} + +bool +BPBitmap::IsValid(void) const +{ + return BBitmap::IsValid(); +} + +status_t +BPBitmap::LockBits(uint32 *state=NULL) +{ + return BBitmap::LockBits(state); +} + +void +BPBitmap::UnlockBits(void) +{ + BBitmap::UnlockBits(); +} + +area_id +BPBitmap::Area(void) const +{ + return BBitmap::Area(); +} + +void * +BPBitmap::Bits(void) const +{ + return BBitmap::Bits(); +} + +int32 +BPBitmap::BitsLength(void) const +{ + return BBitmap::BitsLength(); +} + +int32 +BPBitmap::BytesPerRow(void) const +{ + return BBitmap::BytesPerRow(); +} + +color_space +BPBitmap::ColorSpace(void) const +{ + return BBitmap::ColorSpace(); +} + +BRect +BPBitmap::Bounds(void) const +{ + return BBitmap::Bounds(); +} + +void +BPBitmap::SetBits(const void *data, int32 length, int32 offset, color_space cs) +{ + BBitmap::SetBits(data, length, offset, cs); +} + +status_t +BPBitmap::GetOverlayRestrictions(overlay_restrictions *restrict) const +{ + return BBitmap::GetOverlayRestrictions(restrict); +} + +void +BPBitmap::AddChild(BView *view) +{ + BBitmap::AddChild(view); +} + +bool +BPBitmap::RemoveChild(BView *view) +{ + BBitmap::RemoveChild(view); +} + +int32 +BPBitmap::CountChildren(void) const +{ + return BBitmap::CountChildren(); +} + +bool +BPBitmap::Lock(void) +{ + return BBitmap::Lock(); +} + +void +BPBitmap::Unlock(void) +{ + BBitmap::Unlock(); +} + +bool +BPBitmap::IsLocked(void) const +{ + return BBitmap::IsLocked(); +} + +status_t +BPBitmap::Perform(perform_code d, void *arg) +{ + return BBitmap::Perform(d, arg); +} + +/*-------------------------------------------------------------*/ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + * Method: BBitmap::BBitmap + * Descr: + */ +TCPlusObject BBitmap_Create(TPasObject PasObject, BRect bounds, uint32 flags, color_space depth, int32 bytesPerRow, screen_id screenID) +{ + return new BPBitmap(PasObject, bounds, flags, depth, bytesPerRow, screenID); +} + +/* + * Method: BBitmap::BBitmap + * Descr: + */ +TCPlusObject BBitmap_Create_1 +(TPasObject PasObject, BRect bounds, color_space depth, bool accepts_views, bool need_contiguous) +{ + return new BPBitmap(PasObject, bounds, depth, accepts_views, need_contiguous); +} + + +/* + * Method: BBitmap::BBitmap + * Descr: + */ +TCPlusObject BBitmap_Create_2 +(TPasObject PasObject, const BBitmap *source, bool accepts_views, bool need_contiguous) +{ + return new BPBitmap(PasObject, source, accepts_views, need_contiguous); +} + + +/* BBitmap(BMessage *data); + * Method: BBitmap::BBitmap + * Descr: + */ +TCPlusObject BBitmap_Create_3(TPasObject PasObject, BMessage *data) +{ + return new BPBitmap(PasObject, data); +} + + +/* + * Method: BBitmap::~BBitmap + * Descr: + */ +void BBitmap_Free(BBitmap *Bitmap) +{ + delete Bitmap; +} + + +/* + * Method: BBitmap::Instantiate + * Descr: + */ +BArchivable * +BBitmap_Instantiate(BBitmap *Bitmap, BMessage *data) +{ + return Bitmap->Instantiate(data); +} + + +/* + * Method: BBitmap::Archive + * Descr: + */ +status_t +BBitmap_Archive(BBitmap *Bitmap, BMessage *data, bool deep) +{ + return Bitmap->Archive(data, deep); +} + + +/* + * Method: BBitmap::InitCheck + * Descr: + */ +status_t +BBitmap_InitCheck(BBitmap *Bitmap) +{ + return Bitmap->InitCheck(); +} + + +/* + * Method: BBitmap::IsValid + * Descr: + */ +bool +BBitmap_IsValid(BBitmap *Bitmap) +{ + return Bitmap->IsValid(); +} + + +/* + * Method: BBitmap::LockBits + * Descr: + */ +status_t +BBitmap_LockBits(BBitmap *Bitmap, uint32 *state) +{ + return Bitmap->LockBits(state); +} + + +/* + * Method: BBitmap::UnlockBits + * Descr: + */ +void +BBitmap_UnlockBits(BBitmap *Bitmap) +{ + Bitmap->UnlockBits(); +} + + +/* + * Method: BBitmap::Area + * Descr: + */ +area_id +BBitmap_Area(BBitmap *Bitmap) +{ + return Bitmap->Area(); +} + + +/* + * Method: BBitmap::Bits + * Descr: + */ +void * +BBitmap_Bits(BBitmap *Bitmap) +{ + Bitmap->Bits(); +} + + +/* + * Method: BBitmap::BitsLength + * Descr: + */ +int32 +BBitmap_BitsLength_1 +(BBitmap *Bitmap) +{ + return Bitmap->BitsLength(); +} + + +/* + * Method: BBitmap::BytesPerRow + * Descr: + */ +int32 +BBitmap_BytesPerRow(BBitmap *Bitmap) +{ + return Bitmap->BytesPerRow(); +} + + +/* + * Method: BBitmap::ColorSpace + * Descr: + */ +color_space +BBitmap_ColorSpace(BBitmap *Bitmap) +{ + return Bitmap->ColorSpace(); +} + + +/* + * Method: BBitmap::Bounds + * Descr: + */ +BRect +BBitmap_Bounds(BBitmap *Bitmap) +{ + return Bitmap->Bounds(); +} + + +/* + * Method: BBitmap::SetBits + * Descr: + */ +void +BBitmap_SetBits(BBitmap *Bitmap, const void *data, int32 length, int32 offset, color_space cs) +{ + Bitmap->SetBits(data, length, offset, cs); +} + + +/* + * Method: BBitmap::GetOverlayRestrictions + * Descr: + */ +status_t +BBitmap_GetOverlayRestrictions(BBitmap *Bitmap, overlay_restrictions *restrict) +{ + return Bitmap->GetOverlayRestrictions(restrict); +} + + +/* + * Method: BBitmap::AddChild + * Descr: + */ +void +BBitmap_AddChild(BBitmap *Bitmap, BView *view) +{ + Bitmap->AddChild(view); +} + + +/* + * Method: BBitmap::RemoveChild + * Descr: + */ +bool +BBitmap_RemoveChild(BBitmap *Bitmap, BView *view) +{ + return Bitmap->RemoveChild(view); +} + + +/* + * Method: BBitmap::CountChildren + * Descr: + */ +int32 +BBitmap_CountChildren(BBitmap *Bitmap) +{ + return Bitmap->CountChildren(); +} + + +/* + * Method: BBitmap::ChildAt + * Descr: + */ +BView * +BBitmap_ChildAt(BBitmap *Bitmap, int32 index) +{ + return Bitmap->ChildAt(index); +} + + +/* + * Method: BBitmap::FindView + * Descr: + */ +BView * +BBitmap_FindView(BBitmap *Bitmap, const char *view_name) +{ + return Bitmap->FindView(view_name); +} + + +/* + * Method: BBitmap::FindView + * Descr: + */ +BView * +BBitmap_FindView_1 +(BBitmap *Bitmap, BPoint point) +{ + return Bitmap->FindView(point); +} + + +/* + * Method: BBitmap::Lock + * Descr: + */ +bool +BBitmap_Lock(BBitmap *Bitmap) +{ + return Bitmap->Lock(); +} + + +/* + * Method: BBitmap::Unlock + * Descr: + */ + +void +BBitmap_Unlock(BBitmap *Bitmap) +{ + Bitmap->Unlock(); +} + + +/* + * Method: BBitmap::IsLocked + * Descr: + */ + +bool +BBitmap_IsLocked(BBitmap *Bitmap) +{ + return Bitmap->IsLocked(); +} + + +/* + * Method: BBitmap::Perform + * Descr: + */ + +status_t +BBitmap_Perform(BBitmap *Bitmap, perform_code d, void *arg) +{ + return Bitmap->Perform(d, arg); +} + + +/* + * Method: BBitmap::_ReservedBitmap1 + * Descr: + */ +/* +void +BBitmap__ReservedBitmap1(BBitmap *Bitmap) +{ + Bitmap->_ReservedBitmap1(); +} +*/ + +/* + * Method: BBitmap::_ReservedBitmap2 + * Descr: + */ +/* +void +BBitmap__ReservedBitmap2(BBitmap *Bitmap) +{ + Bitmap->_ReservedBitmap2(); +} +*/ + +/* + * Method: BBitmap::_ReservedBitmap3 + * Descr: + */ +/* +void +BBitmap__ReservedBitmap3(BBitmap *Bitmap) +{ + Bitmap->_ReservedBitmap3(); +} +*/ + +/* + * Method: BBitmap::operator= + * Descr: + */ +/* +BBitmap & +BBitmap_operator=(BBitmap *Bitmap, const BBitmap &) +{ + return Bitmap->operator=(); +} +*/ + +/* + * Method: BBitmap::get_shared_pointer + * Descr: + */ +/* +char * +BBitmap_get_shared_pointer(BBitmap *Bitmap) const +{ + return Bitmap->get_shared_pointer(); +} +*/ + +/* + * Method: BBitmap::set_bits + * Descr: + */ +/* +void +BBitmap_set_bits(BBitmap *Bitmap, long offset, char *data, long length) +{ + Bitmap->set_bits(offset, data, length); +} +*/ + +/* + * Method: BBitmap::set_bits_24 + * Descr: + */ +/* +void +BBitmap_set_bits_24_1 +(BBitmap *Bitmap, long offset, char *data, long length) +{ + Bitmap->set_bits_24(offset, data, length); +} +*/ + +/* + * Method: BBitmap::set_bits_24_local_gray + * Descr: + */ +/* +void +BBitmap_set_bits_24_local_gray_2 +(BBitmap *Bitmap, long offset, char *data, long len) +{ + Bitmap->set_bits_24_local_gray(offset, data, len); +} +*/ + +/* + * Method: BBitmap::set_bits_24_local_256 + * Descr: + */ +/* +void +BBitmap_set_bits_24_local_256(BBitmap *Bitmap, long offset, uchar *data, long len) +{ + Bitmap->set_bits_24_local_256(offset, data, len); +} +*/ + +/* + * Method: BBitmap::set_bits_24_24 + * Descr: + */ +/* +void +BBitmap_set_bits_24_24(BBitmap *Bitmap, long offset, char *data, long length, bool big_endian_dst) +{ + Bitmap->set_bits_24_24(offset, data, length, big_endian_dst); +} +*/ + +/* + * Method: BBitmap::set_bits_8_24 + * Descr: + */ +/* +void +BBitmap_set_bits_8_24(BBitmap *Bitmap, long offset, char *data, long length, bool big_endian_dst) +{ + Bitmap->set_bits_8_24(offset, data, length, big_endian_dst); +} +*/ + +/* + * Method: BBitmap::set_bits_gray_24 + * Descr: + */ +/* +void +BBitmap_set_bits_gray_24(BBitmap *Bitmap, long offset, char *data, long length, bool big_endian_dst) +{ + Bitmap->set_bits_gray_24(offset, data, length, big_endian_dst); +} +*/ + +/* + * Method: BBitmap::get_server_token + * Descr: + */ +/* +int32 +BBitmap_get_server_token(BBitmap *Bitmap) const +{ + return Bitmap->get_server_token(); +} +*/ + +/* + * Method: BBitmap::InitObject + * Descr: + */ +/* +void +BBitmap_InitObject(BBitmap *Bitmap, BRect frame, color_space depth, uint32 flags, int32 bytesPerRow, screen_id screenID) +{ + Bitmap->InitObject(frame, depth, flags, bytesPerRow, screenID); +} +*/ + +/* + * Method: BBitmap::AssertPtr + * Descr: + */ +/* +void +BBitmap_AssertPtr(BBitmap *Bitmap) +{ + Bitmap->AssertPtr(); +} +*/ + +#if defined(__cplusplus) +} +#endif + +#endif /* _BITMAP_H */ diff --git a/bepascal/bepascal/be/interface/bitmap.pp b/bepascal/bepascal/be/interface/bitmap.pp new file mode 100644 index 0000000..d004b05 --- /dev/null +++ b/bepascal/bepascal/be/interface/bitmap.pp @@ -0,0 +1,550 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2003 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 Bitmap; + +interface + +uses + BeObj, Archivable, GraphicDefs, Message, OS, Rect, SupportDefs, View; + +type +// PCardinal = ^Cardinal; + + TBitmap = class(TArchivable) + 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 : TRect; flags : Cardinal; depth : TColor_Space; + bytes_per_row : Integer; screenID : TScreenID); + constructor Create(frame : TRect; depth : TColor_Space; + accepts_views : boolean; need_contiguous : boolean); + constructor Create(source : TBitmap; accepts_views : boolean; + need_contiguous : boolean); + constructor Create(data : TMessage); + + destructor Destroy; override; + + function Instantiate(data : TMessage) : TArchivable; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + function InitCheck : TStatus_t; + function IsValid : boolean; + function LockBits(state : PCardinal) : TStatus_t; + procedure UnlockBits; + function Area : TArea_ID; + function Bits : Pointer; + function BitsLength : Integer; + function BytesPerRow : Integer; + function ColorSpace : TColor_Space; + function Bounds : TRect; + procedure SetBits(data : Pointer; length : integer; offset : integer; + cs : TColor_Space); + function GetOverlayRestrictions(restrict : TOverlayRestrictions) + : TStatus_t; + procedure AddChild(view : TView); + function RemoveChild(view : TView) : boolean; + function CountChildren : integer; + function ChildAt(index : integer) : TView; + function FindView(view_name : PChar) : TView; + function FindView(point : TPoint) : TView; + function Lock : boolean; + procedure Unlock; + function IsLocked : boolean; + + function Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +{ + procedure _ReservedBitmap1; + procedure _ReservedBitmap2; + procedure _ReservedBitmap3; + constructor Create( : TBitmap); + function operator=( : TBitmap) : TBitmap; + function get_shared_pointer : PChar; + procedure set_bits(offset : integer; data : PChar; length : integer); + 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); + function get_server_token : integer; + procedure InitObject(frame : TRect; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); + procedure AssertPtr; + procedure void *fBasePtr; + procedure int32 fSize; + procedure color_space fType; + procedure BRect fBound; + procedure int32 fRowBytes; + procedure BWindow *fWindow; + procedure int32 fServerToken; + procedure int32 fToken; + procedure uint8 unused; + procedure area_id fArea; + procedure area_id fOrigArea; + procedure uint32 fFlags; + procedure status_t fInitError; +} + end; + +function BBitmap_Create(AObject : TBeObject; bounds : TCPlusObject; + flags : Cardinal; depth : TColor_Space; bytesPerRow : Integer; + screenID : TScreenID) : TCPlusObject; cdecl; + external BePascalLibName name 'BBitmap_Create'; + +function BBitmap_Create_1(AObject : TBeObject; bounds : TCPlusObject; + depth : TColor_Space; accepts_views : boolean; need_contiguous : boolean) + : TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_1'; + +function BBitmap_Create_2(AObject : TBeObject; source : TBitmap; + accepts_views : boolean; need_contiguous : boolean) : TCPlusObject; cdecl; + external BePascalLibName name 'BBitmap_Create_2'; + +function BBitmap_Create_3(AObject : TBeObject; data : TCPlusObject) + : TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_3'; + + +procedure BBitmap_Free(AObject : TCPlusObject); cdecl; + external BePascalLibName name 'BBitmap_Free'; + + +function BBitmap_Instantiate(AObject : TCPlusObject; data : {TMessage}TCPlusObject) + : TArchivable; cdecl; external BePascalLibName name 'BBitmap_Instantiate'; + +function BBitmap_Archive(AObject : TCPlusObject; data : {TMessage}TCPlusObject; + deep : boolean) : TStatus_t; cdecl; + external BePascalLibName name 'BBitmap_Archive'; + +function BBitmap_InitCheck(AObject : TCPlusObject) : TStatus_t; cdecl; + external BePascalLibName name 'BBitmap_InitCheck'; + +function BBitmap_IsValid(AObject : TCPlusObject) : boolean; cdecl; + external BePascalLibName name 'BBitmap_IsValid'; + +function BBitmap_LockBits(AObject : TCPlusObject; state : PCardinal) + : TStatus_t; cdecl; external BePascalLibName name 'BBitmap_LockBits'; + +procedure BBitmap_UnlockBits(AObject : TCPlusObject); cdecl; + external BePascalLibName name 'BBitmap_UnlockBits'; + +function BBitmap_Area(AObject : TCPlusObject) : TArea_ID; cdecl; + external BePascalLibName name 'BBitmap_Area'; + +function BBitmap_Bits(AObject : TCPlusObject) : Pointer; cdecl; + external BePascalLibName name 'BBitmap_Bits'; + +function BBitmap_BitsLength(AObject : TCPlusObject) : integer; cdecl; + external BePascalLibName name 'BBitmap_BitsLength'; + +function BBitmap_BytesPerRow(AObject : TCPlusObject) : integer; cdecl; + external BePascalLibName name 'BBitmap_BytesPerRow'; + +function BBitmap_ColorSpace(AObject : TCPlusObject) : TColor_Space; cdecl; + external BePascalLibName name 'BBitmap_ColorSpace'; + +function BBitmap_Bounds(AObject : TCPlusObject) : TRect; cdecl; + external BePascalLibName name 'BBitmap_Bounds'; + +procedure BBitmap_SetBits(AObject : TCPlusObject; data : Pointer; + length : integer; offset : integer; cs : TColor_Space); cdecl; + external BePascalLibName name 'BBitmap_SetBits'; + +function BBitmap_GetOverlayRestrictions(AObject : TCPlusObject; + restrict : TOverlayRestrictions) : TStatus_t; cdecl; + external BePascalLibName name 'BBitmap_GetOverlayRestrictions'; + +procedure BBitmap_AddChild(AObject : TCPlusObject; view : {TView}TCPlusObject); cdecl; + external BePascalLibName name 'BBitmap_AddChild'; + +function BBitmap_RemoveChild(AObject : TCPlusObject; view : {TView}TCPlusObject) + : boolean; cdecl; external BePascalLibName name 'BBitmap_RemoveChild'; + +function BBitmap_CountChildren(AObject : TCPlusObject) : integer; cdecl; + external BePascalLibName name 'BBitmap_CountChildren'; + +function BBitmap_ChildAt(AObject : TCPlusObject; index : integer) : TView; + cdecl; external BePascalLibName name 'BBitmap_ChildAt'; + +function BBitmap_FindView(AObject : TCPlusObject; view_name : PChar) : TView; + cdecl; external BePascalLibName name 'BBitmap_FindView'; + +function BBitmap_FindView(AObject : TCPlusObject; point : TPoint{TCPlusObject}) + : TView; cdecl; external BePascalLibName name 'BBitmap_FindView'; + +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; + external BePascalLibName name 'BBitmap_IsLocked'; + +function BBitmap_Perform(AObject : TCPlusObject; d : TPerform_code; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BBitmap_Perform'; + +{ +procedure BBitmap__ReservedBitmap1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap1'; +procedure BBitmap__ReservedBitmap2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap2'; +procedure BBitmap__ReservedBitmap3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap__ReservedBitmap3'; +function BBitmap_Create(AObject : TBeObject; : TBitmap); cdecl; external BePascalLibName name 'BBitmap_Create'; +function BBitmap_operator=(AObject : TCPlusObject; : TBitmap) : TBitmap; cdecl; external BePascalLibName name 'BBitmap_operator='; +function BBitmap_get_shared_pointer(AObject : TCPlusObject) : PChar; cdecl; external BePascalLibName name 'BBitmap_get_shared_pointer'; +procedure BBitmap_set_bits(AObject : TCPlusObject; offset : integer; data : PChar; length : integer); cdecl; external BePascalLibName name 'BBitmap_set_bits'; +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'; +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'; +procedure BBitmap_void *fBasePtr(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_void *fBasePtr'; +procedure BBitmap_int32 fSize(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fSize'; +procedure BBitmap_color_space fType(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_color_space fType'; +procedure BBitmap_BRect fBound(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_BRect fBound'; +procedure BBitmap_int32 fRowBytes(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fRowBytes'; +procedure BBitmap_BWindow *fWindow(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_BWindow *fWindow'; +procedure BBitmap_int32 fServerToken(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fServerToken'; +procedure BBitmap_int32 fToken(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_int32 fToken'; +procedure BBitmap_uint8 unused(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_uint8 unused'; +procedure BBitmap_area_id fArea(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_area_id fArea'; +procedure BBitmap_area_id fOrigArea(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_area_id fOrigArea'; +procedure BBitmap_uint32 fFlags(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_uint32 fFlags'; +procedure BBitmap_status_t fInitError(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BBitmap_status_t fInitError'; +} + +implementation + +{ -- NOTE! + I will change "bounds" to "frame" in these constructors... + they clash with the Bounds function. + + Also "bytesPerWow" --> "bytes_per_row" +} + +// BBitmap(BRect bounds, uint32 flags, color_space depth, +// int32 bytesPerRow=B_ANY_BYTES_PER_ROW, screen_id screenID=B_MAIN_SCREEN_ID); +constructor TBitmap.Create(frame{bounds} : TRect; flags : Cardinal; + depth : TColor_Space; bytes_per_row : Integer; screenID : TScreenID); +begin + CPlusObject := BBitmap_Create(Self, frame, flags, depth, bytes_per_row, + screenID); +end; + +// BBitmap(BRect bounds, color_space depth, bool accepts_views = false, +// bool need_contiguous = false); +constructor TBitmap.Create(frame{bounds} : TRect; depth : TColor_Space; + accepts_views : boolean; need_contiguous : Boolean); +begin + CPlusObject := BBitmap_Create_1(Self, frame.CPlusObject, depth, + accepts_views, need_contiguous); +end; + +// BBitmap(const BBitmap* source, bool accepts_views = false, +// bool need_contiguous = false); +constructor TBitmap.Create(source : TBitmap; accepts_views : Boolean; + need_contiguous : Boolean); +begin + CPlusObject := BBitmap_Create_2(Self, source, accepts_views, need_contiguous); +end; + +// BBitmap(BMessage *data); +constructor TBitmap.Create(data : TMessage); +begin + CPlusObject := BBitmap_Create_3(Self, data.CPlusObject); +end; + +destructor TBitmap.Destroy; +begin + BBitmap_Free(CPlusObject); + inherited; +end; + +function TBitmap.Instantiate(data : TMessage) : TArchivable; +begin + Result := BBitmap_Instantiate(CPlusObject, data.CPlusObject); +end; + +function TBitmap.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + Result := BBitmap_Archive(CPlusObject, data.CPlusObject, deep); +end; + +function TBitmap.InitCheck : TStatus_t; +begin + Result := BBitmap_InitCheck(CPlusObject); +end; + +function TBitmap.IsValid : boolean; +begin + Result := BBitmap_IsValid(CPlusObject); +end; + +function TBitmap.LockBits(state : PCardinal) : TStatus_t; +begin + Result := BBitmap_LockBits(CPlusObject, state); +end; + +procedure TBitmap.UnlockBits; +begin + BBitmap_UnlockBits(CPlusObject); +end; + +function TBitmap.Area : TArea_ID; +begin + Result := BBitmap_Area(CPlusObject); +end; + +function TBitmap.Bits : Pointer; +begin + Result := BBitmap_Bits(CPlusObject); +end; + +function TBitmap.BitsLength : integer; +begin + Result := BBitmap_BitsLength(CPlusObject); +end; + +function TBitmap.BytesPerRow : integer; +begin + Result := BBitmap_BytesPerRow(CPlusObject); +end; + +function TBitmap.ColorSpace : TColor_Space; +begin + Result := BBitmap_ColorSpace(CPlusObject); +end; + +function TBitmap.Bounds : TRect; +begin + Result := BBitmap_Bounds(CPlusObject); +end; + +procedure TBitmap.SetBits(data : Pointer; length : integer; offset : integer; cs : TColor_Space); +begin + BBitmap_SetBits(CPlusObject, data, length, offset, cs); +end; + +function TBitmap.GetOverlayRestrictions(restrict : TOverlayRestrictions) : TStatus_t; +begin + Result := BBitmap_GetOverlayRestrictions(CPlusObject, restrict); +end; + +procedure TBitmap.AddChild(view : TView); +begin + BBitmap_AddChild(CPlusObject, view.CPlusObject); +end; + +function TBitmap.RemoveChild(view : TView) : boolean; +begin + Result := BBitmap_RemoveChild(CPlusObject, view.CPlusObject); +end; + +function TBitmap.CountChildren : integer; +begin + Result := BBitmap_CountChildren(CPlusObject); +end; + +function TBitmap.ChildAt(index : integer) : TView; +begin + Result := BBitmap_ChildAt(CPlusObject, index); +end; + +function TBitmap.FindView(view_name : PChar) : TView; +begin + Result := BBitmap_FindView(CPlusObject, view_name); +end; + +function TBitmap.FindView(point : TPoint) : TView; +begin + Result := BBitmap_FindView(CPlusObject, point.CPlusObject); +end; + +function TBitmap.Lock : boolean; +begin + Result := BBitmap_Lock(CPlusObject); +end; + +procedure TBitmap.Unlock; +begin + BBitmap_Unlock(CPlusObject); +end; + +function TBitmap.IsLocked : boolean; +begin + Result := BBitmap_IsLocked(CPlusObject); +end; + + +function TBitmap.Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +begin + Result := BBitmap_Perform(CPlusObject, d, arg); +end; + + +{ +procedure TBitmap._ReservedBitmap1; +begin + BBitmap__ReservedBitmap1(CPlusObject); +end; + +procedure TBitmap._ReservedBitmap2; +begin + BBitmap__ReservedBitmap2(CPlusObject); +end; + +procedure TBitmap._ReservedBitmap3; +begin + BBitmap__ReservedBitmap3(CPlusObject); +end; + +constructor TBitmap.Create( : TBitmap); +begin + CPlusObject := BBitmap_Create(Self, ); +end; + +function TBitmap.operator=( : TBitmap) : TBitmap; +begin + Result := BBitmap_operator=(CPlusObject, ); +end; + +function TBitmap.get_shared_pointer : PChar; +begin + Result := BBitmap_get_shared_pointer(CPlusObject); +end; + +procedure TBitmap.set_bits(offset : integer; data : PChar; length : integer); +begin + BBitmap_set_bits(CPlusObject, offset, data, length); +end; + +procedure TBitmap.set_bits_24(offset : integer; data : PChar; length : integer); +begin + BBitmap_set_bits_24(CPlusObject, offset, data, length); +end; + +procedure TBitmap.set_bits_24_local_gray(offset : integer; data : PChar; len : integer); +begin + BBitmap_set_bits_24_local_gray(CPlusObject, offset, data, len); +end; + +procedure TBitmap.set_bits_24_local_256(offset : integer; data : PByte; len : integer); +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); +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); +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); +begin + BBitmap_set_bits_gray_24(CPlusObject, offset, data, length, big_endian_dst); +end; + +function TBitmap.get_server_token : integer; +begin + Result := BBitmap_get_server_token(CPlusObject); +end; + +procedure TBitmap.InitObject(frame : TRect; depth : TColor_Space; flags : Cardinal; bytesPerRow : integer; screenID : TScreenID); +begin + BBitmap_InitObject(CPlusObject, frame.CPlusObject, depth, flags, bytesPerRow, screenID); +end; + +procedure TBitmap.AssertPtr; +begin + BBitmap_AssertPtr(CPlusObject); +end; + +procedure TBitmap.void *fBasePtr; +begin + BBitmap_void *fBasePtr(CPlusObject); +end; + +procedure TBitmap.int32 fSize; +begin + BBitmap_int32 fSize(CPlusObject); +end; + +procedure TBitmap.color_space fType; +begin + BBitmap_color_space fType(CPlusObject); +end; + +procedure TBitmap.BRect fBound; +begin + BBitmap_BRect fBound(CPlusObject); +end; + +procedure TBitmap.int32 fRowBytes; +begin + BBitmap_int32 fRowBytes(CPlusObject); +end; + +procedure TBitmap.BWindow *fWindow; +begin + BBitmap_BWindow *fWindow(CPlusObject); +end; + +procedure TBitmap.int32 fServerToken; +begin + BBitmap_int32 fServerToken(CPlusObject); +end; + +procedure TBitmap.int32 fToken; +begin + BBitmap_int32 fToken(CPlusObject); +end; + +procedure TBitmap.uint8 unused; +begin + BBitmap_uint8 unused(CPlusObject); +end; + +procedure TBitmap.area_id fArea; +begin + BBitmap_area_id fArea(CPlusObject); +end; + +procedure TBitmap.area_id fOrigArea; +begin + BBitmap_area_id fOrigArea(CPlusObject); +end; + +procedure TBitmap.uint32 fFlags; +begin + BBitmap_uint32 fFlags(CPlusObject); +end; + +procedure TBitmap.status_t fInitError; +begin + BBitmap_status_t fInitError(CPlusObject); +end; +} + +end. \ No newline at end of file