QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2707|回复: 0
打印 上一主题 下一主题

Display JPEG images

[复制链接]
字体大小: 正常 放大
韩冰        

823

主题

3

听众

4048

积分

我的地盘我做主

该用户从未签到

发帖功臣 元老勋章

跳转到指定楼层
1#
发表于 2005-1-26 12:43 |只看该作者 |倒序浏览
|招呼Ta 关注Ta

Display JPEG images

p5 R. H( K8 `* [5 w

6 w. b7 r3 R2 d- kAnswer ( W, w5 S' L2 x5 {' [( rUse the class TJPEGImage to load the JPEG, and then use the Assign method to draw the JPEG onto a regular TImage. Here is a code example that demonstrates how.

; Z/ z4 U, ?* [+ ]4 y+ M( O. I$ d

#include <jpeg.hpp>

0 u! T: V4 ] T8 ]

void __fastcall TForm1::Button1Click(TObject *Sender), N$ u) v& Q8 X: b# r# s {8 d) {5 K- g, c: v // Create a TJPEGImage, and tell it to load the file conf99.jpg) ]: F. [6 e& Q TJPEGImage *JImage = new TJPEGImage; 2 B1 Q6 W6 n* `, O u% F# R JImage->LoadFromFile("conf99.jpg");

+ a, L9 o# @/ v; A# _9 Q3 }

// Now that we have a TJEGImage, we can use Assign to! g$ k( P' P |. y* L2 q" w2 n // copy that image into a TImage. % j0 z: r @8 x3 U/ I Image1->Width = JImage->Width;9 V( ]( P6 P9 L3 n# l- s: `* d Image1->Height = JImage->Height;/ ^4 @! V0 G- u! |" t Image1->icture->Assign(JImage);

0 z% ^; @! T- n6 r# V

delete JImage;1 j: ?% y5 r0 h3 b! B }

3 e* y; ?) M* }, L. Z3 `

Figure 1 shows the program in action. The image is a picture of me and my son playing games during the DirectX madness event at Borcon 99. The picture was taken by Danny Thorpe, and its part of his photo gallery on the community website. Fortunately for you, Danny took a picture of my best side.

5 l; L+ P# A; {, o S& W9 C

" [+ J7 A5 A: z# {" N3 f) g

zan
转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
您需要登录后才可以回帖 登录 | 注册地址

qq
收缩
  • 电话咨询

  • 04714969085
fastpost

关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

手机版|Archiver| |繁體中文 手机客户端  

蒙公网安备 15010502000194号

Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

GMT+8, 2026-4-18 22:13 , Processed in 0.390454 second(s), 51 queries .

回顶部