Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.03.20;
Скачать: CL | DM;

Вниз

Преобразование TPicture в TBitmap   Найти похожие ветки 

 
Ilg   (2004-11-26 18:11) [0]

Здравствуйте!
Скажите, как можно быстро преобразовать изображение, хранимое в TPicture в формат TBitmap?
Заранее, Большое Спасибо!


 
murtix   (2004-11-26 20:20) [1]

Не надо ничего преобразовывать

var
 pic : TPicture;
begin
 ...
 pic.Bitmap;
 ...
end;



 
Fenik   (2004-11-26 20:27) [2]

> murtix  (26.11.04 20:20) [1]

Неверно.


 
Fenik   (2004-11-26 20:28) [3]

Можно просто скопировать с канвы TPicture на Bitmap.


 
Mihey_temporary ©   (2004-11-26 21:48) [4]


> Можно просто скопировать с канвы TPicture на Bitmap.


Где ж канва-то?


 
murtix   (2004-11-26 23:25) [5]

TImage = class(TGraphicControl)
 private
  ...
 protected
  ...
 public
  ...
 published
   ...
   property Picture: TPicture read FPicture write SetPicture;
   ...
 end;

TPicture = class(TInterfacedPersistent, IStreamPersist)
 private
   ...
 protected
   ...
 public
   ...
   property Bitmap: TBitmap read GetBitmap write SetBitmap;
   ...
 end;


 
Ilg   (2004-11-27 09:54) [6]

2murtix:
Насколько я понимаю, если в TPicture загружено изображение Jpeg, Gif и т. д., то Picture.Bitmap - пуст...
Или я не прав?


 
elected   (2004-11-27 10:45) [7]

Ребята стойте!!!
Вас не туда понесло =-))))

var
bmp:Tbitmap;
begin
bmp.create;
Bmp.Assign(Picture.Graphic);
....
end;

// Picture твоя =-))) и все алес


 
Ilg   (2004-11-27 19:05) [8]

Спасибо! Вот что у меня получилось:
function GraphicToBitmap(Graphic:TGraphic):TBitmap;
begin
 Result:=TBitmap.Create;
 if Graphic is TIcon
    then begin
          Result.Width:=Graphic.Width;
          Result.Height:=Graphic.Height;
          Result.Canvas.Draw(0,0,Graphic);
         end
    else Result.Assign(Graphic);
end;


bmp:=GraphicToBitmap(Picture.Graphic);


 
murtix   (2004-11-27 21:26) [9]

По-моему лучше так


procedure GraphicToBitmap(Graphic:TGraphic; var Res :TBitmap);
begin

if Graphic is TIcon
   then begin
         Res.Width:=Graphic.Width;
         Res.Height:=Graphic.Height;
         Res.Canvas.Draw(0,0,Graphic);
        end
   else Res.Assign(Graphic);
end;


GraphicToBitmap(Picture.Graphic, bmp);


 
elected   (2004-11-28 00:45) [10]

Рад, что разобрались =-)


 
Fenik   (2004-11-28 18:58) [11]

>Mihey_temporary ©  (26.11.04 21:48) [4]
>Где ж канва-то?

Bitmap.Canvas.Draw(0,0,Picture.Graphic);
:))


 
Mihey_temporary ©   (2004-11-28 19:09) [12]

2 Fenik:


>  Можно просто скопировать с канвы TPicture на Bitmap.


А я то думал... :)


 
Megabyte-CeerCop ©   (2004-11-30 08:32) [13]


> Fenik   (26.11.04 20:27) [2]
> > murtix  (26.11.04 20:20) [1]
>
> Неверно.


Воще народ деградирует :)

var b :TBitmap;

begin
b := Image1.Picture.Bitmap;
Image2.Picture.Bitmap := b;

end;

//  всегда работало и работает.
//Чё вы там мудрите!



Страницы: 1 вся ветка

Текущий архив: 2005.03.20;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.031 c
14-1109398331
31512
2005-02-26 09:12
2005.03.20
Распространённость различных операционных систем


6-1106130307
Ivolg
2005-01-19 13:25
2005.03.20
Быстрая скачка данных


9-1103555406
Макс
2004-12-20 18:10
2005.03.20
vectorgeometry


4-1107854819
MetalFan
2005-02-08 12:26
2005.03.20
EnumServicesStatus


1-1109774205
Anatoliy T.
2005-03-02 17:36
2005.03.20
Установлен ли Word