Changeset 16:0bee9065699b
- Timestamp:
- 01/25/08 13:45:34
(10 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
some corrections
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r11 |
r16 |
|
| 15 | 15 | |
|---|
| 16 | 16 | import dwt.graphics.GCData; |
|---|
| | 17 | import dwt.internal.win32.WINTYPES; |
|---|
| 17 | 18 | |
|---|
| 18 | 19 | /** |
|---|
| … | … | |
| 48 | 49 | */ |
|---|
| 49 | 50 | |
|---|
| 50 | | public int /*long*/ internal_new_GC (GCData data); |
|---|
| | 51 | public HDC internal_new_GC (GCData data); |
|---|
| 51 | 52 | |
|---|
| 52 | 53 | /** |
|---|
| … | … | |
| 63 | 64 | * @param data the platform specific GC data |
|---|
| 64 | 65 | */ |
|---|
| 65 | | public void internal_dispose_GC ( int /*long*/ handle, GCData data); |
|---|
| | 66 | public void internal_dispose_GC ( HDC handle, GCData data); |
|---|
| 66 | 67 | |
|---|
| 67 | 68 | } |
|---|
| r8 |
r16 |
|
| 37 | 37 | * </p> |
|---|
| 38 | 38 | */ |
|---|
| 39 | | public TEXTMETRIC handle; |
|---|
| | 39 | public TEXTMETRIC* handle; |
|---|
| 40 | 40 | |
|---|
| 41 | 41 | /** |
|---|
| … | … | |
| 58 | 58 | if (object is this) return true; |
|---|
| 59 | 59 | if( auto metricObj = cast(FontMetrics)object ){ |
|---|
| 60 | | TEXTMETRIC metric = metricObj.handle; |
|---|
| | 60 | auto metric = metricObj.handle; |
|---|
| 61 | 61 | return handle.tmHeight is metric.tmHeight && |
|---|
| 62 | 62 | handle.tmAscent is metric.tmAscent && |
|---|
| … | … | |
| 176 | 176 | * @return a new font metrics object containing the specified <code>TEXTMETRIC</code> |
|---|
| 177 | 177 | */ |
|---|
| 178 | | public static FontMetrics win32_new(TEXTMETRIC handle) { |
|---|
| | 178 | public static FontMetrics win32_new(TEXTMETRIC* handle) { |
|---|
| 179 | 179 | FontMetrics fontMetrics = new FontMetrics(); |
|---|
| 180 | 180 | fontMetrics.handle = handle; |
|---|
| r9 |
r16 |
|
| 153 | 153 | } else { |
|---|
| 154 | 154 | for (int i = 0; i < colors.length; i++) { |
|---|
| 155 | | if (colors[i] is rgb ) return i; |
|---|
| | 155 | if (colors[i] ==/*eq*/ rgb ) return i; |
|---|
| 156 | 156 | } |
|---|
| 157 | 157 | /* The RGB did not exist in the palette */ |
|---|
| r6 |
r16 |
|
| 104 | 104 | } |
|---|
| 105 | 105 | float r, g, b; |
|---|
| 106 | | if (saturation == 0) { |
|---|
| | 106 | if (saturation is 0) { |
|---|
| 107 | 107 | r = g = b = brightness; |
|---|
| 108 | 108 | } else { |
|---|
| 109 | | if (hue == 360) hue = 0; |
|---|
| | 109 | if (hue is 360) hue = 0; |
|---|
| 110 | 110 | hue /= 60; |
|---|
| 111 | 111 | int i = cast(int)hue; |
|---|
| … | … | |
| 169 | 169 | float hue = 0; |
|---|
| 170 | 170 | float brightness = max; |
|---|
| 171 | | float saturation = max == 0 ? 0 : (max - min) / max; |
|---|
| 172 | | if (delta != 0) { |
|---|
| 173 | | if (r == max) { |
|---|
| | 171 | float saturation = max is 0 ? 0 : (max - min) / max; |
|---|
| | 172 | if (delta !is 0) { |
|---|
| | 173 | if (r is max) { |
|---|
| 174 | 174 | hue = (g - b) / delta; |
|---|
| 175 | 175 | } else { |
|---|
| 176 | | if (g == max) { |
|---|
| | 176 | if (g is max) { |
|---|
| 177 | 177 | hue = 2 + (b - r) / delta; |
|---|
| 178 | 178 | } else { |
|---|
| … | … | |
| 199 | 199 | if (object is this) return true; |
|---|
| 200 | 200 | if( auto rgb = cast(RGB) object ){ |
|---|
| 201 | | return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue); |
|---|
| | 201 | return (rgb.red is this.red) && (rgb.green is this.green) && (rgb.blue is this.blue); |
|---|
| 202 | 202 | } |
|---|
| 203 | 203 | return false; |
|---|