Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.48 MB
Время: -0.956 c
1-1110027236
Checist [root]
2005-03-05 15:53
2005.03.20
И снова TWebBrowser


14-1109759124
mmms
2005-03-02 13:25
2005.03.20
Здравствуйте! Подскажите зачем есть такая закладка Diagram


14-1109668797
ex080D:07BBh
2005-03-01 12:19
2005.03.20
Что будете дарить на 8 марта своим девушкам?


6-1105444565
Grant
2005-01-11 14:56
2005.03.20
TClientSocket & TServerSocket


3-1108808969
xman
2005-02-19 13:29
2005.03.20
Oracle rdb 8.0.0.4




   Наверх