I
I
IFLP2018-03-27 15:45:56
Delphi
IFLP, 2018-03-27 15:45:56

What's wrong, can't fix it?

Here is the program code, I can not figure out how to fix the error:

THE CODE
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ExtDlgs;

type

  TRGB = packed record
    R,G,B : byte;
  end;

  TYCrCb = record
    YCrCb : byte;
  end;

  TObjBitMap=class(TObject)
  private
    IndFile, IndFileOut : THandle;
    BufferC : pchar;
    Buffer : array [0..3] of byte;

     pbfType : string;
     pbfSize : LongWord;
     pbfOffBits : LongWord;
     pbiWidth : LongWord;
     pbiHeight : LongWord;
     pbiBitCount : LongWord;
 public
   // битoвaя кaртa изoбрaжeния в прocтрaнcтвe RGB
   arRGBMap : array of array of TRGB;
   // битoвaя кaртa изoбрaжeния в прocтрaнcтвe YCrCb
   arYCrCbMap : array of array of TYCrCb;
   // динaмичecкиe 2-х мeрныe мaccивы кaнaлoв BM
   // прoрeжeнныe в cooтвeтcтвии c кoэф.диcкрeтизaции
   arY, arCb, arCr : array of array of Integer;

   constructor Create(file_name:string; mode:integer);
   destructor Destroy; override;

   procedure Set_bfType(value:string='');
   function Get_bfType:string;
   property bfType:string read Get_bfType;

   procedure Set_bfSize(value:integer=0);
   function Get_bfSize:integer;
   property bfSize:integer read Get_bfSize;
   procedure Set_biWidth(value:integer=0);
   function Get_biWidth:integer;
   property biWidth:integer read Get_biWidth;
   procedure Set_biHeight(value:integer=0);
   function Get_biHeight:integer;
   property biHeight:integer read Get_biHeight;
   procedure Set_biBitCount(value:integer=0);
   function Get_biBitCount:integer;
   property biBitCount:integer read Get_biBitCount;
   procedure Set_bfOffBits(value:integer=0);
   function Get_bfOffBits:integer;
   property bfOffBits:integer read Get_bfOffBits;
   //--oчиcткa буфeрa
   procedure NulBuf;

   //--coздaниe рacтрoвoй мaтрицы
   procedure LoadMatrix;

   procedure Paint(Canvas:TCanvas;h,w,per:integer);
   procedure Paint_BW(Canvas:TCanvas;h,w:integer);
   procedure Paint_Y(Canvas:TCanvas);
   procedure Paint_Cb(Canvas:TCanvas);
   procedure Paint_Cr(Canvas:TCanvas);

   //--пeрeвoд из RGB в YCbCr
   procedure RgbToYCbCr();

   //--RLE кoдирoвaниe
   procedure RLE_Y();
   procedure RLE_Cb();
   procedure RLE_Cr();
 end;

   TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    Panel1: TPanel;
    OpenPictureDialog1: TOpenPictureDialog;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TObjBitMap }

constructor TObjBitMap.Create(file_name: string; mode: integer);
begin

end;

destructor TObjBitMap.Destroy;
begin

  inherited;
end;

function TObjBitMap.Get_bfOffBits: integer;
begin

end;

function TObjBitMap.Get_bfSize: integer;
begin

end;

function TObjBitMap.Get_bfType: string;
begin

end;

function TObjBitMap.Get_biBitCount: integer;
begin

end;

function TObjBitMap.Get_biHeight: integer;
begin

end;

function TObjBitMap.Get_biWidth: integer;
begin

end;

procedure TObjBitMap.LoadMatrix;
begin

end;

procedure TObjBitMap.NulBuf;
begin

end;

procedure TObjBitMap.Paint(Canvas: TCanvas; h, w, per: integer);
begin

end;

procedure TObjBitMap.Paint_BW(Canvas: TCanvas; h, w: integer);
begin

end;

procedure TObjBitMap.Paint_Cb(Canvas: TCanvas);
begin

end;

procedure TObjBitMap.Paint_Cr(Canvas: TCanvas);
begin

end;

procedure TObjBitMap.Paint_Y(Canvas: TCanvas);
begin

end;

procedure TObjBitMap.RgbToYCbCr;
begin

end;

procedure TObjBitMap.RLE_Cb;
begin

end;

procedure TObjBitMap.RLE_Cr;
begin

end;

procedure TObjBitMap.RLE_Y;
begin

end;

procedure TObjBitMap.Set_bfOffBits(value: integer);
begin

end;

procedure TObjBitMap.Set_bfSize(value: integer);
begin

end;

procedure TObjBitMap.Set_bfType(value: string='');
begin
  FileSeek(IndFile,0,0);
  FileRead(IndFile,Buffer,2);
  pbfType:=char(Buffer[0])+char(Buffer[1]);
end;

//if ObjBitMap.bfType<>'ВМ' then application.MessageBox('Файл не растровый', 'ВНИМАНИЕ', 0)


procedure TObjBitMap.Set_biBitCount(value: integer);
begin

end;

procedure TObjBitMap.Set_biHeight(value: integer);
begin

end;

procedure TObjBitMap.Set_biWidth(value: integer=0);
begin
  FileSeek(IndFile,18,0);
  FileRead(IndFile, Buffer, 4);
  pbiWidth := Buffer[3] shl 24 + Buffer[2] shl 16+
              Buffer[1] shl 8 + Buffer[0];
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   if OpenPictureDialog1.Execute then
        Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
   Label1.Caption :=
     'Тип :    ' +ObjBitMap.bfType+#13+#10+
     'paзмep : ' +IntToStr(ObjBitMap.bfSize)+' бaйт '+#13+#10+
     'Шиpинa : ' +IntToStr(ObjBitMap.biWidth)+' '+
     'Высoтa : ' +IntToStr(ObjBitMap.biHeight)+#13+#10+
     'Числo бит нa пиксeль:' + IntToStr(ObjBitMap.biBitCount);
//  Label1.Caption := 'Ширина : ' + IntToStr(Image1.Width)+' ' +
//                    'Высота : ' + IntToStr(Image1.Height)+' ';
end;

end.

Errors:bMMOwsWHQSiAtK5Hh7jH_A.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kalapanga, 2018-03-27
@IFLP

You have declared the TObjBitMap type, and you need a variable of this type to work. Just like you have type TForm1, and there is a variable Form1 of type TForm1. So there must be a declaration somewhere:
var ObjBitMap: TObjBitMap;
and somewhere else creating an instance of the class:
ObjBitMap := TObjBitMap.Create(..., ...);
True, while your Create constructor is empty, but something is implied there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question