CadBitmap

From SDK
Revision as of 21:55, 31 January 2024 by WikiSysop (talk | contribs) (→‎Example Code:)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Back.jpg

This object represents an imported bitmap in the program. It is identified by the object.ClassName property == "vcCadBitmap". To convert a CadObject to a CadBitmap use the helper function CastCadObjectToCadBitmap


Properties

.Brightness

Interaction: Read and Write

Returns: (integer) value in range 0 to 255

External methods

CastCadObjectToCadBitmap(CadObject object)

Return a CadBitmap object for the passed CadObject which must have been identified as being a CadBitmap.


Example Code:

  function SetBitmapBrightness(job, brightness)  
    if not job.Exists then  
      DisplayMessageBox("No job loaded")            
      return false        
     end  -- if end

     local layer_manager = job.LayerManager  
     local pos = layer_manager:GetHeadPosition()      
     while pos ~= nil do        
       local layer         
             layer, pos = layer_manager:GetNext(pos)         
        if not layer.IsSystemLayer then         
          local layer_pos = layer:GetHeadPosition()        
          while layer_pos ~= nil do            
             local object  
                   object, layer_pos = layer:GetNext(layer_pos)          
            if object.ClassName == "vcCadBitmap" then               
               cad_bitmap = CastCadObjectToCadBitmap(object)  
               MessageBox("Found bitmap - brightess = " .. cad_bitmap.Brightness)              
               cad_bitmap.Brightness = brightness               
               cad_bitmap.Visible = visible              
            end -- if end
          end -- while end
        end -- if end -- end of for each object on layer     
      end -- while end -- end of for each layer   
    job:Refresh2DView()  
  end -- function end   


Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information