---
title: "init(focusedViewRect:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsbitmapimagerep/init(focusedviewrect:)"
---

# init(focusedViewRect:)

Initializes a newly allocated bitmap image representation with bitmap data from a rendered image.

## Declaration

```swift
init?(focusedViewRect rect: NSRect)
```

## Parameters

- `rect`: A rectangle that specifies an area of the current window in the current coordinate system.

## Return Value

Return Value Returns the initialized object or nil If for any reason the new object can’t be initialized.

## Discussion

Discussion This method uses imaging operators to read the image data into a buffer; the object is then created from that data. The object is initialized with information about the image obtained from the window server.

## See Also

### Creating Bitmap Representations of Images

- [imageReps(with:)](appkit/nsbitmapimagerep/imagereps(with:).md)
- [colorize(byMappingGray:to:blackMapping:whiteMapping:)](appkit/nsbitmapimagerep/colorize(bymappinggray:to:blackmapping:whitemapping:).md)
- [init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:)](appkit/nsbitmapimagerep/init(bitmapdataplanes:pixelswide:pixelshigh:bitspersample:samplesperpixel:hasalpha:isplanar:colorspacename:bitmapformat:bytesperrow:bitsperpixel:).md)
- [init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)](appkit/nsbitmapimagerep/init(bitmapdataplanes:pixelswide:pixelshigh:bitspersample:samplesperpixel:hasalpha:isplanar:colorspacename:bytesperrow:bitsperpixel:).md)
- [init(cgImage:)](appkit/nsbitmapimagerep/init(cgimage:)-7o5tz.md)
- [init(ciImage:)](appkit/nsbitmapimagerep/init(ciimage:)-7bi19.md)
- [init(data:)](appkit/nsbitmapimagerep/init(data:).md)
- [init(forIncrementalLoad:)](appkit/nsbitmapimagerep/init(forincrementalload:).md)
