可能非常简单,但是我试图弄清楚如何在Delphi FMX中获得用于填充TRoundRect
的图像。我在表单上有一个圆角矩形,并为其分配了图像,但是当我将矩形位图加载到图像中时,它以通常的宽高比显示,因此覆盖了位于其下方的圆角矩形。我的代码的相关部分如下所示:
Rec := TRoundRect.Create(Self);
Rec.Height := 180;
Rec.Width := 250;
Rec.Corners := [TCorner.TopLeft, TCorner.TopRight, TCorner.BottomLeft];
Image := TImage.Create(Self);
Image.Parent := Rec;
Image.Bitmap := TBitmap.Create;
Image.Align := TAlignLayout.Client;
Image.WrapMode := TImageWrapMode.Stretch;
Image.Bitmap.LoadFromFile('C:\temp\test.bmp');
Image.Bitmap := FAllProgrammes[I].Image;
FlowLayout1.AddObject(Rec);
有人通过使用父级或TRoundRect
画布的某些属性对我如何裁剪图像以适合TRoundRect
并填写E [23/Jul/2018:09:58:41 +0000] [Job 6] Unable to open raster stream - : Broken pipe
E [23/Jul/2018:09:58:49 +0000] [Job 6] Job stopped due to filter errors; please consult the error_log file for details.
D [23/Jul/2018:09:58:49 +0000] [Job 6] The following messages were recorded from 09:58:40 to 09:58:49
D [23/Jul/2018:09:58:49 +0000] [Job 6] Adding start banner page "none".
D [23/Jul/2018:09:58:49 +0000] [Job 6] Adding end banner page "none".
D [23/Jul/2018:09:58:49 +0000] [Job 6] File of type application/vnd.cups-pdf-banner queued by "anonymous".
D [23/Jul/2018:09:58:49 +0000] [Job 6] hold_until=0
D [23/Jul/2018:09:58:49 +0000] [Job 6] Queued on "BIXOLON_SRP-350plus" by "anonymous".
D [23/Jul/2018:09:58:49 +0000] [Job 6] time-at-processing=1532339920
D [23/Jul/2018:09:58:49 +0000] [Job 6] 4 filters for job:
D [23/Jul/2018:09:58:49 +0000] [Job 6] bannertopdf (application/vnd.cups-pdf-banner to application/pdf, cost 32)
D [23/Jul/2018:09:58:49 +0000] [Job 6] pdftopdf (application/pdf to application/vnd.cups-pdf, cost 66)
D [23/Jul/2018:09:58:49 +0000] [Job 6] gstoraster (application/vnd.cups-pdf to application/vnd.cups-raster, cost 99)
D [23/Jul/2018:09:58:49 +0000] [Job 6] rastertoBixolon (application/vnd.cups-raster to printer/BIXOLON_SRP-350plus, cost 0)
D [23/Jul/2018:09:58:49 +0000] [Job 6] job-sheets=none,none
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[0]="BIXOLON_SRP-350plus"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[1]="6"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[2]="anonymous"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[3]="Test Page"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[4]="1"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[5]="job-uuid=urn:uuid:ad1163dc-f342-3a53-7ad0-d7343737dd60 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1532339920 time-at-processing=1532339920"
D [23/Jul/2018:09:58:49 +0000] [Job 6] argv[6]="/var/spool/cups/d00006-001"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[1]="CUPS_DATADIR=/usr/share/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[2]="CUPS_DOCROOT=/usr/share/cups/doc-root"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[3]="CUPS_FONTPATH=/usr/share/cups/fonts"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[4]="CUPS_REQUESTROOT=/var/spool/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[5]="CUPS_SERVERBIN=/usr/lib/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[6]="CUPS_SERVERROOT=/etc/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[7]="CUPS_STATEDIR=/var/run/cups"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[8]="HOME=/var/spool/cups/tmp"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[9]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[10]="SERVER_ADMIN=root@raspberrypi"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[11]="SOFTWARE=CUPS/2.2.1"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[12]="TMPDIR=/var/spool/cups/tmp"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[13]="USER=root"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[14]="CUPS_MAX_MESSAGE=2047"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[15]="CUPS_SERVER=/var/run/cups/cups.sock"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[16]="CUPS_ENCRYPTION=IfRequested"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[17]="IPP_PORT=631"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[18]="CHARSET=utf-8"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[19]="LANG=en_US.UTF-8"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[20]="PPD=/etc/cups/ppd/BIXOLON_SRP-350plus.ppd"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[21]="RIP_MAX_CACHE=128m"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[22]="CONTENT_TYPE=application/vnd.cups-pdf-banner"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[23]="DEVICE_URI=usb://BIXOLON/SRP-350plus"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[24]="PRINTER_INFO=BIXOLON SRP-350plus"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[25]="PRINTER_LOCATION=raspberry"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[26]="PRINTER=BIXOLON_SRP-350plus"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[27]="PRINTER_STATE_REASONS=none"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[28]="CUPS_FILETYPE=document"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[29]="FINAL_CONTENT_TYPE=application/vnd.cups-raster"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[30]="AUTH_I****"
D [23/Jul/2018:09:58:49 +0000] [Job 6] Started filter /usr/lib/cups/filter/bannertopdf (PID 1921)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Started filter /usr/lib/cups/filter/pdftopdf (PID 1922)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Started filter /usr/lib/cups/filter/gstoraster (PID 1923)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Started filter /usr/lib/cups/filter/rastertoBixolon (PID 1924)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Started backend /usr/lib/cups/backend/usb (PID 1925)
D [23/Jul/2018:09:58:49 +0000] [Job 6] PID 1924 (/usr/lib/cups/filter/rastertoBixolon) stopped with status 108 (Exec format error)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Hint: Try setting the LogLevel to "debug" to find out more.
D [23/Jul/2018:09:58:49 +0000] [Job 6] execv failed: Exec format error
D [23/Jul/2018:09:58:49 +0000] [Job 6] pdftopdf: Last filter determined by the PPD: rastertoBixolon; FINAL_CONTENT_TYPE: application/vnd.cups-raster => pdftopdf will not log pages in page_log.
D [23/Jul/2018:09:58:49 +0000] [Job 6] OUTFORMAT=\"(null)\", so output format will be CUPS/PWG Raster
D [23/Jul/2018:09:58:49 +0000] [Job 6] Loading USB quirks from \"/usr/share/cups/usb\".
D [23/Jul/2018:09:58:49 +0000] [Job 6] Loaded 132 quirks.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Printing on printer with URI: usb://BIXOLON/SRP-350plus
D [23/Jul/2018:09:58:49 +0000] [Job 6] libusb_get_device_list=4
D [23/Jul/2018:09:58:49 +0000] [Job 6] STATE: +connecting-to-device
D [23/Jul/2018:09:58:49 +0000] [Job 6] STATE: -connecting-to-device
D [23/Jul/2018:09:58:49 +0000] [Job 6] Printer found with device ID: MFG:BIXOLON;CMD:SLCS,EPL;MDL:SRP-350plus;CLS:PRINTER;DES:BIXOLON THERMAL PRINTER; Device URI: usb://BIXOLON/SRP-350plus
D [23/Jul/2018:09:58:49 +0000] [Job 6] Device protocol: 2
D [23/Jul/2018:09:58:49 +0000] [Job 6] Sending data to printer.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Sent 0 bytes...
D [23/Jul/2018:09:58:49 +0000] [Job 6] PDF template file doesn\'t have form. It\'s okay.
D [23/Jul/2018:09:58:49 +0000] [Job 6] PID 1921 (/usr/lib/cups/filter/bannertopdf) exited with no errors.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Color Manager: Calibration Mode/Off
D [23/Jul/2018:09:58:49 +0000] [Job 6] PID 1922 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Calling FindDeviceById(cups-BIXOLON_SRP-350plus)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Found device /org/freedesktop/ColorManager/devices/cups_BIXOLON_SRP_350plus
D [23/Jul/2018:09:58:49 +0000] [Job 6] Calling org.freedesktop.ColorManager.Device.Get(ProfilingInhibitors)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Calling FindDeviceById(cups-BIXOLON_SRP-350plus)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Found device /org/freedesktop/ColorManager/devices/cups_BIXOLON_SRP_350plus
D [23/Jul/2018:09:58:49 +0000] [Job 6] Calling GetProfileForQualifiers(1Gray..180dpi...)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Found profile /org/freedesktop/ColorManager/profiles/BIXOLON_SRP_350plus_CMYK__
D [23/Jul/2018:09:58:49 +0000] [Job 6] Calling org.freedesktop.ColorManager.Profile.Get(Filename)
D [23/Jul/2018:09:58:49 +0000] [Job 6] Use profile filename: \'\'
D [23/Jul/2018:09:58:49 +0000] [Job 6] Color Manager: ICC Profile:
D [23/Jul/2018:09:58:49 +0000] [Job 6] Ghostscript using Any-Part-of-Pixel method to fill paths.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Ghostscript command line: gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -r180x180 -dDEVICEWIDTHPOINTS=204 -dDEVICEHEIGHTPOINTS=198 -dcupsBitsPerColor=1 -dcupsColorOrder=1 -dcupsColorSpace=3 -scupsPageSizeName=61X72MMY70MM -I/usr/share/cups/fonts -c \'<</.HWMargins[0.000000 0.000000 0.000000 0.000000] /Margins[0 0]>>setpagedevice\' -f -_
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[0]=\"CUPS_CACHEDIR=/var/cache/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[1]=\"CUPS_DATADIR=/usr/share/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[2]=\"CUPS_DOCROOT=/usr/share/cups/doc-root\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[3]=\"CUPS_FONTPATH=/usr/share/cups/fonts\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[4]=\"CUPS_REQUESTROOT=/var/spool/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[5]=\"CUPS_SERVERBIN=/usr/lib/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[6]=\"CUPS_SERVERROOT=/etc/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[7]=\"CUPS_STATEDIR=/var/run/cups\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[8]=\"HOME=/var/spool/cups/tmp\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[9]=\"PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[10]=\"SERVER_ADMIN=root@raspberrypi\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[11]=\"SOFTWARE=CUPS/2.2.1\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[12]=\"TMPDIR=/var/spool/cups/tmp\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[13]=\"USER=root\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[14]=\"CUPS_MAX_MESSAGE=2047\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[15]=\"CUPS_SERVER=/var/run/cups/cups.sock\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[16]=\"CUPS_ENCRYPTION=IfRequested\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[17]=\"IPP_PORT=631\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[18]=\"CHARSET=utf-8\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[19]=\"LANG=en_US.UTF-8\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[20]=\"PPD=/etc/cups/ppd/BIXOLON_SRP-350plus.ppd\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[21]=\"RIP_MAX_CACHE=128m\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[22]=\"CONTENT_TYPE=application/vnd.cups-pdf-banner\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[23]=\"DEVICE_URI=usb://BIXOLON/SRP-350plus\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[24]=\"PRINTER_INFO=BIXOLON SRP-350plus\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[25]=\"PRINTER_LOCATION=raspberry\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[26]=\"PRINTER=BIXOLON_SRP-350plus\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[27]=\"PRINTER_STATE_REASONS=none\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[28]=\"CUPS_FILETYPE=document\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[29]=\"FINAL_CONTENT_TYPE=application/vnd.cups-raster\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] envp[30]=\"AUTH_INFO_REQUIRED=none\"
D [23/Jul/2018:09:58:49 +0000] [Job 6] Start rendering...
D [23/Jul/2018:09:58:49 +0000] [Job 6] Processing page 1...
D [23/Jul/2018:09:58:49 +0000] [Job 6] Error: /ioerror in --showpage--
D [23/Jul/2018:09:58:49 +0000] [Job 6] Operand stack:
D [23/Jul/2018:09:58:49 +0000] [Job 6] (/var/spool/cups/tmp/gs_pzoLDv) --nostringval-- 1 true
D [23/Jul/2018:09:58:49 +0000] [Job 6] Execution stack:
D [23/Jul/2018:09:58:49 +0000] [Job 6] %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 2003 1 3 %oparray_pop 2002 1 3 %oparray_pop 1986 1 3 %oparray_pop --nostringval-- --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1874 2 9 %oparray_pop --nostringval-- --nostringval--
D [23/Jul/2018:09:58:49 +0000] [Job 6] Dictionary stack:
D [23/Jul/2018:09:58:49 +0000] [Job 6] --dict:1216/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:135/256(ro)(G)-- --dict:291/300(ro)(G)-- --dict:32/32(L)-- --dict:6/9(L)-- --dict:27/40(L)--
D [23/Jul/2018:09:58:49 +0000] [Job 6] Current allocation mode is local
D [23/Jul/2018:09:58:49 +0000] [Job 6] Last OS error: Broken pipe
D [23/Jul/2018:09:58:49 +0000] [Job 6] GPL Ghostscript 9.20: Unrecoverable error, exit code 1
D [23/Jul/2018:09:58:49 +0000] [Job 6] Rendering completed
D [23/Jul/2018:09:58:49 +0000] [Job 6] PID 1923 (/usr/lib/cups/filter/gstoraster) stopped with status 1.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Hint: Try setting the LogLevel to "debug" to find out more.
D [23/Jul/2018:09:58:49 +0000] [Job 6] Waiting for read thread to exit...
D [23/Jul/2018:09:58:49 +0000] [Job 6] Read thread still active, aborting the pending read...
D [23/Jul/2018:09:58:49 +0000] [Job 6] PID 1925 (/usr/lib/cups/backend/usb) exited with no errors.
D [23/Jul/2018:09:58:49 +0000] [Job 6] End of messages
D [23/Jul/2018:09:58:49 +0000] [Job 6] printer-state=3(idle)
D [23/Jul/2018:09:58:49 +0000] [Job 6] printer-state-message="Rendering completed"
D [23/Jul/2018:09:58:49 +0000] [Job 6] printer-state-reasons=none
有任何建议/指针吗?干杯
答案 0 :(得分:0)
谢谢约翰的指点。结合这个demo,我在Embarcadero网站上找到了答案。只是在一个快速的独立项目中,我将一个roundrect放到了表单和按钮上。然后在按钮后面单击以添加一些代码以创建位图,然后将其分配给roundrect:
procedure TForm2.Button1Click(Sender: TObject);
var
Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('C:\temp\test.jpg');
RoundRect1.Fill.Kind := TbrushKind.Bitmap;
RoundRect1.Fill.Bitmap.WrapMode := TWrapMode.TileStretch;
RoundRect1.Fill.Bitmap.Bitmap := Bitmap;
end;