![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Преобразование TPicture в TBitmap [D7, WinXP]
Ilg © (2004-11-26 18:11:00)Здравствуйте!
Скажите, как можно быстро преобразовать изображение, хранимое в TPicture в формат TBitmap?
Заранее, Большое Спасибо!
Megabyte-CeerCop (2004-11-30 08:32:00) [1]
> 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;
// всегда работало и работает.
//Чё вы там мудрите!
Mihey_temporary (2004-11-28 19:09:00) [2]2 Fenik:
> Можно просто скопировать с канвы TPictureна Bitmap.
А я то думал... :)
Fenik (2004-11-28 18:58:00) [3]>Mihey_temporary © (26.11.04 21:48) [4]
>Где ж канва-то?
Bitmap.Canvas.Draw(0,0,Picture.Graphic);
:))
elected (2004-11-28 00:45:00) [4]Рад, что разобрались =-)
murtix (2004-11-27 21:26:00) [5]По-моему лучше так
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);
Ilg (2004-11-27 19:05:00) [6]Спасибо! Вот что у меня получилось:
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);
elected (2004-11-27 10:45:00) [7]Ребята стойте!!!
Вас не туда понесло =-))))
var
bmp:Tbitmap;
begin
bmp.create;
Bmp.Assign(Picture.Graphic);
....
end;
// Picture твоя =-))) и все алес
Ilg (2004-11-27 09:54:00) [8]2murtix:
Насколько я понимаю, если в TPicture загружено изображение Jpeg, Gif и т. д., то Picture.Bitmap - пуст...
Или я не прав?
murtix (2004-11-26 23:25:00) [9]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;
Mihey_temporary (2004-11-26 21:48:00) [10]
> Можно просто скопировать с канвы TPicture на Bitmap.
Где ж канва-то?
Fenik (2004-11-26 20:28:00) [11]Можно просто скопировать с канвы TPicture на Bitmap.
Fenik (2004-11-26 20:27:00) [12]> murtix (26.11.04 20:20) [1]
Неверно.
murtix (2004-11-26 20:20:00) [13]Не надо ничего преобразовывать
var
pic : TPicture;
begin
...
pic.Bitmap;
...
end;