Determines if raster and render images are displayed at true color or palletized color.
Supported platforms: Windows only
VBA:
object.TrueColorImages
Type: PreferencesDisplay
The object this property applies to.
Read-only: No
Type: Boolean
The initial value for this property is False.
VBA:
Sub Example_TrueColorImages() ' This example reads and modifies the preference value which determines ' if raster and render images are displayed at True Color or palletized color. ' When finished, this example resets the preference value back to ' it's original value. ' ' This example uses the "2d Projected Polylines.jpg" found in the sample ' directory. If you do not have this image, or it is located ' in a different directory, insert a valid path and file name ' for the imageName variable below. Dim ACADPref As AcadPreferencesDisplay Dim originalValue As Variant, newValue As Variant Dim insertionPoint(0 To 2) As Double Dim scalefactor As Double, rotationAngle As Double Dim imageName As String Dim rasterObj As AcadRasterImage imageName = "c:\AutoCAD\sample\2d Projected Polylines.jpg" ' Define Raster object insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0 scalefactor = 5#: rotationAngle = 0 On Error GoTo ERRORTRAP ' Loads a raster image into model space Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle) ThisDrawing.Application.ZoomAll ' Get the display preferences object Set ACADPref = ThisDrawing.Application.Preferences.Display ' Read and display the original value originalValue = ACADPref.TrueColorImages MsgBox "The TrueColorImages preference is set to: " & originalValue ' Modify the TrueColorImages preference by toggling the value ACADPref.TrueColorImages = Not (originalValue) newValue = ACADPref.TrueColorImages ThisDrawing.Regen acAllViewports MsgBox "The TrueColorImages preference has been set to: " & newValue ' Reset the preference back to it's original value ' ' * Note: Comment out this last section to leave the change to ' this preference in effect ACADPref.TrueColorImages = originalValue ThisDrawing.Regen acAllViewports MsgBox "The TrueColorImages preference was reset back to: " & originalValue Exit Sub ' If you got an error (most likely a problem with the file path), ' then display an error message ERRORTRAP: If Err.Description <> "" Then MsgBox Err.Description End If End Sub
Visual LISP:
(vl-load-com) (defun c:Example_TrueColorImages() ;; This example reads and modifies the preference value which determines ;; if raster and render images are displayed at True Color or palletized color. ;; When finished, this example resets the preference value back to ;; it's original value. ;; ;; This example uses the "2d Projected Polylines.jpg" found in the sample ;; directory. If you do not have this image, or it is located ;; in a different directory, insert a valid path and file name ;; for the imageName variable below. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define Raster object (setq insertionPoint (vlax-3d-point 5 5 0) imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg" scalefactor 5 rotationAngle 0) (if (/= (findfile imageName) nil) (progn ;; Creates a raster image in model space (setq modelSpace (vla-get-ModelSpace doc)) (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle)) (vla-ZoomExtents acadObj) ;; Get the display preferences object (setq ACADPref (vla-get-Display (vla-get-Preferences acadObj))) ;; Read and display the original value (setq originalValue (vla-get-TrueColorImages ACADPref)) (alert (strcat "The TrueColorImages preference is set to: " (if (= originalValue :vlax-true) "True" "False"))) ;; Modify the TrueColorImages preference by toggling the value (vla-put-TrueColorImages ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true)) (vla-Regen doc acAllViewports) (alert (strcat "The TrueColorImages preference has been set to: " (if (= (vla-get-TrueColorImages ACADPref) :vlax-true) "True" "False"))) ;; Reset the preference back to it's original value ;; ;; * Note: Comment out this last section to leave the change to ;; this preference in effect (vla-put-TrueColorImages ACADPref originalValue) (vla-Regen doc acAllViewports) (alert (strcat "The TrueColorImages preference was reset back to: " (if (= (vla-get-TrueColorImages ACADPref) :vlax-true) "True" "False"))) ) (alert (strcat imageName " could not be found.")) ) )