View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003031 | JEDI VCL | 04 Feature Request | public | 2005-06-11 21:48 | 2005-08-09 09:36 |
| Reporter | anonymous | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | open | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0003031: JvToolbar and JvMenus: Better painting of disabled images | ||||
| Description | The standard VCL and JVCL painting of disabled images is rather poor. A better painting would alleviate the need for creating and including DisabledImages lists. For instance TBX (now available at http://mxs.bergsoft.net/) is using the following routine for this purpose: procedure DrawTBXIconShadow(Canvas: TCanvas; const R: TRect; ImageList: TCustomImageList; ImageIndex: Integer; Density: Integer); const D_DIV: array [0..2] of Cardinal = (3, 8, 20); D_ADD: array [0..2] of Cardinal = (255 - 255 div 3, 255 - 255 div 8, 255 - 255 div 20); var ImageWidth, ImageHeight: Integer; I, J: Integer; Src, Dst: ^Cardinal; S, C, CBRB, CBG: Cardinal; begin Assert(Density in [0..2]); ImageWidth := R.Right - R.Left; ImageHeight := R.Bottom - R.Top; with ImageList do begin if Width < ImageWidth then ImageWidth := Width; if Height < ImageHeight then ImageHeight := Height; end; StockBitmap1.Width := ImageWidth; StockBitmap1.Height := ImageHeight; StockBitmap2.Width := ImageWidth; StockBitmap2.Height := ImageHeight; BitBlt(StockBitmap1.Canvas.Handle, 0, 0, ImageWidth, ImageHeight, Canvas.Handle, R.Left, R.Top, SRCCOPY); {BitBlt(StockBitmap2.Canvas.Handle, 0, 0, ImageWidth, ImageHeight, StockBitmap1.Canvas.Handle, 0, 0, SRCCOPY);} {vb -} BitBlt(StockBitmap2.Canvas.Handle, 0, 0, ImageWidth, ImageHeight, Canvas.Handle, R.Left, R.Top, SRCCOPY); {vb +} ImageList.Draw(StockBitmap2.Canvas, 0, 0, ImageIndex, True); for J := 0 to ImageHeight - 1 do begin Src := StockBitmap2.ScanLine[J]; Dst := StockBitmap1.ScanLine[J]; for I := 0 to ImageWidth - 1 do begin S := Src^; if S <> Dst^ then begin CBRB := Dst^ and $00FF00FF; CBG := Dst^ and $0000FF00; {C := ((S and $FF0000) shr 16 * 29 + (S and $00FF00) shr 8 * 150 + (S and $0000FF) * 76) shr 8;} {vb -} C := ((S and $00FF0000) shr 16 * 29 + (S and $0000FF00) shr 8 * 150 + (S and $000000FF) * 76) shr 8; {vb +} C := C div D_DIV[Density] + D_ADD[Density]; Dst^ := ((CBRB * C and $FF00FF00) or (CBG * C and $00FF0000)) shr 8; end; Inc(Src); Inc(Dst); end; end; BitBlt(Canvas.Handle, R.Left, R.Top, ImageWidth, ImageHeight, StockBitmap1.Canvas.Handle, 0, 0, SRCCOPY); end; SharpDevelop on the other hand uses a Windows XP specific ImageList_DrawEx state flag ILS_SATURATE. | ||||
| Tags | No tags attached. | ||||