CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2022 开发者帮助

Brightness 属性 (ActiveX)

2024-5-18 18:45| 发布者: admin| 查看: 60| 评论: 0|原作者: admin|来自: AutoCAD

Brightness 属性 (ActiveX)

指定图像的当前亮度值。

支持的平台:仅限 Windows

签名

VBA:

object.Brightness
对象

类型:GeomapImageRasterImageWipeout

此属性应用于的对象。

属性值

只读:

类型:整数

亮度值是介于 0 和 100 之间的正整数(含 0 和 100)。默认值为 50。

言论

您可以调整图像亮度、对比度和淡入淡出以显示图像以及绘制的输出,而不会影响原始光栅图像文件。调整亮度以使图像变暗或变亮。调整对比度,使质量较差的图像更易于阅读。调整淡入淡出使矢量在图像上更易于查看,并在绘制的输出中创建水印效果。

无法调整双色调图像的亮度、对比度或淡入淡出。

例子

VBA:

Sub Example_Brightness()
    ' This example inserts a raster image and finds the current
    ' brightness of the image. It then changes the brightness
    ' of the image.
    
    ' This example uses the "2d Projected Polylines.jpg." found in the Sample
    ' directory. If you do not have this image, or if it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:/AutoCAD/sample/2d Projected Polylines.jpg"
    
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#
    
    On Error Resume Next
    
    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current brightness
    ThisDrawing.Regen True
    MsgBox "The brightness is currently set to: " & raster.Brightness, vbInformation
    
    ' Change the brightness to 5
    raster.Brightness = 5
    ThisDrawing.Regen True
    MsgBox "The brightness is now set to: " & raster.Brightness, vbInformation
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Brightness()
    ;; This example inserts a raster image and finds the current
    ;; brightness of the image. It then changes the brightness
    ;; of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have this image, or if it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngleInDegree 0
          rotAngle (/ (* rotAngleInDegree 3.141592) 180))

    (if (/= (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") insertionPoint scalefactor rotAngle))
            (vla-ZoomExtents acadObj)

            ;; Find the current brightness
            (vla-Regen doc :vlax-true)
            (alert (strcat "The brightness is currently set to: " (rtos (vla-get-Brightness raster) 2)))
    
            ;; Change the brightness to 5
            (vla-put-Brightness raster 5)
            (vla-Regen doc :vlax-true)
            (alert (strcat "The brightness is now set to: " (rtos (vla-get-Brightness raster) 2)))	  
	)
        (alert (strcat imageName " could not be found."))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 22:25

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部